Aimsun Next Scripting
22
|
Public Member Functions | |
if (base) | |
Py_END_ALLOW_THREADS End | GKCommand () |
void | setName (const QString &) |
const QString & | getName () const |
void | setModel (GKModel *) |
GKModel * | getModel () const |
virtual GKCommandReport * | init (GKModel *) |
virtual bool | isEqual (GKCommand *) const |
virtual void | merge (GKCommand *) |
virtual void | doit ()=0 |
virtual void | undoit ()=0 |
void | setUndoable (bool) |
bool | isUndoable () const |
bool | isDone () const |
virtual void | setDone (bool) |
virtual void | commandToBeDone () |
virtual void | commandDone () |
virtual void | commandToBeUndone () |
virtual void | commandUndone () |
virtual GKObject * | createdObject () const |
virtual bool | createdObjectRequiresEdition () const |
virtual QVector< int > | getTargets () const |
Public Attributes | |
ConvertToSubClassCode Py_BEGIN_ALLOW_THREADS GKCommand * | base = (GKCommand*)sipCpp |
sipType = 0 | |
A command is an operation that the user can undo (and then redo). Any change in any object in Aimsun due to user manipulation must be done in a command (with the exception of edition done in the editors. See GEditor for more information on this topic).
The developer, when writes a command, will:
The developer can also implement the GKCommand::init method to verify if the operation can be executed or not.
Optionally the developer can implement also the GKCommand::isEqual and GKCommand::merge methods. See GKCommander for more information.
In Aimsun there are three types of commands:
Delete commands are handle by a specialized class, not derived from GKCommand but from GKObjectDelCmd.
When an object is created using a command it has to be deleted (using the delete operator) if the command is deleted and the command was undone. The commander deletes a command either when no longer the undo operation is possible or when the model is closed.
An example follows:
Py_END_ALLOW_THREADS End GKCommand::GKCommand | ( | ) |
|
virtual |
Called after do command.
|
virtual |
Called before do command.
|
virtual |
Called before undo command.
|
virtual |
Called after undo command.
|
virtual |
Created object for New Commands (once the command has been added to the GKCommander via the addCommand function).
Reimplemented in GKDetectionPatternNewCmd, DistributionExperimentNewCmd, DistributionScenarioNewCmd, FourStepsExperimentNewCmd, FourStepsScenarioNewCmd, GKPedestrianAreaNewCmd, GKPedestrianCentroidConfigurationNewCmd, GKPedestrianDecisionNodeNewCmd, GKPedestrianEntranceCentroidNewCmd, GKPedestrianExitCentroidNewCmd, GKPedestrianLevelChangeObjectNewCmd, GKPedestrianODMatrixNewCmd, GKPedestrianODRouteNewCmd, GKPedestrianServicePointNewCmd, GKPedestrianTypeNewCmd, GKDynamicAdjustmentExperimentNewCmd, GKDynamicAdjustmentExperimentResultNewCmd, GKDynamicAdjustmentReplicationNewCmd, GKDistributionCentroidTypeNewCmd, GKDistributionDataSetNewCmd, GKGenerationAttractionCentroidTypeNewCmd, GKGenerationAttractionDataSetAttributeNewCmd, GKGenerationAttractionDataSetNewCmd, GKGenerationAttractionExperimentNewCmd, GKGenerationAttractionScenarioNewCmd, GKGenerationAttractionVectorNewCmd, GKParkingCentroidTypeNewCmd, GKTimePeriodNewCmd, MacroAdjustmentExperimentNewCmd, MacroAdjustmentScenarioNewCmd, MacroDepartureAdjustmentExperimentNewCmd, MacroDepartureAdjustmentScenarioNewCmd, MacroExperimentNewCmd, MacroScenarioNewCmd, MacroPTExperimentNewCmd, MacroPTScenarioNewCmd, MacroPTZoneNewCmd, MacroPTZonePlanNewCmd, DetectorLocationNewCmd, ModalSplitExperimentNewCmd, ModalSplitScenarioNewCmd, GKPrintLayoutNewCmd, MacroPTAdjustmentExperimentNewCmd, MacroPTAdjustmentScenarioNewCmd, and GKTrafficProfileNewCmd.
|
virtual |
A object created by a new command requires edition to be customized? True only for objects that cannot be created in a valid state.
|
pure virtual |
Do not use this function. Available just for compatibility issues.
Implemented in GRotationCmd, GTranslationCmd, GKDetectionPatternNewCmd, GKDetectionPatternTemplateNewCmd, OCITDetectionPatternNewCmd, OCITDetectionPatternTemplateNewCmd, DistributionExperimentNewCmd, DistributionScenarioNewCmd, FourStepsExperimentNewCmd, FourStepsScenarioNewCmd, GKPedestrianAreaNewCmd, GKPedestrianCentroidConfigurationNewCmd, GKPedestrianDecisionNodeNewCmd, GKPedestrianEntranceCentroidNewCmd, GKPedestrianExitCentroidNewCmd, GKPedestrianLevelChangeObjectNewCmd, GKPedestrianObstacleNewCmd, GKPedestrianODMatrixNewCmd, GKPedestrianODRouteNewCmd, GKPedestrianPolygonObstacleNewCmd, GKPedestrianServicePointNewCmd, GKPedestrianTypeNewCmd, GKDynamicAdjustmentExperimentNewCmd, GKDistributionCentroidTypeNewCmd, GKDistributionDataSetNewCmd, GKGenerationAttractionCentroidTypeNewCmd, GKGenerationAttractionDataSetAttributeNewCmd, GKGenerationAttractionDataSetNewCmd, GKGenerationAttractionExperimentNewCmd, GKGenerationAttractionScenarioNewCmd, GKGenerationAttractionVectorNewCmd, GKParkingCentroidTypeNewCmd, GKTimePeriodNewCmd, MacroAdjustmentExperimentNewCmd, MacroAdjustmentScenarioNewCmd, MacroDepartureAdjustmentExperimentNewCmd, MacroDepartureAdjustmentScenarioNewCmd, MacroExperimentNewCmd, MacroScenarioNewCmd, MacroPTExperimentNewCmd, MacroPTScenarioNewCmd, MacroPTZoneNewCmd, MacroPTZonePlanNewCmd, DetectorLocationNewCmd, ModalSplitExperimentNewCmd, ModalSplitScenarioNewCmd, GKPrintLayoutNewCmd, MacroPTAdjustmentExperimentNewCmd, MacroPTAdjustmentScenarioNewCmd, and GKTrafficProfileNewCmd.
GKModel * GKCommand::getModel | ( | ) | const |
Returns the model.
const QString & GKCommand::getName | ( | ) | const |
Returns the command name.
|
virtual |
Returns a list of objects modified by this command. Optional for now.
This implementation returns the id of the created object (if any)
|
inline |
References base, GKSystem::getSystem(), and sipType.
|
virtual |
Initializes the command and returns NULL if the command can be executed, othewise it returns information about why the command cannot be executed. This method is called by GKCommander when the command is added to it (GKCommander::add) and before it is executed.
Reimplemented in GKPedestrianCentroidConfigurationNewCmd, GKPedestrianAreaNewCmd, GKPedestrianDecisionNodeNewCmd, GKPedestrianLevelChangeObjectNewCmd, GKPedestrianObstacleNewCmd, GKPedestrianPolygonObstacleNewCmd, GKPedestrianServicePointNewCmd, GKPedestrianEntranceCentroidNewCmd, and GKPedestrianExitCentroidNewCmd.
bool GKCommand::isDone | ( | ) | const |
Return true is the command has been done (the commander has executed the GKCommand::doit method) and false if the command has been undone (the commander has executed the GKCommand::undoit method).
|
virtual |
Returns true is this command is equal to the command "other". Equal means, in this context, that both commands apply the same operation to the same object (or objects). If you implement this operation then GKCommand::merge operation must be implemented too.
Never return true on creation commands. This type of command cannot be merged.
bool GKCommand::isUndoable | ( | ) | const |
Returns true if the command can be undone and false otherwise.
|
virtual |
If two command are equal the commander will join both in one. This method will merge the command "other" with the command "this". The command "other" will be discarded.
|
virtual |
Set the done attribute. Called by the commander (GKCommander) when needed.
void GKCommand::setModel | ( | GKModel * | ) |
Set the model, done by the GKCommander when the command is add to it.
void GKCommand::setName | ( | const QString & | ) |
Set the command name, usually done in the command constructor.
void GKCommand::setUndoable | ( | bool | ) |
If "value" is true this command can be undone and false otherwise .
|
pure virtual |
Do not use this function. Available just for compatibility issues.
Implemented in GRotationCmd, GTranslationCmd, GKDetectionPatternNewCmd, GKDetectionPatternTemplateNewCmd, OCITDetectionPatternNewCmd, OCITDetectionPatternTemplateNewCmd, DistributionExperimentNewCmd, DistributionScenarioNewCmd, FourStepsExperimentNewCmd, FourStepsScenarioNewCmd, GKPedestrianAreaNewCmd, GKPedestrianCentroidConfigurationNewCmd, GKPedestrianDecisionNodeNewCmd, GKPedestrianEntranceCentroidNewCmd, GKPedestrianExitCentroidNewCmd, GKPedestrianLevelChangeObjectNewCmd, GKPedestrianObstacleNewCmd, GKPedestrianODMatrixNewCmd, GKPedestrianODRouteNewCmd, GKPedestrianPolygonObstacleNewCmd, GKPedestrianServicePointNewCmd, GKPedestrianTypeNewCmd, GKDynamicAdjustmentExperimentNewCmd, GKDistributionCentroidTypeNewCmd, GKDistributionDataSetNewCmd, GKGenerationAttractionCentroidTypeNewCmd, GKGenerationAttractionDataSetAttributeNewCmd, GKGenerationAttractionDataSetNewCmd, GKGenerationAttractionExperimentNewCmd, GKGenerationAttractionScenarioNewCmd, GKGenerationAttractionVectorNewCmd, GKParkingCentroidTypeNewCmd, GKTimePeriodNewCmd, MacroAdjustmentExperimentNewCmd, MacroAdjustmentScenarioNewCmd, MacroDepartureAdjustmentExperimentNewCmd, MacroDepartureAdjustmentScenarioNewCmd, MacroExperimentNewCmd, MacroScenarioNewCmd, MacroPTExperimentNewCmd, MacroPTScenarioNewCmd, MacroPTZoneNewCmd, MacroPTZonePlanNewCmd, DetectorLocationNewCmd, ModalSplitExperimentNewCmd, ModalSplitScenarioNewCmd, GKPrintLayoutNewCmd, MacroPTAdjustmentExperimentNewCmd, MacroPTAdjustmentScenarioNewCmd, and GKTrafficProfileNewCmd.
Referenced by if().
GKCommand::sipType = 0 |
Referenced by if().