UNPKG

@sports-alliance/sports-lib

Version:

A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc

87 lines (86 loc) 4.44 kB
import { ActivityInterface } from './activity.interface'; import { LapInterface } from '../laps/lap.interface'; import { IntensityZonesInterface } from '../intensity-zones/intensity-zones.interface'; import { Creator } from '../creators/creator'; import { ActivityTypes } from './activity.types'; import { DurationClassAbstract } from '../duration/duration.class.abstract'; import { CreatorInterface } from '../creators/creator.interface'; import { StreamDataItem, StreamInterface } from '../streams/stream.interface'; import { ActivityJSONInterface } from './activity.json.interface'; import { DataPositionInterface } from '../data/data.position.interface'; import { DataPowerCurve } from '../data/data.power-curve'; import { DataEvent } from '../data/data.event'; import { DataStartEvent } from '../data/data.start-event'; import { DataStopEvent } from '../data/data.stop-event'; import { DataRiderPositionChangeEvent } from '../data/data.rider-position-change-event'; import { ActivityParsingOptions } from './activity-parsing-options'; import { SwimLengthInterface } from '../swim-lengths/swim-length.interface'; export declare class Activity extends DurationClassAbstract implements ActivityInterface { private static readonly TRAINER_TYPES; name: string; type: ActivityTypes; creator: CreatorInterface; parseOptions: ActivityParsingOptions; intensityZones: IntensityZonesInterface[]; powerCurve?: DataPowerCurve; private laps; private swimLengths; private streams; private events; constructor(startDate: Date, endDate: Date, type: ActivityTypes, creator: Creator, options?: ActivityParsingOptions, name?: string); createStream(type: string): StreamInterface; addDataToStream(type: string, date: Date, value: number): this; addStream(stream: StreamInterface): this; clearStreams(): this; removeStream(streamType: string | StreamInterface): this; replaceStreamData(streamType: string, data: (number | null)[]): this; addStreams(streams: StreamInterface[]): this; getAllStreams(): StreamInterface[]; getAllExportableStreams(): StreamInterface[]; hasStreamData(streamType: string | StreamInterface, startDate?: Date, endDate?: Date): boolean; hasPositionData(startDate?: Date, endDate?: Date): boolean; isTrainer(): boolean; hasPowerMeter(): boolean; getStream(streamType: string): StreamInterface; getStreamData(streamType: string | StreamInterface, startDate?: Date, endDate?: Date): (number | null)[]; /** * Gets the data array of an activity stream excluding the non numeric ones * @todo include strings and all data abstract types * @param streamType * @param startDate * @param endDate */ getSquashedStreamData(streamType: string, startDate?: Date, endDate?: Date): number[]; getPositionData(startDate?: Date, endDate?: Date): (DataPositionInterface | null)[]; getSquashedPositionData(startDate?: Date, endDate?: Date): DataPositionInterface[]; getStreamDataTypesBasedOnDataType(streamTypeToBaseOn: string, streamTypes: string[]): { [type: string]: number | null; }[]; getStreamDataTypesBasedOnTime(streamTypes?: string[]): { [type: number]: { [type: string]: number | null; }; }; getStreamDataByTime(streamType: string, filterNull?: boolean, filterInfinity?: boolean): StreamDataItem[]; getStreamDataByDuration(streamType: string, filterNull?: boolean, filterInfinity?: boolean): StreamDataItem[]; addLap(lap: LapInterface): this; getLaps(_activity?: ActivityInterface): LapInterface[]; hasLaps(): boolean; getSwimLengths(): SwimLengthInterface[]; addSwimLength(swimLength: SwimLengthInterface): this; setSwimLengths(swimLengths: SwimLengthInterface[]): this; hasSwimLengths(): boolean; getAllEvents(): DataEvent[]; getStartEvents(): DataStartEvent[]; getStopEvents(): DataStopEvent[]; getStopAllEvents(): DataStopEvent[]; getAllRiderPositionChangeEvents(): DataRiderPositionChangeEvent[]; addEvent(event: DataEvent): this; setAllEvents(events: DataEvent[]): this; generateTimeStream(streamTypes?: string[]): StreamInterface; generateDurationStream(streamTypes?: string[]): StreamInterface; getDateIndex(date: Date): number; private static projectMillisecondsToSecondGrid; private getTimeGridLength; toJSON(): ActivityJSONInterface; }