Export Service
app.application.services.tracking.export_serviceTracking layer export service — serialises layers C or D to JSON / CSV.
See Also
IDataExporter— defines the export contractserialize_layer_to_json— serializes layer records
Layer: Application. Context: Coordinates domain state and infrastructure to complete application use cases.
TrackingExportService
Bases: QObject
Serialises tracking layer data (C or D) to a file on disk.
Responsibilities
- Retrieve all bounding boxes from the requested tracking layer.
- Write them as JSON or CSV (determined by
file_pathextension). - Return the number of boxes exported for status reporting.
Note
This service satisfies the IDataExporter interface
Protocol via structural subtyping.
The output is produced using the same shared wire format as
DetectionExportService, so files can be cross-imported between
detection and tracking layers when the user explicitly chooses to do so
via the dialog.
Consider future improvement: add a has_data(s_id, layer) -> bool
helper that the handler can call before opening the save-file dialog,
surfacing a friendly warning when the user tries to export an empty layer.
| PARAMETER | DESCRIPTION |
|---|---|
app
|
Application used to resolve sessions and read tracking-layer boxes for export.
TYPE:
|
__init__(app: Application) -> None
export_layer(s_id: SessionId, layer: VideoDataLayer | str, file_path: str) -> int
Export all boxes in tracking layer for s_id to file_path.
| PARAMETER | DESCRIPTION |
|---|---|
s_id
|
Source session.
TYPE:
|
layer
|
Source layer — should be
TYPE:
|
file_path
|
Absolute destination path with
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Number of boxes written.
TYPE:
|
Note
Accepts both VideoDataLayer enums and string layer names to handle
Qt signal/slot type coercion.