Sports Lib API - v21.3.0
    Preparing search index...

    Class EventUtilities

    Event aggregation and regeneration. Generated homogeneous Diving-group event summaries omit terrain ascent/descent, altitude min/max/avg, and grade min/max/avg; mixed event summaries aggregate those metrics only from their non-diving activities.

    Index

    Constructors

    Methods

    • Regenerates event-level stats from the current in-memory event state.

      Important behavior:

      • Clears ONLY event stats (event.clearStats()).
      • Does NOT clear activity stats.
      • Does NOT read the original imported file (FIT/TCX/GPX/etc.); raw source payload is not retained.

      Regeneration model:

      • Single-activity event: copies current summary-eligible activity stats into the event.
      • Multi-activity event: recomputes event summary stats from activity stats, copies a positive recovery estimate from the chronologically final activity, and aggregates power curves.
      • The resulting event summary is canonicalized for its contributing activity types. In particular, an all-Diving-group event omits terrain ascent/descent, altitude, and grade summaries; mixed events aggregate those summaries only from their non-diving activities.

      Interaction with generateStatsForAll(event):

      • generateStatsForAll calls activity generation first (generateMissingStreamsAndStatsForActivity), then calls this method.
      • Activity generation is "fill missing", not "replace existing": applicable activity stats are preserved.
      • If activity stats were cleared or removed by caller code before regeneration, missing stats are recomputed from streams (for example, Average Speed from speed stream mean, Ascent from altitude gain).

      Distance behavior:

      • Event distance is rebuilt from activities during event summarization.
      • Activity distance is recomputed only when missing or equal to zero (in activity generation path).

      Parameters

      Returns void