@osrd-project/ui-charts 0.0.83 → 0.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -6
- package/dist/chronogram/components/Chronogram.d.ts +0 -3
- package/dist/chronogram/components/ChronogramCanvas.d.ts +0 -3
- package/dist/chronogram/components/ChronogramManchette.d.ts +0 -9
- package/dist/chronogram/components/OccupancyBlocksLayer.d.ts +0 -1
- package/dist/chronogram/hooks/useChronogram.d.ts +0 -35
- package/dist/chronogram/index.d.ts +0 -9
- package/dist/chronogram/lib/const.d.ts +0 -5
- package/dist/chronogram/lib/context.d.ts +0 -6
- package/dist/chronogram/lib/types.d.ts +0 -30
- package/dist/chronogram/utils/format.d.ts +0 -1
- package/dist/common/consts.d.ts +0 -5
- package/dist/common/context.d.ts +0 -2
- package/dist/common/helpers/colors.d.ts +0 -21
- package/dist/common/helpers/png.d.ts +0 -5
- package/dist/common/helpers/time.d.ts +0 -31
- package/dist/common/helpers/utils.d.ts +0 -8
- package/dist/common/hooks/useCanvas.d.ts +0 -16
- package/dist/common/hooks/useDevicePixelRatio.d.ts +0 -1
- package/dist/common/hooks/useMouseInteractions.d.ts +0 -41
- package/dist/common/hooks/useMouseTracking.d.ts +0 -6
- package/dist/common/hooks/useSize.d.ts +0 -7
- package/dist/common/index.d.ts +0 -5
- package/dist/common/layers/TimeCaptions.d.ts +0 -1
- package/dist/common/layers/TimeGraduations.d.ts +0 -2
- package/dist/common/types.d.ts +0 -104
- package/dist/index.d.ts +0 -7
- package/dist/index.esm.js +0 -6391
- package/dist/index.esm.js.map +0 -1
- package/dist/manchette/assets/sampleData.d.ts +0 -2
- package/dist/manchette/components/Manchette.d.ts +0 -23
- package/dist/manchette/components/ManchetteWithSpaceTimeChart.d.ts +0 -23
- package/dist/manchette/components/Waypoint.d.ts +0 -14
- package/dist/manchette/consts.d.ts +0 -15
- package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +0 -49
- package/dist/manchette/hooks/useSyncManchette.d.ts +0 -94
- package/dist/manchette/index.d.ts +0 -11
- package/dist/manchette/types.d.ts +0 -34
- package/dist/manchette/utils/__tests__/helpers.spec.d.ts +0 -1
- package/dist/manchette/utils/helpers.d.ts +0 -44
- package/dist/manchette/utils/index.d.ts +0 -13
- package/dist/spaceTimeChart/__tests__/canvas.spec.d.ts +0 -1
- package/dist/spaceTimeChart/__tests__/geometry.spec.d.ts +0 -1
- package/dist/spaceTimeChart/__tests__/paths.spec.d.ts +0 -1
- package/dist/spaceTimeChart/__tests__/scales.spec.d.ts +0 -1
- package/dist/spaceTimeChart/__tests__/snapping.spec.d.ts +0 -1
- package/dist/spaceTimeChart/components/ConflictLayer.d.ts +0 -16
- package/dist/spaceTimeChart/components/ConflictTooltip.d.ts +0 -13
- package/dist/spaceTimeChart/components/OccupancyBlockLayer.d.ts +0 -12
- package/dist/spaceTimeChart/components/PathLayer.d.ts +0 -37
- package/dist/spaceTimeChart/components/PatternRect.d.ts +0 -8
- package/dist/spaceTimeChart/components/Quadrilateral.d.ts +0 -26
- package/dist/spaceTimeChart/components/SpaceGraduations.d.ts +0 -2
- package/dist/spaceTimeChart/components/SpaceTimeChart.d.ts +0 -3
- package/dist/spaceTimeChart/components/Tooltip.d.ts +0 -7
- package/dist/spaceTimeChart/components/WorkScheduleLayer.d.ts +0 -19
- package/dist/spaceTimeChart/components/ZoomRect.d.ts +0 -2
- package/dist/spaceTimeChart/config.d.ts +0 -4
- package/dist/spaceTimeChart/index.d.ts +0 -17
- package/dist/spaceTimeChart/lib/consts.d.ts +0 -17
- package/dist/spaceTimeChart/lib/context.d.ts +0 -13
- package/dist/spaceTimeChart/lib/theme.d.ts +0 -2
- package/dist/spaceTimeChart/lib/types.d.ts +0 -129
- package/dist/spaceTimeChart/utils/__tests__/canvas.spec.d.ts +0 -1
- package/dist/spaceTimeChart/utils/__tests__/scales.spec.d.ts +0 -1
- package/dist/spaceTimeChart/utils/canvas.d.ts +0 -43
- package/dist/spaceTimeChart/utils/events.d.ts +0 -12
- package/dist/spaceTimeChart/utils/geometry.d.ts +0 -13
- package/dist/spaceTimeChart/utils/paths.d.ts +0 -16
- package/dist/spaceTimeChart/utils/scales.d.ts +0 -73
- package/dist/spaceTimeChart/utils/snapping.d.ts +0 -10
- package/dist/spaceTimeChart/utils/vectors.d.ts +0 -2
- package/dist/speedSpaceChart/__tests__/utils.spec.d.ts +0 -1
- package/dist/speedSpaceChart/components/SpeedSpaceChart.d.ts +0 -50
- package/dist/speedSpaceChart/components/common/DetailsBox.d.ts +0 -22
- package/dist/speedSpaceChart/components/common/InteractionButtons.d.ts +0 -10
- package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +0 -15
- package/dist/speedSpaceChart/components/common/Tooltip.d.ts +0 -9
- package/dist/speedSpaceChart/components/const.d.ts +0 -74
- package/dist/speedSpaceChart/components/helpers/drawElements/axisY.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/curve.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/declivity.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/electricalProfile.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/powerRestrictions.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/reticle.d.ts +0 -14
- package/dist/speedSpaceChart/components/helpers/drawElements/speedLimitTags.d.ts +0 -3
- package/dist/speedSpaceChart/components/helpers/drawElements/speedLimits.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/steps.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/tickX.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/drawElements/tickYRight.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/frontFrame.d.ts +0 -2
- package/dist/speedSpaceChart/components/helpers/layersManager.d.ts +0 -5
- package/dist/speedSpaceChart/components/hooks.d.ts +0 -11
- package/dist/speedSpaceChart/components/layers/CurveLayer.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/DeclivityLayer.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/ElectricalProfileLayer.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/FrontInteractivityLayer.d.ts +0 -10
- package/dist/speedSpaceChart/components/layers/PowerRestrictionsLayer.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/ReticleLayer.d.ts +0 -11
- package/dist/speedSpaceChart/components/layers/SpeedLimitTagsLayer.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/SpeedLimitsLayer.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/StepsLayer.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/TickLayerX.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/TickLayerY.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/TickLayerYRight.d.ts +0 -9
- package/dist/speedSpaceChart/components/layers/index.d.ts +0 -12
- package/dist/speedSpaceChart/components/utils.d.ts +0 -112
- package/dist/speedSpaceChart/index.d.ts +0 -5
- package/dist/speedSpaceChart/types.d.ts +0 -155
- package/dist/theme.css +0 -6267
- package/dist/theme.css.map +0 -1
- package/dist/trackOccupancyDiagram/__tests__/utils.spec.d.ts +0 -1
- package/dist/trackOccupancyDiagram/components/TrackOccupancyCanvas.d.ts +0 -12
- package/dist/trackOccupancyDiagram/components/TrackOccupancyManchette.d.ts +0 -6
- package/dist/trackOccupancyDiagram/components/TrackOccupancyStandalone.d.ts +0 -10
- package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZones.d.ts +0 -20
- package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZonesTexts.d.ts +0 -10
- package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTrack.d.ts +0 -11
- package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTracks.d.ts +0 -8
- package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +0 -11
- package/dist/trackOccupancyDiagram/components/layers/TracksLayer.d.ts +0 -8
- package/dist/trackOccupancyDiagram/components/utils.d.ts +0 -24
- package/dist/trackOccupancyDiagram/index.d.ts +0 -7
- package/dist/trackOccupancyDiagram/lib/consts.d.ts +0 -32
- package/dist/trackOccupancyDiagram/lib/types.d.ts +0 -26
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { TimeChartContextType, ChartEventHandlers, HoveredItem, Point } from '../../common/types';
|
|
3
|
-
export type Handler<P extends object> = (payload: P) => void;
|
|
4
|
-
export type RGBColor = [number, number, number];
|
|
5
|
-
export type SpaceScale = {
|
|
6
|
-
to: number;
|
|
7
|
-
} & ({
|
|
8
|
-
coefficient: number;
|
|
9
|
-
} | {
|
|
10
|
-
size: number;
|
|
11
|
-
});
|
|
12
|
-
export type BinaryTreeNode<T> = T | {
|
|
13
|
-
limit: number;
|
|
14
|
-
from: number;
|
|
15
|
-
to: number;
|
|
16
|
-
pixelFrom: number;
|
|
17
|
-
pixelTo: number;
|
|
18
|
-
pixelLimit: number;
|
|
19
|
-
left: BinaryTreeNode<T>;
|
|
20
|
-
right: BinaryTreeNode<T>;
|
|
21
|
-
};
|
|
22
|
-
export type NormalizedScale = {
|
|
23
|
-
coefficient: number;
|
|
24
|
-
from: number;
|
|
25
|
-
to: number;
|
|
26
|
-
pixelFrom: number;
|
|
27
|
-
pixelTo: number;
|
|
28
|
-
previous?: NormalizedScale;
|
|
29
|
-
next?: NormalizedScale;
|
|
30
|
-
};
|
|
31
|
-
export type NormalizedScaleTree = BinaryTreeNode<NormalizedScale>;
|
|
32
|
-
export type DataPoint = {
|
|
33
|
-
time: number;
|
|
34
|
-
position: number;
|
|
35
|
-
};
|
|
36
|
-
export type PathEnd = 'stop' | 'out';
|
|
37
|
-
export declare const DEFAULT_PATH_END = "stop";
|
|
38
|
-
export type PathData = {
|
|
39
|
-
id: string;
|
|
40
|
-
label: string;
|
|
41
|
-
points: DataPoint[];
|
|
42
|
-
fromEnd?: PathEnd;
|
|
43
|
-
toEnd?: PathEnd;
|
|
44
|
-
};
|
|
45
|
-
export type OperationalPoint = {
|
|
46
|
-
id: string;
|
|
47
|
-
position: number;
|
|
48
|
-
label?: string;
|
|
49
|
-
importanceLevel?: number;
|
|
50
|
-
};
|
|
51
|
-
export type Axis = 'x' | 'y';
|
|
52
|
-
export type Direction = 'forward' | 'backward' | 'still';
|
|
53
|
-
export type SpaceToPixel = (position: number, fromEnd?: boolean) => number;
|
|
54
|
-
export type PixelToSpace = (y: number) => number;
|
|
55
|
-
export type PointToData = (point: Point) => DataPoint;
|
|
56
|
-
export type DataToPoint = (data: DataPoint) => Point;
|
|
57
|
-
export type MouseState = {
|
|
58
|
-
down?: {
|
|
59
|
-
ctrl?: boolean;
|
|
60
|
-
shift?: boolean;
|
|
61
|
-
};
|
|
62
|
-
position: Point;
|
|
63
|
-
isHover: boolean;
|
|
64
|
-
};
|
|
65
|
-
export type MouseContextType = MouseState & {
|
|
66
|
-
data: DataPoint;
|
|
67
|
-
hoveredItem: HoveredItem | null;
|
|
68
|
-
};
|
|
69
|
-
export type LineStyle = {
|
|
70
|
-
width: number;
|
|
71
|
-
color: string;
|
|
72
|
-
opacity?: number;
|
|
73
|
-
dashArray?: number[];
|
|
74
|
-
};
|
|
75
|
-
export type CaptionStyle = {
|
|
76
|
-
color: string;
|
|
77
|
-
font: string;
|
|
78
|
-
fontWeight?: string;
|
|
79
|
-
fontSize?: string;
|
|
80
|
-
topOffset?: number;
|
|
81
|
-
textAlign?: CanvasTextAlign;
|
|
82
|
-
};
|
|
83
|
-
export type SpaceTimeChartTheme = {
|
|
84
|
-
background: string;
|
|
85
|
-
breakpoints: number[];
|
|
86
|
-
timeRanges: number[];
|
|
87
|
-
pathsStyles: {
|
|
88
|
-
fontSize: number;
|
|
89
|
-
fontFamily: string;
|
|
90
|
-
};
|
|
91
|
-
spaceGraduationsStyles: Record<number, LineStyle>;
|
|
92
|
-
timeCaptionsPriorities: number[][];
|
|
93
|
-
timeCaptionsStyles: Record<number, CaptionStyle>;
|
|
94
|
-
timeCaptionsSize: number;
|
|
95
|
-
timeGraduationsPriorities: number[][];
|
|
96
|
-
timeGraduationsStyles: Record<number, LineStyle>;
|
|
97
|
-
dateCaptionsStyle: CaptionStyle;
|
|
98
|
-
dateCaptionsSize: number;
|
|
99
|
-
};
|
|
100
|
-
export type SpaceTimeChartProps = {
|
|
101
|
-
children?: ReactNode | ReactNode[];
|
|
102
|
-
additionalChildren?: ReactNode | ReactNode[];
|
|
103
|
-
operationalPoints: OperationalPoint[];
|
|
104
|
-
spaceOrigin: number;
|
|
105
|
-
spaceScales: SpaceScale[];
|
|
106
|
-
timeOrigin: number;
|
|
107
|
-
timeScale: number;
|
|
108
|
-
xOffset?: number;
|
|
109
|
-
yOffset?: number;
|
|
110
|
-
swapAxis?: boolean;
|
|
111
|
-
enableSnapping?: boolean;
|
|
112
|
-
hideTimeCaptions?: boolean;
|
|
113
|
-
hideGrid?: boolean;
|
|
114
|
-
hidePathsLabels?: boolean;
|
|
115
|
-
hideDates?: boolean;
|
|
116
|
-
showTicks?: boolean;
|
|
117
|
-
theme?: Partial<SpaceTimeChartTheme>;
|
|
118
|
-
} & ChartEventHandlers<SpaceTimeChartContextType>;
|
|
119
|
-
export type SpaceTimeChartContextType = TimeChartContextType & {
|
|
120
|
-
timeAxis: Axis;
|
|
121
|
-
spaceAxis: Axis;
|
|
122
|
-
spaceOrigin: number;
|
|
123
|
-
spaceScaleTree: NormalizedScaleTree;
|
|
124
|
-
flatSteps: Set<number>;
|
|
125
|
-
getSpacePixel: SpaceToPixel;
|
|
126
|
-
getSpace: PixelToSpace;
|
|
127
|
-
operationalPoints: OperationalPoint[];
|
|
128
|
-
captionSize: number;
|
|
129
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Point, RGBAColor } from '../../common/types';
|
|
2
|
-
import type { SpaceTimeChartContextType, Direction, PathEnd, RGBColor } from '../lib/types';
|
|
3
|
-
/**
|
|
4
|
-
* This function draws a thick lines from "from" to "to" on the given ImageData, with no
|
|
5
|
-
* antialiasing. This is very useful to handle picking, since it is not possible to disable
|
|
6
|
-
* antialiasing with the native JavaScript canvas APIs.
|
|
7
|
-
*/
|
|
8
|
-
export declare function drawAliasedLine(imageData: ImageData, { x: fromX, y: fromY }: Point, { x: toX, y: toY }: Point, [r, g, b]: RGBColor | RGBAColor, thickness: number, drawOnBottom: boolean, scalingRatio?: number): void;
|
|
9
|
-
export declare function getAliasedDiscShape(radius: number): Uint8Array;
|
|
10
|
-
/**
|
|
11
|
-
* This function draws an aliased disc, using a shape computed by getDiscShape.
|
|
12
|
-
*/
|
|
13
|
-
export declare function drawAliasedDisc(imageData: ImageData, { x: centerX, y: centerY }: Point, radius: number, [r, g, b]: RGBColor | RGBAColor, drawOnBottom: boolean, scalingRatio?: number): void;
|
|
14
|
-
/**
|
|
15
|
-
* Draws an aliased quadrilateral
|
|
16
|
-
*
|
|
17
|
-
* vertices[0] ________ vertices[1]
|
|
18
|
-
* / /
|
|
19
|
-
* vertices[3] /________/ vertices[2]
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export declare function drawAliasedQuadrilateral(imageData: ImageData, points: [Point, Point, Point, Point], [r, g, b]: RGBColor | RGBAColor, scalingRatio?: number): void;
|
|
23
|
-
export declare function drawAliasedRect(imageData: ImageData, { x, y }: Point, width: number, height: number, [r, g, b]: RGBColor | RGBAColor, scalingRatio?: number): void;
|
|
24
|
-
export declare function drawPathStopExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean): void;
|
|
25
|
-
export declare function drawPathOutExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean, extremityType: 'from' | 'to', pathDirection: Direction): void;
|
|
26
|
-
/**
|
|
27
|
-
* This function draws a path extremity.
|
|
28
|
-
*/
|
|
29
|
-
export declare function drawPathExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean, extremityType: 'from' | 'to', pathDirection: Direction, pathEnd: PathEnd): void;
|
|
30
|
-
export type CanvasRect = {
|
|
31
|
-
timeStart: Date;
|
|
32
|
-
timeEnd: Date;
|
|
33
|
-
spaceStart: number;
|
|
34
|
-
spaceEnd: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* You most likely need to wrap this function call with ctx.save ctx.restore
|
|
38
|
-
* as it modifies ctx current transformation matrix
|
|
39
|
-
*/
|
|
40
|
-
export declare function fillRect(ctx: CanvasRenderingContext2D, { timeStart, timeEnd, spaceStart, spaceEnd }: CanvasRect, { getPoint }: SpaceTimeChartContextType): {
|
|
41
|
-
width: number;
|
|
42
|
-
height: number;
|
|
43
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Point } from '../../common/types';
|
|
2
|
-
/**
|
|
3
|
-
* This function takes a MouseEvent and an HTMLElement, and returns the position of the mouse,
|
|
4
|
-
* relatively to the DOM element. This allows for instance dragging an element that is on the given
|
|
5
|
-
* DOM element while the events are bound to the document or the body.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getEventPosition(e: MouseEvent, dom: HTMLElement): Point;
|
|
8
|
-
/**
|
|
9
|
-
* This function returns a delta value for a given WheelEvent. It can be very useful, since the
|
|
10
|
-
* given `deltaY` and `detail` attributes are not normalized.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getEventWheelDelta(e: WheelEvent): number;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Point } from '../../common/types';
|
|
2
|
-
/**
|
|
3
|
-
* This function helps to find if two segments do intersect.
|
|
4
|
-
*/
|
|
5
|
-
export declare function intersectsSegments(s1From: Point, s1To: Point, s2From: Point, s2To: Point): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* This functions helps to find if a segment intersects with a stage of width x height pixels.
|
|
8
|
-
*/
|
|
9
|
-
export declare function isSegmentOnScreen(width: number, height: number, from: Point, to: Point): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* This functions helps to find if a path intersects with a stage of width x height pixels.
|
|
12
|
-
*/
|
|
13
|
-
export declare function isPathOnScreen(width: number, height: number, points: Point[]): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Direction, PathData, SpaceToPixel } from '../lib/types';
|
|
2
|
-
/**
|
|
3
|
-
* This function takes a path, a point index and looks forward in the points order for the first
|
|
4
|
-
* position variation. It then returns "forward" or "backward" according to that variation.
|
|
5
|
-
*
|
|
6
|
-
* If it does not find any variation for some reason, it returns "still" instead.
|
|
7
|
-
*
|
|
8
|
-
* Finally, if `reversed` is true, then, it searches points in the other direction.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getPathDirection({ points }: PathData, index: number, reversed?: boolean): Direction;
|
|
11
|
-
/**
|
|
12
|
-
* This function takes a SpaceToPixel function and a position, and checks if the function returns
|
|
13
|
-
* the same pixel for the position, starting from both sides. It then returns one or two pixel
|
|
14
|
-
* positions accordingly.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getSpacePixels(getSpacePixel: SpaceToPixel, position: number): [number] | [number, number];
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { PixelToTime, TimeToPixel } from '../../common/types';
|
|
2
|
-
import { type NormalizedScaleTree, type NormalizedScale, type SpaceScale, type SpaceToPixel, type PixelToSpace, type PointToData, type DataToPoint, type Axis, type PathData } from '../lib/types';
|
|
3
|
-
/**
|
|
4
|
-
* This function helps to index a sequence of consecutive scales into a binary tree, to make it
|
|
5
|
-
* faster to find which scale contains any given position.
|
|
6
|
-
*
|
|
7
|
-
* The optional `skipSiblingReferences` option allows getting a serializable tree, for testing
|
|
8
|
-
* purpose.
|
|
9
|
-
*/
|
|
10
|
-
export declare function spaceScalesToBinaryTree(spaceOrigin: number, spaceScales: SpaceScale[], skipSiblingReferences?: boolean): NormalizedScaleTree;
|
|
11
|
-
/**
|
|
12
|
-
* This function takes a sequence of SpaceScales, identifies the flat steps (i.e. the scales that do
|
|
13
|
-
* not increase the position), and returns them in a set.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getFlatSteps(spaceScales: SpaceScale[]): Set<number>;
|
|
16
|
-
/**
|
|
17
|
-
* This function takes a NormalizedScaleTree and a position, and returns the leaf node from the
|
|
18
|
-
* tree that contains that position.
|
|
19
|
-
*
|
|
20
|
-
* Also, if the position is lower than the tree's min (tree.from), then the first leaf is returned
|
|
21
|
-
* and if it is higher than the max (tree.to), the last leaf is returned.
|
|
22
|
-
*
|
|
23
|
-
* Finally, if pickLast is truthy, then it returns the last leaf node that contains that position
|
|
24
|
-
* instead of the first one. It is very important when there are flat sections.
|
|
25
|
-
*/
|
|
26
|
-
export declare function getNormalizedScaleAtPosition(position: number, tree: NormalizedScaleTree, pickLast?: boolean): NormalizedScale;
|
|
27
|
-
/**
|
|
28
|
-
* This function takes a NormalizedScaleTree and a pixel position, and returns the leaf node from
|
|
29
|
-
* the tree that contains that pixel.
|
|
30
|
-
*
|
|
31
|
-
* Also, if the position is lower than the tree's min pixel (tree.pixelFrom), then the first leaf
|
|
32
|
-
* is returned and if it is higher than the max pixel (tree.pixelTo), the last leaf is returned.
|
|
33
|
-
*/
|
|
34
|
-
export declare function getNormalizedScaleAtPixel(y: number, tree: NormalizedScaleTree): NormalizedScale;
|
|
35
|
-
export declare function getSpaceToPixel(pixelOffset: number, binaryTree: NormalizedScaleTree): SpaceToPixel;
|
|
36
|
-
export declare function getPixelToSpace(pixelOffset: number, binaryTree: NormalizedScaleTree): PixelToSpace;
|
|
37
|
-
export declare function getPointToData(getTime: PixelToTime, getSpace: PixelToSpace, timeAxis: Axis, spaceAxis: Axis): PointToData;
|
|
38
|
-
export declare function getDataToPoint(getTimePixel: TimeToPixel, getSpacePixel: SpaceToPixel, timeAxis: Axis, spaceAxis: Axis): DataToPoint;
|
|
39
|
-
/**
|
|
40
|
-
* This function takes a path and a time, a returns the position of the train at the given time, or
|
|
41
|
-
* the position at the closest time to the path existence.
|
|
42
|
-
*/
|
|
43
|
-
export declare function getSpaceAtTime(path: PathData, time: number): number;
|
|
44
|
-
/**
|
|
45
|
-
* This function helps to find where to "break" a straight line that crosses separations between
|
|
46
|
-
* different time scales. It takes two positions (in the "space" space), and returns an array of
|
|
47
|
-
* positions between these the two input positions (the array can be empty).
|
|
48
|
-
*/
|
|
49
|
-
export declare function getSpaceBreakpoints(from: number, to: number, tree: NormalizedScaleTree): number[];
|
|
50
|
-
/**
|
|
51
|
-
* in most cases, after the rectangle zoom, the screen will be centered
|
|
52
|
-
* on the center of the rectangle the user drew.
|
|
53
|
-
* In case we reach max zoom, not to break this expectation we need a different offset calculation
|
|
54
|
-
*/
|
|
55
|
-
export declare function computeRectZoomOffsets({ rect, timeOrigin, spaceOrigin, newTimeScale, newSpaceScale, swapAxes, chartWidth, chartHeight, }: {
|
|
56
|
-
rect: {
|
|
57
|
-
timeStart: Date;
|
|
58
|
-
timeEnd: Date;
|
|
59
|
-
spaceStart: number;
|
|
60
|
-
spaceEnd: number;
|
|
61
|
-
};
|
|
62
|
-
timeOrigin: number;
|
|
63
|
-
spaceOrigin: number;
|
|
64
|
-
newTimeScale: number;
|
|
65
|
-
newSpaceScale: number;
|
|
66
|
-
swapAxes: boolean;
|
|
67
|
-
chartWidth: number;
|
|
68
|
-
chartHeight: number;
|
|
69
|
-
}): {
|
|
70
|
-
xOffset: number;
|
|
71
|
-
yOffset: number;
|
|
72
|
-
};
|
|
73
|
-
export declare function sideOffset(origin: number, newScale: number, rectStart: number | Date, rectEnd: number | Date, chartSideSizePx: number, axisPadding?: number): number;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HoveredItem, Point } from '../../common/types';
|
|
2
|
-
/**
|
|
3
|
-
* This function takes a point and a segment, and returns the point of the segment that is the
|
|
4
|
-
* closest to the input point.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getClosestPointOnSegment(point: Point, segmentFrom: Point, segmentTo: Point): Point;
|
|
7
|
-
/**
|
|
8
|
-
* This function helps to handle snapping with a SpaceTimeChat instance.
|
|
9
|
-
*/
|
|
10
|
-
export declare function snapPosition(mousePosition: Point, hoveredItem: HoveredItem | null): Point;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Data, EtcsBrakingCurves } from '../types';
|
|
3
|
-
export type SpeedSpaceChartProps = {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
backgroundColor: string;
|
|
7
|
-
setHeight: React.Dispatch<React.SetStateAction<number>>;
|
|
8
|
-
fetchEtcsBrakingCurves?: () => Promise<void>;
|
|
9
|
-
etcsBrakingCurves?: EtcsBrakingCurves;
|
|
10
|
-
data: Data;
|
|
11
|
-
translations?: {
|
|
12
|
-
detailsBoxDisplay: {
|
|
13
|
-
reticleInfos: string;
|
|
14
|
-
energySource: string;
|
|
15
|
-
tractionStatus: string;
|
|
16
|
-
declivities: string;
|
|
17
|
-
etcs: string;
|
|
18
|
-
electricalProfiles: string;
|
|
19
|
-
powerRestrictions: string;
|
|
20
|
-
};
|
|
21
|
-
layersDisplay: {
|
|
22
|
-
context: string;
|
|
23
|
-
steps: string;
|
|
24
|
-
declivities: string;
|
|
25
|
-
speedLimits: string;
|
|
26
|
-
temporarySpeedLimits: string;
|
|
27
|
-
electricalProfiles: string;
|
|
28
|
-
powerRestrictions: string;
|
|
29
|
-
speedLimitTags: string;
|
|
30
|
-
};
|
|
31
|
-
etcsLayersDisplay: {
|
|
32
|
-
title: string;
|
|
33
|
-
etcsBrakingTypes: {
|
|
34
|
-
stop: string;
|
|
35
|
-
transition: string;
|
|
36
|
-
stopsAndTransitions: string;
|
|
37
|
-
signals: string;
|
|
38
|
-
spacing: string;
|
|
39
|
-
routing: string;
|
|
40
|
-
};
|
|
41
|
-
etcsBrakingCurveTypes: {
|
|
42
|
-
indication: string;
|
|
43
|
-
permittedSpeed: string;
|
|
44
|
-
guidance: string;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
declare const SpeedSpaceChart: ({ width, height, backgroundColor, data, setHeight, translations, fetchEtcsBrakingCurves, etcsBrakingCurves, }: SpeedSpaceChartProps) => React.JSX.Element;
|
|
50
|
-
export default SpeedSpaceChart;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { EtcsBrakingCurveType, EtcsBrakingType, EtcsSpeedValue, Store } from '../../types';
|
|
3
|
-
import type { SpeedSpaceChartProps } from '../SpeedSpaceChart';
|
|
4
|
-
type DetailsBoxProps = {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
store: Store;
|
|
8
|
-
curveX: number;
|
|
9
|
-
curveY: number;
|
|
10
|
-
speedText: string;
|
|
11
|
-
ecoSpeedText: string;
|
|
12
|
-
etcsSpeedValues?: Record<EtcsBrakingType, Record<EtcsBrakingCurveType, EtcsSpeedValue[]>>;
|
|
13
|
-
translations?: SpeedSpaceChartProps['translations'];
|
|
14
|
-
effortText: string;
|
|
15
|
-
electricalModeText: string;
|
|
16
|
-
electricalProfileText: string;
|
|
17
|
-
powerRestrictionText: string;
|
|
18
|
-
previousGradientText: number;
|
|
19
|
-
modeText: string;
|
|
20
|
-
};
|
|
21
|
-
declare const DetailsBox: ({ width, height, store, curveX, curveY, speedText, ecoSpeedText, etcsSpeedValues, translations, effortText, electricalModeText, electricalProfileText, powerRestrictionText, previousGradientText, modeText, }: DetailsBoxProps) => React.JSX.Element;
|
|
22
|
-
export default DetailsBox;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
type InteractionButtonsProps = {
|
|
4
|
-
reset: () => void;
|
|
5
|
-
openSettingsPanel: () => void;
|
|
6
|
-
store: Store;
|
|
7
|
-
testIdPrefix?: string;
|
|
8
|
-
};
|
|
9
|
-
declare const InteractionButtons: ({ reset, openSettingsPanel, store, testIdPrefix, }: InteractionButtonsProps) => React.JSX.Element;
|
|
10
|
-
export default InteractionButtons;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
import type { SpeedSpaceChartProps } from '../SpeedSpaceChart';
|
|
4
|
-
type SettingsPanelProps = {
|
|
5
|
-
color: string;
|
|
6
|
-
store: Store;
|
|
7
|
-
setStore: React.Dispatch<React.SetStateAction<Store>>;
|
|
8
|
-
setIsMouseHoveringSettingsPanel: React.Dispatch<React.SetStateAction<boolean>>;
|
|
9
|
-
adjustHeightOnLayerChange: (layerName: 'electricalProfiles' | 'powerRestrictions' | 'speedLimitTags', isCurrentlyActive: boolean) => void;
|
|
10
|
-
translations?: SpeedSpaceChartProps['translations'];
|
|
11
|
-
testIdPrefix?: string;
|
|
12
|
-
displayEtcs?: boolean;
|
|
13
|
-
};
|
|
14
|
-
declare const SettingsPanel: ({ color, store, setStore, setIsMouseHoveringSettingsPanel, adjustHeightOnLayerChange, translations, testIdPrefix, displayEtcs, }: SettingsPanelProps) => React.JSX.Element;
|
|
15
|
-
export default SettingsPanel;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import chroma from 'chroma-js';
|
|
2
|
-
import { type ColorDictionary, type EtcsAlphaDictionary, EtcsBrakingCurveType, EtcsBrakingType, type EtcsColorDictionary, type EtcsLayersDisplay, type Store } from '../types';
|
|
3
|
-
export declare const SLOPE_FILL_COLOR = "#CFDDCE";
|
|
4
|
-
export declare const RIGHT_TICK_HEIGHT_OFFSET = 2;
|
|
5
|
-
export declare const TICK_TITLE_MARGINS: {
|
|
6
|
-
Y_LEFT_VERTICAL: number;
|
|
7
|
-
Y_LEFT_HORIZONTAL: number;
|
|
8
|
-
Y_RIGHT_VERTICAL: number;
|
|
9
|
-
Y_RIGHT_HORIZONTAL: number;
|
|
10
|
-
};
|
|
11
|
-
export declare const MARGINS: {
|
|
12
|
-
MARGIN_LEFT: number;
|
|
13
|
-
MARGIN_RIGHT: number;
|
|
14
|
-
MARGIN_TOP: number;
|
|
15
|
-
MARGIN_BOTTOM: number;
|
|
16
|
-
CURVE_MARGIN_TOP: number;
|
|
17
|
-
CURVE_MARGIN_SIDES: number;
|
|
18
|
-
ELECTRICAL_PROFILES_MARGIN_TOP: number;
|
|
19
|
-
RIGHT_TICK_MARGINS: number;
|
|
20
|
-
OFFSET_RIGHT_AXIS: number;
|
|
21
|
-
};
|
|
22
|
-
export declare const CURSOR_SNAP_DISTANCE = 6;
|
|
23
|
-
export declare const LINEAR_LAYERS_HEIGHTS: {
|
|
24
|
-
ELECTRICAL_PROFILES_HEIGHT: number;
|
|
25
|
-
POWER_RESTRICTIONS_HEIGHT: number;
|
|
26
|
-
SPEED_LIMIT_TAGS_HEIGHT: number;
|
|
27
|
-
};
|
|
28
|
-
export declare const LINEAR_LAYER_SEPARATOR_HEIGHT = 1;
|
|
29
|
-
export declare const LINEAR_LAYERS_BACKGROUND_COLOR: {
|
|
30
|
-
FIRST: string;
|
|
31
|
-
SECOND: string;
|
|
32
|
-
THIRD: string;
|
|
33
|
-
};
|
|
34
|
-
export declare const FRONT_INTERACTIVITY_LAYER_ID = "#front-interactivity-layer";
|
|
35
|
-
export declare const DETAILS_BOX_SELECTION: Array<keyof Store['detailsBoxDisplay']>;
|
|
36
|
-
export declare const LAYERS_SELECTION: Array<keyof Store['layersDisplay']>;
|
|
37
|
-
export declare const DEFAULT_ETCS_LAYERS_DISPLAY: {
|
|
38
|
-
etcsBrakingTypes: {
|
|
39
|
-
stopsAndTransitions: boolean;
|
|
40
|
-
spacing: boolean;
|
|
41
|
-
routing: boolean;
|
|
42
|
-
};
|
|
43
|
-
etcsBrakingCurveTypes: {
|
|
44
|
-
indication: boolean;
|
|
45
|
-
permittedSpeed: boolean;
|
|
46
|
-
guidance: boolean;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export declare const ETCS_BRAKING_SELECTION: Record<keyof EtcsLayersDisplay['etcsBrakingTypes'], EtcsBrakingType[]>;
|
|
50
|
-
export declare const ETCS_CURVE_SELECTION: Record<keyof EtcsLayersDisplay['etcsBrakingCurveTypes'], EtcsBrakingCurveType>;
|
|
51
|
-
export declare const BLACK: chroma.Color;
|
|
52
|
-
export declare const ERROR_30: chroma.Color;
|
|
53
|
-
export declare const ERROR_60: chroma.Color;
|
|
54
|
-
export declare const GREY_50: chroma.Color;
|
|
55
|
-
export declare const GREY_80: chroma.Color;
|
|
56
|
-
export declare const LIGHT_BLUE: chroma.Color;
|
|
57
|
-
export declare const WARNING_30: chroma.Color;
|
|
58
|
-
export declare const WHITE: chroma.Color;
|
|
59
|
-
export declare const BASE_SPEED_COLOR: chroma.Color;
|
|
60
|
-
export declare const ECO_SPEED_COLOR: chroma.Color;
|
|
61
|
-
export declare const BASE_SPEED_FILL_ALPHA = 0.15;
|
|
62
|
-
export declare const ETCS_COLOR_DICTIONARY: EtcsColorDictionary;
|
|
63
|
-
export declare const ETCS_ALPHA_DICTIONARY: EtcsAlphaDictionary;
|
|
64
|
-
/**
|
|
65
|
-
* COLOR_DICTIONARY maps specific colors to their corresponding secondary colors used for speed limit tags.
|
|
66
|
-
*/
|
|
67
|
-
export declare const COLOR_DICTIONARY: ColorDictionary;
|
|
68
|
-
export declare const ZOOM_CONFIG: {
|
|
69
|
-
MIN_RATIO: number;
|
|
70
|
-
MAX_RATIO: number;
|
|
71
|
-
SLIDER_WIDTH: number;
|
|
72
|
-
};
|
|
73
|
-
export declare const SPEEDS_LINEWIDTH = 0.5;
|
|
74
|
-
export declare const ETCS_LINEWIDTH = 3;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type DrawFunctionParams, EtcsBrakingCurveType, EtcsBrakingType, type EtcsSpeedValue } from '../../../types';
|
|
2
|
-
export declare const drawCursor: ({ ctx, width, height, store }: DrawFunctionParams) => {
|
|
3
|
-
curveX: number;
|
|
4
|
-
curveY: number;
|
|
5
|
-
speedText: string;
|
|
6
|
-
ecoSpeedText: string;
|
|
7
|
-
etcsSpeedValues: Record<EtcsBrakingType, Record<EtcsBrakingCurveType, EtcsSpeedValue[]>> | undefined;
|
|
8
|
-
effortText: string;
|
|
9
|
-
electricalModeText: string;
|
|
10
|
-
electricalProfileText: string;
|
|
11
|
-
powerRestrictionText: string;
|
|
12
|
-
previousGradientText: number;
|
|
13
|
-
modeText: string;
|
|
14
|
-
} | undefined;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { DrawFunctionParams, SpeedLimitTagsLayerDrawFunctionParams, tooltipInfos } from '../../../types';
|
|
2
|
-
export declare const drawSpeedLimitTags: ({ ctx, width, height: marginTop, store, images, }: SpeedLimitTagsLayerDrawFunctionParams) => void;
|
|
3
|
-
export declare const computeTooltip: ({ width, height: marginTop, store, }: DrawFunctionParams) => tooltipInfos | null;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as d3zoom from 'd3-zoom';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
export declare const resetZoom: () => void;
|
|
4
|
-
export declare const zoom: (setStore: React.Dispatch<React.SetStateAction<Store>>) => d3zoom.ZoomBehavior<Element, unknown>;
|
|
5
|
-
export declare const computeLeftOffsetOnZoom: (value: number) => number;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DrawFunctionParams, Store } from '../types';
|
|
2
|
-
type DrawFunction = (params: DrawFunctionParams) => void;
|
|
3
|
-
type UseCanvasParams = {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
store: Store;
|
|
7
|
-
setStore?: React.Dispatch<React.SetStateAction<Store>>;
|
|
8
|
-
};
|
|
9
|
-
type UseCanvas = (draw: DrawFunction, params: UseCanvasParams) => React.RefObject<HTMLCanvasElement | null>;
|
|
10
|
-
export declare const useCanvas: UseCanvas;
|
|
11
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
type CurveLayerProps = {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
store: Store;
|
|
7
|
-
};
|
|
8
|
-
declare const CurveLayer: ({ width, height, store }: CurveLayerProps) => React.JSX.Element;
|
|
9
|
-
export default CurveLayer;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
type DeclivityLayerProps = {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
store: Store;
|
|
7
|
-
};
|
|
8
|
-
declare const DeclivityLayer: ({ width, height, store }: DeclivityLayerProps) => React.JSX.Element;
|
|
9
|
-
export default DeclivityLayer;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
type ElectricalProfileLayerProps = {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
store: Store;
|
|
7
|
-
};
|
|
8
|
-
declare const ElectricalProfileLayer: ({ width, height, store }: ElectricalProfileLayerProps) => React.JSX.Element;
|
|
9
|
-
export default ElectricalProfileLayer;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
type FrontInteractivityLayerProps = {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
store: Store;
|
|
7
|
-
setStore: React.Dispatch<React.SetStateAction<Store>>;
|
|
8
|
-
};
|
|
9
|
-
declare const FrontInteractivityLayer: ({ width, height, store, setStore, }: FrontInteractivityLayerProps) => React.JSX.Element;
|
|
10
|
-
export default FrontInteractivityLayer;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Store } from '../../types';
|
|
3
|
-
type PowerRestrictionsLayerProps = {
|
|
4
|
-
width: number;
|
|
5
|
-
marginTop: number;
|
|
6
|
-
store: Store;
|
|
7
|
-
};
|
|
8
|
-
declare const PowerRestrictionsLayer: ({ width, marginTop, store }: PowerRestrictionsLayerProps) => React.JSX.Element;
|
|
9
|
-
export default PowerRestrictionsLayer;
|