import { DatePipe } from '@angular/common'; import { BehaviorSubject } from 'rxjs'; import { Building } from './data/building'; import { YearWeek } from './data/year-week'; import { Variation } from './variation'; import './date.extension'; /** * The SkylineService is in charge of the animation of the skyline rising. */ export declare class RisingSkylineService { private datePipe; constructor(datePipe: DatePipe); /** * Default speed of the animation. */ private static DEFAULT_SPEED; /** * Activate or Inactivate the **Debug** mode in this service. */ private DEBUG; /** * Activate or Inactivate the **Verbose** mode in this service. */ private VERBOSE; /** * Date when the first episode of the skyline rising _(the first building has been created)_. */ firstDate: Date; /** * Date when the last episode of the skyline rising _(the last building has been ended)_. */ lastDate: Date; /** * **BehaviorSubject** emitting the partial or complete history of the skyline rising. */ history$: BehaviorSubject; /** * **BehaviorSubject** emitting an episode of the rising skyline to be drawn */ episode$: BehaviorSubject; /** * The active episode of the rising skyline for the current year/week. */ episode: Building[]; /** * For performance purpose : * * This array contains an ordered list of YearWeek object. * Its prime goal is to synchronize the slider position and the corresponding YearWeek location */ yearWeeks: YearWeek[]; /** * The complete history of the skyline : all floors by year/week are stored in this array. */ history: Building[]; /** * Identifier for the rising loop interval. */ private timeout; /** * the Level of zoom. */ private levelOfZoom; /** * Current speed of the animation. */ private speed; /** * Variation of speed. * * This variation number increase, or decrease, the speed of the animation. */ variation: Variation; /** * Number of episodes _(floors)_ currently present in the history. */ countEpisodes: number; /** * Curent floor index currently handled in **riseSkyline**. */ currentEpisode: number; /** * Curent year processed in **riseSkyline**. */ currentYear: number; /** * Curent week processed in **riseSkyline**. */ currentWeek: number; /** * This boolean is set to true when the animation is paused. */ pause: boolean; /** * Inject the speed of the animation, received by the component. * @param speed the speed of the animation */ injectSpeed(speed: number): void; /** * Start the rising animation from the first day in history. */ startSkylineRising(): void; /** * Produce the stupendous rising of skyline. */ riseSkyline(): void; /** * Draw the given episode. * @param episode the given epise */ drawEpisode(episode: Building[]): void; /** * Extract and return an episode of the skyline for a given week * @param year the year of the week * @param week the week */ extractSkylineEpisode(year: number, week: number): Building[]; /** * Number of floors present in the history. */ numberOfFloors(): number; /** * Initiliaze the content of an array of __Year/Weeks__ * * This array is synchronized with the position of the coin moving on the slider. */ initArrayYearWeeks(): void; /** * Complete the skyline perspective by filling the holes. */ fillTheHoles(): void; /** * Return the order history of skylines by id, year & week * Sort in ascending order the history of skylines by id, year & week */ sortedHistory(): Building[]; /** * Zoom IN or OUT the skyline * @param episode the skyline rising episode */ zoom(episode: Building[]): void; /** * Zoom-in the chart. */ zoomIn(): void; /** * Zoom-out the chart. */ zoomOut(): void; /** * Force the redraw of the episode if it's necessary. */ forceRedrawAfterZoomIfNecessary(): void; /** * Take in account the full history of the skyline. * @param history the history received by the component. */ takeInAccount(history: Building[]): void; /** * Return the date of the first week day : a **MONDAY** in this implementation. * * **Should you use later :** const todayFormated = this.datepipe.transform(today, 'w');. * * @param year the year of the date * @param week the week the week of the date */ getDateOfWeek(year: number, week: number): Date; /** * Return the couple year/week corresponding to the given date. * @param date the given date */ toYearWeek(date: Date): YearWeek; /** * Pause the skyline rising */ pauseRising(): void; /** * Re-play the skyline rising from when it has been paused. */ playRising(): void; /** * Rotate the variation of the animation speed. * * There are 5 levels : __1/4__, __1/2__, __1__, __2__, __4__. */ rotateVariation(): void; /** * Return the actual speed of the animation. */ getSpeed(): number; }