PyANGKernel.GKModel

class GKModel

This class contains all the objects in a model.

Details

The entire object model is organized around the GKModel class. This class contains all the objects in a model (in our context a model is a document. For example a CAD map of a city will be the document, or model, in a CAD application).

Each time the user creates or open a new document an instance of GKModel is created. Each time the user saves the document to disk, all the data in the GKModel is saved.

A model is a collection of GKObjects instances (in fact of subclasses of GKObject ). A line, a road, an OD matrix… they are instances of a subclass of GKObject . An instance of a GKObject has a unique identifier (assigned when the object is first created and immutable during the live of the object) and a type.

The model contains preferences available using the getPreferences method.

<h2> GKModel as an object container</h2> The model holds all the data in a catalog (an instance of GKCatalog ). This catalog keeps the data organized by type and identifier. It also keeps all the visible geo objects (instances of GKGeoObject sub-classes) in the GKGeoModel . And it can also keep objects inside its root folder.

The main difference between this three types of containers (catalog, geo-model and folder) is that the catalog has all the objects in the model created using newObject either graphical and non-graphical. The geo-model contains only graphical objects that are shown at this moment (a graphical object will not be draw if is not in the geo-model). The root folder will contain any object (usually non-graphical) that will be shown in the GListViewForModel (see GKFolder ).

<h2>Object deletion and commands</h2> When an object is deleted all the relationships with it must destroyed too. If the deleted object is the owner of the relationship the solution is simple, this will be done at the object delete command. The problem is when the owner of the relationship is not the deleted object. This owner must be informed of the destruction to react accordingly.

As is possible that the deleted object do not know this relationship the GKModel implements a simple mechanism to be informed of when an object is deleted. In fact what is expected is that the owner of the relationship not only updates it but also support a possible UNDO.

When an object is “interested” in another and the target object is deleted the deleted object will ask the model for all the interested objects (unknowns to it until this moment) and will ask these “interested” objects to generate a GKObjectConnectionDelCmd command (see getDelConnectionCmd ) with the information that will be deleted or modified to support a possible UNDO.

If the deleted object is removed outside a command (no UNDO will be possible) then the object or editor that deletes it must call nonCommandObjectRemoved to inform any interested object of this deletion. This method will call then to nonCommandObjectRemoved for each interested object.

Inheritance diagram of PyANGKernel.GKModel

Synopsis

Methods

Virtual methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

PyANGKernel.GKModel.currentAvailableTypePos
PyANGKernel.GKModel.currentAvailableColPos
__init__()
accelerationGuiToModel(accel)
Parameters:

accel – float

Return type:

float

From an acceleration in m/s2 or f/s2 it returns the acceleration in m/s2

accelerationModelToGui(acceleration)
Parameters:

acceleration – float

Return type:

float

From an acceleration in m/s2 to acceleration in m/s2 or f/s2 depending of the units

accelerationName()
Return type:

str

Returns the accelaration name, either m/s^2 or f/s^2 depending of the units

addObjectToFolder(object, context, folderName)
Parameters:
Return type:

GKFolder

Adds an object to the most appropriate folder

addTSDescription(description)
Parameters:

descriptionGKTSDescription

Adds a description to the model. The pointer is adopted. Delete it using deleteDescription

areaGuiToModel(area)
Parameters:

area – float

Return type:

float

From an area in m2 or sqft returns it in m2

areaModelToGui(area)
Parameters:

area – float

Return type:

float

From an area in m2 to m2 or sqft depending of the units

areaName()
Return type:

str

Returns the area name, either m^2 or sqft depending of the units

assignStoreIdToTypesAndColumns()

Before a store operation, ensure that types and columns have a valid storeId.

batteryConsumptionName()
Return type:

str

Returns the battery consumption, either kwh

canBeClosed()
Return type:

bool

Can this document be closed? Maybe a plug-in is doing something that must be stopped first. If it returns false the document will not be closed.

canCreateRevision()
Return type:

bool

Returns true if a revision can be created from the following model (it checks that the model has been stored on disk, asDB / stream revisions are not supported right now).

checkAndFixPath(location, description[, who=None[, anyFile=false]])
Parameters:
  • location – str

  • description – str

  • whoGKObject

  • anyFile – bool

Return type:

bool

Check if the external file at “location” (path to a file including the file name) can be found. If not it will look in the searchPaths folders to locate the file. If it fails to it will ask the user for the new location (and will add the folder to the searchPaths variable) if the GUI is available.

If the file is found ina location different from the supplied one the variable “location” will be updated with the new file location.

If anyFile is false only existing files can be selected.

Returns true if the file exists (note that this do not mean that it can be opened) or false otherwise.

description holds a single line description of what is missing. This string will appear as the title of the file dialog used to look for the missing file.

who is the object requesting the file, used to add a link in the log.

checkObjectHash(uuid, ba)
Parameters:
Return type:

bool

Determines if the given object’s hash has changed by comparing it with the stored one. UnknownCommand uuid : ID of the obj to store the hash for UnknownCommand ba : current serialization byte array (not the hash!!!) UnknownCommand : true if current hash still matches the stored one, false otherwise (either because it has changed or because we hadn’t it stored yet)

cleanRealityBasedOnGeometryConfigurations(iScenario)
Parameters:

iScenarioGKGenericScenario

Remove the target scenario from the Geometry Configuration Connection without rebuilding the other scenarios.

cleanUp()
Return type:

bool

Returns true if the model is executing code from its destructor

clearObjectHashes()

Removes all object hashes from the model

clearRestoredTypeVersions()

Clears temporary structure after restoring ADB file.

closePlugins()

Notify the plug-ins that the model will be closed.

consolidateRevision()

Stops current model for being a revision. Most specifically, it clears the configuration name & revision flag (base network information is kept, however)

containsObjectHash(uuid)
Parameters:

uuidQUuid

Return type:

bool

Returns true if the object has a hash (if not is a new object that will be saved for the first time)

createNewCmd(type)
Parameters:

typeGKType

Return type:

GKCommand

Creates a creation cmd for a type. Note that not all the types can have an associated creation command. After creating the command it should be customized (if required) and added to the commander for execution. Upon execution the user can gets the created object using createdObject . Example:

cmd = model.createNewCmd( model.getType( "GKCentroid" ));
p = view2d->screen2World( event->pos() );
cmd->setData( GKPoint( 10, 10 ), activeCenConf );
model.getCommander().addCommand( cmd );
createRevision(configName, newInitialId)
Parameters:
  • configName – str

  • newInitialId – int

Return type:

bool

“Forks” the model as a revision. First, saves the base model. Then, it calls fork() , sets revision flag, configuration name and registers the new base ID for newly created objects. To finish, the revision file is saved.

deleteDescription(description)
Parameters:

descriptionGKTSDescription

Delete a description created using getCreateDescription() .

densityGuiToModel(den)
Parameters:

den – float

Return type:

float

From a density in veh/km or veh/mi it returns the density in veh/km

densityModelToGui(den)
Parameters:

den – float

Return type:

float

From a density in veh/km to density in veh/km or veh/mi depending of the units

densityName()
Return type:

str

Returns the density name, either veh/km or veh/mi depending of the units

destroy([task=None])
Parameters:

taskGKTask

Deletes all the info from this model. Used before the delete to cleanup memotu reporting the process in a task.

distanceGuiToModel(dist)
Parameters:

dist – float

Return type:

float

From a distance in m or feet it returns the distance in m

distanceModelToGui(distance)
Parameters:

distance – float

Return type:

float

From a distance in m to distance in m or feet depending of the units

distanceName()
Return type:

str

Returns the distance name, either m or feet depending of the units

drawInvisibleSections()
Return type:

bool

Returns true if the sections belonging to a road type that has been set to be not drawn in the draw mode attribute will be drawn and false if they will not be drawn.

existsObject(objectId, iScenario)
Parameters:
Return type:

bool

Returns true if object (by ID) exists in the scenario. An object can exists in several, all or just one scenario. * If scenario is 0 it will return always true. * Objects exists or not based on Geometry Configuration settings attached to the Scenario. * This method doesn’t take into account objects that are not part of the geometry because a required object is not. * For example a turn can return true while a required section returns false. * This is, thus, a simpler version of the query. * Use exists instead.

findDescription(uniqueName)
Parameters:

uniqueName – str

Return type:

GKTSDescription

Find a description specifying its uniqueName. Returns NULL if the model has no description with this unique name.

finishRestore(fileVersion)
Parameters:

fileVersion – int

After a GKModel::restoreData creates modes, fixes data… GKModel::restore is equivalent to GKModel::restoreData and then GKModel::finishRestore

fork()
Return type:

bool

“Forks” the model by storing current filename & UID as the base network information (unless the model is a revision, in which case the base network information is maintained), and then resets UID to a new value.

Called whenever the model is going to be saved under a different filename or when creating a revision, to preserve history.

freeze(comment)
Parameters:

comment – str

Return type:

bool

Freeze this network (saving it to the frozen folder).

getActiveCentroidConfiguration([createIt=false])
Parameters:

createIt – bool

Return type:

GKCentroidConfiguration

Returns the active centroid configuration.

getActiveExperiment()
Return type:

GKGenericExperiment

In which experiment (if any) is the user working?

getActivePedestrianCentroidConfiguration([createIt=false])
Parameters:

createIt – bool

Return type:

GKCentroidConfiguration

Returns the active pedestrian configuration.

getActiveReplication()
Return type:

GKReplication

In which replication (if any) is the user working?

getActiveScenario()
Return type:

GKGenericScenario

In which scenario (if any) is the user working?

getAuthor()
Return type:

str

Author of this network.

getBaseNetworkFileName()
Return type:

str

The base network of this derived network. Empty for a base network.

getBaseNetworkUID()
Return type:

str

The base network UID of this derived network. Empty for a base network.

getCatalog()
Return type:

GKCatalog

Returns the Catalog

getColumn(uniqueName)
Parameters:

uniqueName – str

Return type:

GKColumn

Get a column by its internal name (that is unique).

getColumn(uniqueID)
Parameters:

uniqueID – int

Return type:

GKColumn

Get a column by its id (that is unique).

getColumns()
Return type:

Dictionary with keys of type .QString and values of type GKColumn.

Returns all columns in this model.

getCommander()
Return type:

GKCommander

Returns the Commander

getConfigurationName()
Return type:

str

The configuration name. Empty for a base network.

getCreateDescription(col, uniqueName, aIncludeDeviation, aIncludeBands)
Parameters:
  • colGKColumn

  • uniqueName – str

  • aIncludeDeviation – bool

  • aIncludeBands – bool

Return type:

GKTSDescription

Find (and create a new one if none is found) a TS description by uniqueName.

getCreateDescription(cols, uniqueName, aIncludeDeviation, aIncludeBands)
Parameters:
  • cols – .list of GKColumn

  • uniqueName – str

  • aIncludeDeviation – bool

  • aIncludeBands – bool

Return type:

GKTSDescription

getCreateDescription(col, uniqueName, aFrom, aTo, anInterval, aggType, aIncludeDeviation, aIncludeBands)
Parameters:
Return type:

GKTSDescription

Find (and create a new one if none is found) a TS description by uniqueName.

getCreateDescription(cols, uniqueName, aFrom, aTo, anInterval, aggType, aIncludeDeviation, aIncludeBands)
Parameters:
Return type:

GKTSDescription

getCreateFolderForType(typeName)
Parameters:

typeName – str

Return type:

GKFolder

Returns the folder that could be used to store an object with the specified type, * creating one if needed.

getCreationTime()
Return type:

QDateTime

Creation Date.

getDataForPlugins()
Return type:

Dictionary with keys of type .QString and values of type QString.

Get all data stored for all the plug-ins.

getDocumentDB()
Return type:

GKDataBaseInfo

DB of the loaded document

getDocumentDirectory()
Return type:

QDir

Directory of the loaded document. Only usable if isStorageFileBased is true.

getDocumentFileName()
Return type:

str

Path and file name of the loaded document if isStorageFileBased . The document URL otherwise.

getFreezeComment()
Return type:

str

The user’s comment when frozen the network.

getGeoModel()
Return type:

GKGeoModel

Returns the GeoModel

getInterests(target)
Parameters:

targetGKObject

Return type:

.list of GKObject

Returns the objects that are interested in “target”.

getLastAssignedId()
Return type:

int

It returns the ID (for non temporary objects) assigned to the last object that has been created in the model.

getLastFrameDrawed()
Return type:

int

If GUI: The last frame drawn. A consecutive number to know the current frame.

getLastGeneratedId()
Return type:

int

Gets the id of the last executed simulation.

getLastModificationTime()
Return type:

QDateTime

Last Modification Date.

getLog()
Return type:

GKModelLog

Returns the system log.

getModelConnection()
Return type:

GKModelConnection

Returns the model connection for the active experiment.

getNetworkVersion()
Return type:

int

The version of the file. Goes from 0 (unsaved) and adds 1 every save.

getNewId()
Return type:

int

Returns a new (unused) id. Used by newObject to assign unique IDs

getNewTemporalId()
Return type:

int

Returns a new (unused) id for a temporary object. Used by newObject to assign unique IDs.

See also

getNewId

getObjectHash(uuid)
Parameters:

uuidQUuid

Return type:

QByteArray

Returns the object hash for the given object id, or an empty byte array if not found

getOnSimulation()
Return type:

bool

Returns true if the model is being simulated

getPluginData(pluginName)
Parameters:

pluginName – str

Return type:

str

Gets an unused plug-in data (the plug-in was not available) probably to store it.

getPreferences()
Return type:

GKPreferencesValues

Get the preferences for this model.

getProjectDatabase()
Return type:

GKDataBaseInfo

The database info (but not the database) that holds project external data (Sim Stats, external OD matrices, Real Data Sets values…).

getProjectId()
Return type:

str

Id of this project.

getRestoredGuiData()
Return type:

str

Returns the GUI data restored when reading this model. If we open the model without a GUI, we will keep it to store it back (as no GUI will be able to generate it).

getRestoredSoftwareVersion()
Return type:

int

Returns the restored version of this model. Can be used by GKPlugins to migrate data to the last version as an older version will contain less data.

getRevisionChanges(addedObjects, changedObjects, removedObjects)
Parameters:
  • addedObjects – .list of GKObject

  • changedObjects – .list of GKObject

  • removedObjects – Dictionary with keys of type .QUuid and values of type GKType.

Determines which changes have been made to the base network in this revision.

getStoredSoftwareVersion()
Return type:

int

Returns the software version of this model used to save it for the last time. It will be the restored software version after loading and the current release version after saving it for the first time.

getType(typeName)
Parameters:

typeName – str

Return type:

GKType

Get a type by name, if the type does not exist NULL is returned.

getTypeCreation(typeName)
Parameters:

typeName – str

Return type:

GKType

Get a type by name, if the type does not exist it is created.

getTypeVersionOnADBStore(typeName)
Parameters:

typeName – str

Return type:

int

During ADB restore, it returns the version (on store) for a given TypeName. If not found: -1.

getTypes()
Return type:

QList<GKType*>

Returns all types in this model.

getUID()
Return type:

str

getUnitSystem()
Return type:

UnitSystem

Returns the network units

importFile(fileName, mainLayer, p, filterArea)
Parameters:
Return type:

bool

Imports a file into the current model. It look for all the registered filters until it finds one that can load the file (GKFilterDescription::canImport).

Returns true if the file has been imported.

inSimulation()
Return type:

bool

Returns true if the model is currently being simulated and false otherwise.

inherits(typeName, superType)
Parameters:
  • typeName – str

  • superType – str

Return type:

bool

Return true if typeName inherits superType (that is: if “superType” its a super type of “typeName”). If typeName is equal to superType true is returned.

initNewModel()

Init a new created model (not from restore)

initUnitTest()

Initialize for use in unit-tests (sans python.)

initializePlugins()

Initialize the plug-ins (GKPlugin::initModel) just after creating this model (constructor) but before doing anything else. A perfect moment to declare types.

isARevision()
Return type:

bool

Returns true if this network is a revision (of another network)

isColumnUsed(col)
Parameters:

colGKColumn

Return type:

bool

Returns true if the Column col is used by any object in the model. Used only to test columns that are not AutoStore (in this case it is always used). Column usage will be tested on GKTrigger and GKViewModeStyle .

isFrozen()
Return type:

bool

Is frozen ?

isNewObjectInRevision(obj)
Parameters:

objGKObject

Return type:

bool

Returns true if obj is an object created in the revision

isOnMultipleModifications()
Return type:

bool

returns whether the model is in multiple adding mode

isOnRestore()
Return type:

bool

Returns true if we are restoring the model.

isOnStore()
Return type:

bool

Returns true if we are storing the model.

isStorageFileBased()
Return type:

bool

Returns true if the document is stored in a file, false for: DB, stream and unknown storage.

isValidBaseNetwork(url)
Parameters:

url – str

Return type:

bool

Returns true if the given network URL is valid as a base for a revision. Right now, only file-based networks (so url is a “file://…” or a simple path) are supported.

lockMutex()

*

lockMutex * access to the model exclusively

newObject(type)
Parameters:

typeGKType

Return type:

GKObject

A method equivalent to this call:

GKSystem::getSystem().newObject( type, model );
newObject(typeName)
Parameters:

typeName – str

Return type:

GKObject

A method equivalent to this call:

GKSystem::getSystem().newObject( typeName, model );
openPlugins()

Modify the plug-ins that the model has been created or restored.

preciseSpeedGuiToModel(speed)
Parameters:

speed – float

Return type:

float

From a speed in m/s or feet/s it returns the speed in m/s

preciseSpeedModelToGui(speed)
Parameters:

speed – float

Return type:

float

From a speed in m/s to speed in m/s or feet/s depending of the units

preciseSpeedName()
Return type:

str

Returns the speed name, either m/s or f/s depending of the units

prepareForRevision()
Return type:

bool

Storing a network to be use as a base for a revision

putObjectsInFolder(typeName, internalFolderName)
Parameters:
  • typeName – str

  • internalFolderName – str

A helper function. It puts all the objects with type “typeName” in the folder with “folderName” Used to recover missing information form a corrupted network. If the folder does not exist it will be created.

Public to be usable by the plug-ins in the GKPlugin::docOpened method.

rebuildRealityBasedOnGeometryConfigurations([updateGeo=true])
Parameters:

updateGeo – bool

Recreate the reallity after a Scenario or Geometry Configuration change.

rebuildRealityBasedOnGeometryConfigurations(iScenario)
Parameters:

iScenarioGKGenericScenario

Recreate the reality after a Scenario change.

registerColumn(col)
Parameters:

colGKColumn

Register a column. The pointer is adopted.

registerInterest(target, connected)
Parameters:

Registers an interest between “target” and “connected”. If “target” is removed then the system will ask to “connected” to delete any relationship with it.

registerInterestInType(target, connected)
Parameters:

Registers an interest between all the instances of “target” (or any type that inherits “target” ) and “connected”. If any instance of “target” is removed then the system will ask to “connected” to delete any relationship with these instance.

registerType(atype)
Parameters:

atypeGKType

Return type:

GKType

Register a type. The pointer is adopted.

registerType(typeName, superType)
Parameters:
  • typeName – str

  • superType – str

Return type:

GKType

Register a type creating it is needed and assigning to it a super type (that is also created if needed). The just created type is returned.

registerUsedId(aId)
Parameters:

aId – int

Updates the variable that hols the next free id to be used to discard “aId” because it is already in use. It updates both the normal and the temporary IDs.

removeAllObjects(type)
Parameters:

typeGKType

Remove all objects from a type for this model. The object will be deleted too.

Look in removeAllObjects for a method that removes objects from the geo model without removing its from the model and deleting its.

removeColumn(column, keepUsedColumns[, forceRemove=false])
Parameters:
  • columnGKColumn

  • keepUsedColumns – bool

  • forceRemove – bool

Obsolete (will be removed in Aimsun 8). Use GKModel::removeColumn( GKColumn * column, bool keepUsedColumns, GKColumn * substituteColumn ) instead. * Removes a column from the model. That means that will be removed from the type and from all the objects in the catalog that use it.

Note that only external attributes can be removed.

If first bool parameter (keepUsedColumns) is true (recommended) columns in triggers and styles will not be removed. If second bool parameter (forceRemove) is false (recommended) only external columns will be deleted. If true, all columns will be removed regardless of their storage type.

removeColumn(column, keepUsedColumns, forceRemove, substituteColumn)
Parameters:
  • columnGKColumn

  • keepUsedColumns – bool

  • forceRemove – bool

  • substituteColumnGKColumn

Removes a column from the model. That means that will be removed from the type and from all the objects in the catalog that use it.

Note that only external attributes can be removed.

If keepUsedColumns is true (recommended) columns in triggers and styles will not be removed. If false and a substituteColumn is provided, triggers and styles based on column will be changed to be based on substituteColumn. If second bool parameter (forceRemove) is false (recommended) only external columns will be deleted. If true, all columns will be removed regardless of their storage type.

removeColums(originator)
Parameters:

originatorGKObject

Removes all columns from the originator

removeInternalObsoleteColumn(column)
Parameters:

columnGKColumn

Removes a column from the model. That means that will be removed from the type and from all the objects in the catalog that use it.

Only for columns defined as eInternal

removeObjectHash(uuid)
Parameters:

uuidQUuid

Removes the object hash for the given object id

removeObsoleteColums()

Removes all the existing columns created by Aimsun types that may exist in old networks but that are not longer needed. Called automatically after restoring a model.

removeObsoletePreferences()

Removes all the existing preferences created by older release of Aimsun that may exist in old networks but that are not longer needed. Called automatically after restoring a model.

removePluginData(pluginName)
Parameters:

pluginName – str

Removes data associated with a plug-in as the data is no longer needed.

removeTemporaryColumns(columns)
Parameters:

columns – .list of GKColumn

Removes temporary columns from object of the same type in bulk. Columns will be removed even if they are used in styles (we will remove them from the style) Use this method to remove columns temporary after or before an execution

removeViewModeStyles(types)
Parameters:

types – .std.vectorGKType

Removes all ViewModeStyles with any of the selected Types.

reportError(title, message[, who=None])
Parameters:
  • title – str

  • message – str

  • whoGKObject

Report an error in an operation. This method will write the title and the message in the model log and, if there is a GUI available, it will show a QMessageBox::critical. Use this function to report critical errors.

reportWarning(title, message[, who=None])
Parameters:
  • title – str

  • message – str

  • whoGKObject

Report a warning in an operation. This method will write the title and the message in the model log and, if there is a GUI available, it will show a QMessageBox::warning. Use this function to report warnings.

resetLastAssignedId()

Resets the last assigned id. Use before a save operation if reseting ids.

resetTSObjectsByOriginator(originator)
Parameters:

originatorGKObject

restoreFromDB(dbInfo, modelId, taskId)
Parameters:
Return type:

int

Restores the model. No other task is done. Call finishRestore for some needed postprocessing.

restoreFromFile(fileName, isATemplate, taskId)
Parameters:
  • fileName – str

  • isATemplate – bool

  • taskId – str

Return type:

int

Restores the model. No other task is done. Call finishRestore for some needed postprocessing.

restoreFromFile(fileName, ba, taskId)
Parameters:
  • fileName – str

  • baQByteArray

  • taskId – str

Return type:

int

Restores the model. No other task is done. Call finishRestore for some needed postprocessing.

setActiveCentroidConfiguration(cenConf)
Parameters:

cenConfGKCentroidConfiguration

Sets the active centroid configuration.

setActiveExperiment(experiment)
Parameters:

experimentGKGenericExperiment

In which experiment (if any) is the user working?

setActivePedestrianCentroidConfiguration(cenConf)
Parameters:

cenConfGKCentroidConfiguration

Sets the active pedestrian configuration.

setActiveReplication(replication)
Parameters:

replicationGKReplication

In which replication (if any) is the user working?

setAuthor(anAuthor)
Parameters:

anAuthor – str

Author of this network.

setBaseNetworkFileName(baseNetworkFile)
Parameters:

baseNetworkFile – str

Sets base network filename

setBaseNetworkUID(baseNetworkUID)
Parameters:

baseNetworkUID – str

Sets the base network UID of this derived network. Empty for a base network.

setConfigurationName(configName)
Parameters:

configName – str

Sets the configuration name.

setCreationTime(atime)
Parameters:

atimeQDateTime

Creation Date.

setDocumentDB(dbInfo)
Parameters:

dbInfoGKDataBaseInfo

DB of the loaded document

setDocumentFileName(afileName)
Parameters:

afileName – str

Set the path of the loaded document

setDrawInvisibleSections(value)
Parameters:

value – bool

If value is true then the sections belonging to a road type that has been set to be not drawn in the draw mode attribute will be drawn and they will not be drawn if value is false.

setFreezeComment(freezeComment)
Parameters:

freezeComment – str

The user’s comment when frozen the network.

setFreezeFlag(freezeFlag)
Parameters:

freezeFlag – bool

Set has frozen (or not)

setInSimulation(value)
Parameters:

value – bool

Sets the model as being in a current simulation if value is true and not being in any simulation otherwise.

See also

inSimulation()

setLastFrameDrawed(value)
Parameters:

value – int

If GUI: The last frame drawn. A consecutive number to know the current frame.

setLastGeneratedId(id)
Parameters:

id – int

Sets the id of the last executed simulation.

setLastModificationTime(atime)
Parameters:

atimeQDateTime

Last Modification Date.

setModelAsRevision(configName, newInitialId)
Parameters:
  • configName – str

  • newInitialId – int

Return type:

bool

Creates a new revision of the model. It calls first fork() , then sets revision flag, configuration name and registers the new base ID for newly created objects. It sets the revision attributes but it doesn’t do the need save before with prepareRevision flag and the save of the revision created.

setNetworkVersion(networkVersion)
Parameters:

networkVersion – int

The version of the file. Goes from 0 (unsaved) and adds 1 every save.

setNextStoreIsViewer(isViewer)
Parameters:

isViewer – bool

Sets if the next store will generate a viewer file

setObjectHash(uuid, ba)
Parameters:

Calculates and stores internally the object hash for a given object. This hash is later used to determine if the object has changed when storing a revision, a DB model, etc… UnknownCommand uuid : UID of the obj to store the hash for UnknownCommand ba : serialization byte array (not the hash!!!)

setOnMultipleModifications(value)
Parameters:

value – bool

Set the model in multiple modification mode, which if true it avoids to update the project view each time a single object is added/modified/removed

setOnRestore(value)
Parameters:

value – bool

Set the model in restore mode

See also

isOnRestore()

setOnSimulation(value)
Parameters:

value – bool

Sets the model on simulation or not simulation mode. If true, the signal router won’t emit any acknowledgement.

setOnStore(value)
Parameters:

value – bool

Set the model in store mode

See also

isOnStore()

setPluginData(pluginName, pluginData)
Parameters:
  • pluginName – str

  • pluginData – str

Stores an unused plug-in data (the plug-in was not available) for later store.

setPreferences()
Return type:

GKPreferencesValues

Get the preferences for this model for modification.

setPrepareForRevision(value)
Parameters:

value – bool

Storing a network to be use as a base for a revision

setProjectDatabase(adatabase)
Parameters:

adatabaseGKDataBaseInfo

The database info (but not the database) that holds project external data (Sim Stats, external OD matrices, Real Data Sets values…).

setProjectId(id)
Parameters:

id – str

Id of this project.

setRestoredGuiData(restoredGuiData)
Parameters:

restoredGuiData – str

Sets the GUI data restored when reading this model. If we open the model without a GUI, we will keep it to store it back (as no GUI will be able to generate it).

setRestoredSoftwareVersion(value)
Parameters:

value – int

The restored version of this model as set from an external restorer.

setRestoredTypeVersions(typeVersions)
Parameters:

typeVersions – Dictionary with keys of type .QString and values of type int.

Sets, for each stored Type, which version was it stored on. Temporary for network restore (ADB).

setRevisionFlag([set=true])
Parameters:

set – bool

Sets revision flag to the given state

setSimulatorInObjects(value)
Parameters:

value – bool

Will set the geometrical catalog objects as being currently simulated or not depending on value.

setStatus(astatus)
Parameters:

astatusGKObjectStatus

Changes the status of the model and emits the signal modelStatusChanged (through GKSignalRouter)

setStoredSoftwareVersion(value)
Parameters:

value – int

The current stored version of this model as set when storing this model in a file.

setUnitSystem(units)
Parameters:

unitsUnitSystem

Sets the unit system that will be used to present information to the user. Note that unit system used internally in this application is the Metric system.

setUserName()

Assign the current user name and data to the model properties. Done when creating a new network from a template.

speedGuiToModel(speed)
Parameters:

speed – float

Return type:

float

From a speed in km/h or m/h it returns the speed in km/h

speedModelToGui(speed)
Parameters:

speed – float

Return type:

float

From a speed in km/h to speed in km/h or mi/h depending of the units

speedName()
Return type:

str

Returns the speed name, either km/h or M/h depending of the units

structuredFolders()
Return type:

bool

Returns true if the model uses a fixed folder structure for projects

temperatureGuiToModel(temperature)
Parameters:

temperature – float

Return type:

float

From a temperature in Celsius or Fahrenheit, transform it into Celsius

temperatureModelToGui(temperature)
Parameters:

temperature – float

Return type:

float

From a temperature in Celsius, transform it into Celsius or Fahrenheit, depending on the units

topProjectFolder()
Return type:

str

For structured projects, the top folder of the project (the one that includes the ReadMe.md file)

unlockMutex()

*

unlockMutex * access to the model exclusively

unpreciseDistanceGuiToModel(dist)
Parameters:

dist – float

Return type:

float

From a distance in km or miles it returns the distance in km

unpreciseDistanceModelToGui(distance)
Parameters:

distance – float

Return type:

float

From a distance in Km to distance in Km or miles depending of the units

unpreciseDistanceName()
Return type:

str

Returns the distance name, either Km or miles depending of the units

unregisterColumn(col)
Parameters:

colGKColumn

Unregister a columns (that will be remove). The pointer is not deleted. This is a responsibility of the caller. See removeColumn .

Note that only external attributes can be removed.

unregisterInterest(target, connected)
Parameters:

Unregisters an interest between “target” and “connected”.

unregisterInterestInType(target, connected)
Parameters:

Unregisters an interest between any instance of “target” (or any type that inherits “target” ) and “connected”.

unregisterInterests(target, type)
Parameters:

Unregisters an interest between “target” and any object of type “type” (or any type that inherits “type” ).

unregisterType(atype)
Parameters:

atypeGKType

Return type:

bool

Unregisters a type

weightFrontAreaGuiToModel(temperature)
Parameters:

temperature – float

Return type:

float

From a weight/frontal area in kg/m2 or lbs/sq.ft depending of the units to kg/m2

weightFrontAreaModelToGui(temperature)
Parameters:

temperature – float

Return type:

float

From a weight/frontal area in kg/m2 to kg/m2 or lbs/sq.ft depending of the units

weightFrontAreaName()
Return type:

str

Returns the weight / front area name, either Kg/m^2 or lb/ft^2 depending of the units

weightGuiToModel(temperature)
Parameters:

temperature – float

Return type:

float

From a weight in kg or lbs depending of the units to kg

weightHorsePowerGuiToModel(temperature)
Parameters:

temperature – float

Return type:

float

From a weight/horse power in kg/hp or lbs/hp depending of the units to kg/hp

weightHorsePowerModelToGui(temperature)
Parameters:

temperature – float

Return type:

float

From a weight/horse power in kg/hp to kg/hp or lbs/hp depending of the units

weightHorsePowerName()
Return type:

str

Returns the weight / horse power name, either Kg/hp or lb/hp depending of the units

weightModelToGui(temperature)
Parameters:

temperature – float

Return type:

float

From a weight in kg to kg or lbs depending of the units

weightName()
Return type:

str

Returns the weight name, either Kg or lb depending of the units