import GmfTimeInput from 'gmf/time-input/time-input'; import { CSSResult, TemplateResult } from 'lit'; /** * Gives you a timeslider (simple or range) based on OGC time. * Based on GmfTimeInput. * Example: * */ export default class GmfTimeslider extends GmfTimeInput { protected sliderStart?: number; protected sliderEnd?: number; private isInitialRendering; private datesSteps; private readonly onSliderRelease; static readonly styles: CSSResult[]; /** * Lit rendering. * @returns the html template for timeslider(s). */ render(): TemplateResult; /** * Set up the start date and the end date based on the time attribute. * Set up also the slider min and max and possible matching dates. * @protected * @override */ protected setupMinMaxDefaultValues(): void; /** * In an array of number, find the nearest matching value. * The values must be sorted (smallest first). * @param value the base value to find the nearest value. * @param values the sorted possible values. * @returns The nearest value in the values array. * @private */ private findNearestValue; /** * Update start time on input change. * @param event input event. * @protected * @override */ protected onDateStartSelected(event: InputEvent): void; /** * Update end time on input change. * @param event input event. * @protected * @override */ protected onDateEndSelected(event: InputEvent): void; /** * Update the slider representation on slider move. * @param event input event. * @private */ private onDateStartMoved; /** * Update the slider representation on slider move. * @param event input event. * @private */ private onDateEndMoved; /** * Get the right date representation based on the resolution. * @param date The date (timestamp) to format. * @returns the date in a local format. * @private */ private getLocalDate; /** * @returns all possible date in an array, based on the wanted values OR * on the wanted interval and the min/max dates. Max values: 10000. * @private */ private computeDatesSteps; /** * @param length the length of wanted array. * @returns An array with repeated null values, the times of the provided * length (limited to 10000). * @private */ private getLimitedArray; /** * @returns the timestamp of the time.values. * @private */ private computeDatesStepsFromValues; /** * @param dateMin The minimal date. * @param dateMax The maximal date * @param interval the wanted interval * @returns All the seconds timestamps between the provided dates and regarding the wanted interval. * @private */ private computeDatesStepsForSeconds; /** * @param dateMin The minimal date. * @param dateMax The maximal date * @param interval the wanted interval * @returns All the days timestamps between the provided dates and regarding the wanted interval. * @private */ private computeDatesStepsForDays; /** * @param dateMin The minimal date. * @param dateMax The maximal date * @param interval the wanted interval * @returns All the month timestamp between the provided dates and regarding the wanted interval. * @private */ private computeDatesStepsForMonth; /** * @param dateMin The minimal date. * @param dateMax The maximal date * @param interval the wanted interval * @returns All the years timestamp between the provided dates and regarding the wanted interval. * @private */ private computeDatesStepsForYear; /** * @returns The amount of months between two dates. * @param date1 min date. * @param date2 max date. * @private */ private getMonthDiff; /** * @returns The amount of years between two dates. * @param date1 min date. * @param date2 max date. * @private */ private getYearDiff; /** * Updates the input values and representation. * Manage the sliders to not let one goes beyond the other. * @param isStart is the start/first slider * @param event the original input event. * @private */ private onDateMoved; /** * Update the slider colors based on both sliders positions. * @private */ private fillColor; }