DK for ActiveX | TatukGIS_XDK11.ITGIS_BusyEventManager | Interfaces | Methods | Properties
Class useful for progress implementation in single or multistage algorithms.
// C# public interface ITGIS_BusyEventManager: ITBaseObject { }
' VisualBasic Public Interface ITGIS_BusyEventManager Implements ITBaseObject End Class
// Oxygene type ITGIS_BusyEventManager = public interface( ITBaseObject ) end;
Name | Visibility | Description | |
---|---|---|---|
AttachDelphiObj | public | Only for internal use of TatukGIS. (Inherited from ITBaseObject) |
|
Create_ | public | Creates an instance. | |
DelphiObj | public | Only for internal use of TatukGIS. (Inherited from ITBaseObject) |
|
EndEvent | public | Ends the currently executed stage. | |
PushEvent | public | Increments process position for current stage and raises busy event smartly. | |
PushEvent_2 | public | Increments process position for current stage, updates name, and raises busy event smartly. | |
StartEvent | public | Creates a new event stage and sets the maximum position for it. | |
Name | Visibility | Description | |
---|---|---|---|
Aborted | public | Indicates whether an abort was requested. | |
Count | public | Returns the number of stages. | |
EndValue | public | The real upper limit of the process position at specified stage. | |
EstimatedTimeLeft | public | Estimated remaining time of the process at specified stage. | |
Max | public | The normalized upper limit of the process position at the specified stage. | |
Name | public | Name of the process at the specified stage. | |
Position | public | Current position of the process at the specified stage. | |
Sender | public | The reference to the parent object. | |
UseProgressThreshold | public | If True, busy events are raised according to a time trigger (default). | |
Below you can find the Python example.
from time import sleep import tatukgis_pdk as pdk from typing import Any def do_busy_event(sender: Any, position: int, end_value: int, abort: bool): busy_manager: pdk.TGIS_BusyEventManager = sender if position == -1: return # show first stage process details print(f"Global position: {position} / {end_value}") print(f"Estimated time left: {busy_manager.EstimatedTimeLeft(0)/1000} s.") print(f"\t{busy_manager.Name(0)}") print(f"\tLocal position: {busy_manager.Position(0)} / {busy_manager.EndValue(0)}") # show second stage process details if busy_manager.Count == 2: print(f"\t\t{busy_manager.Name(1)}") print(f"\t\tLocal position: {busy_manager.Position(1)} / {busy_manager.EndValue(1)}") # 'abort' can be used to abort the current process abort = False event_manager = pdk.TGIS_BusyEventManager(None) # a busy event will be triggered every time the PushEvent() method is called event_manager.UseProgressThreshold = False # assign a callback function to track the progress event_manager.BusyEvent = do_busy_event # start a first stage of the progress event_manager.StartEvent("LEVEL 1", 100, event_manager) try: for i in range(99): sleep(0.2) event_manager.PushEvent() # start a second stage at the last iteration of the first stage event_manager.StartEvent("LEVEL 2", 10, event_manager) try: for j in range (10): # PushEvent method can change the current stage name event_manager.PushEvent(f"LEVEL 2 - stage: {j}") finally: # end stage 2 event_manager.EndEvent() finally: # end stage 1 event_manager.EndEvent()