This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new DB, interfaces and types (#99)
- Cleanup tables interfaces and types - Add our database
- Loading branch information
Showing
5 changed files
with
151 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,76 @@ | ||
/** | ||
* The latitude and longitude of a point. | ||
*/ | ||
export interface LatLng { | ||
lat: number; | ||
lng: number; | ||
} | ||
|
||
export interface LatLon { | ||
lat: number; | ||
lon: number; | ||
} | ||
|
||
export interface PointData extends LatLng { | ||
properties?: PointProperties; | ||
value?: number; | ||
metadata?: any; | ||
} | ||
|
||
export type Path = PointData[]; | ||
|
||
export enum RendererName { | ||
circle = 'circle', | ||
circles = 'circles', | ||
rectangles = 'rectangles', | ||
line = 'line', | ||
hotline = 'hotline', | ||
hotpoints = 'hotpoints', | ||
} | ||
|
||
export interface PaletteColor { | ||
offset: number; | ||
color: string; | ||
stopValue?: number; | ||
} | ||
export type Palette = PaletteColor[]; | ||
|
||
// Rendering properties of a single point belonging to a Path | ||
// If an attribute is defined for a point, it overwrites the properties for the path | ||
export interface PointProperties { | ||
// Color of a point or the entire path | ||
color?: string; | ||
// Radius or largeness of a point or the entire path | ||
width?: number; | ||
// Weight (boldness) of a point or the entire path | ||
weight?: number; | ||
// Opacity (between 0 and 1) of a point or the entire path | ||
opacity?: number; | ||
} | ||
|
||
// Rendering properties of an entire Path | ||
export interface PathProperties extends PointProperties { | ||
// The name of the renderer to use - see ./renderers for the list of names | ||
rendererName: RendererName; | ||
// Weight can be multiplied by the dilatationFactor | ||
// < 1 -> shrinks ; > 1 -> grows ; == 1 -> stays the same | ||
dilatationFactor?: number; | ||
// Palette used for coloring the path and graph | ||
palette?: Palette; | ||
} | ||
|
||
export interface Measurement extends PathProperties { | ||
// measurement as it is in the database | ||
dbName: string; | ||
// human friendly name of the measurement | ||
name: string; | ||
// Needs to be specified if the points have a value attached to them | ||
hasValue?: boolean; | ||
} | ||
|
||
export type Position3D = { | ||
x: number; | ||
y: number; | ||
z: number; | ||
}; | ||
|
||
export interface LatLngDist extends LatLng { | ||
way_dist: number; | ||
} | ||
|
||
export interface LatLonDist extends LatLon { | ||
way_dist: number; | ||
} | ||
|
||
export interface ValueLatLng extends LatLng { | ||
value: number; | ||
} | ||
|
||
/** | ||
* Used in the data plot to show the condition of a road. | ||
* The way_dist is the distance from the start of the way. It will be the x-axis in the plot. | ||
* The value is the condition value. It will be the y-axis in the plot. | ||
*/ | ||
export interface Condition { | ||
way_dist: number; | ||
value: number; | ||
} | ||
|
||
/** | ||
* The OSM id of a way. | ||
*/ | ||
export type WayId = string; | ||
|
||
export interface WaysConditions { | ||
way_lengths: number[]; | ||
way_ids: WayId[]; | ||
geometry: LatLngDist[][]; | ||
conditions: Condition[][]; | ||
} | ||
|
||
export interface MapBounds { | ||
minLat: number; | ||
maxLat: number; | ||
minLng: number; | ||
maxLng: number; | ||
} | ||
|
||
// geometry: LatLng[][] | ||
// wayIds: WayId[] | ||
// conditions: | ||
|
||
export interface BoundedCondition { | ||
conditions: { [condition_type: string]: Condition[] }; | ||
length: number; | ||
coordinates: LatLonDist[]; | ||
} | ||
|
||
/** | ||
* The description of a road | ||
* The way_ids are the ids of the ways of each branch of the way. Can be the two directions or when a road | ||
* split into two branches. | ||
* | ||
* Example: | ||
* /---<---\ | ||
* ---------- ----------- | ||
* \--->---/ | ||
* | ||
* The list of point for the geometry of each way. | ||
*/ | ||
export interface Road { | ||
// the name of the road | ||
way_name: string; | ||
// the ids of the ways of each branch of the way. Can be the two directions or when a road | ||
// split into two branches | ||
// Example: | ||
// /---<---\ | ||
// ----------- ----------- | ||
// \--->---/ | ||
way_ids: WayId[][]; | ||
// the geometry of each way | ||
geometries: Record<WayId, LatLng[]>; | ||
} | ||
|
||
/** | ||
* The image types. | ||
*/ | ||
export enum ImageType { | ||
Image3D, | ||
ImageInt, | ||
ImageRng, | ||
Overlay3D, | ||
OverlayInt, | ||
OverlayRng, | ||
} | ||
|
||
/** | ||
* The measurement types. | ||
*/ | ||
export enum MeasurementType { | ||
Rutting = 1, | ||
MacroTexture = 2, | ||
LaneMarking = 3, | ||
RumbleStrip = 4, | ||
Potholes = 5, | ||
DropOffCurb = 6, | ||
Joint = 7, | ||
Raveling = 8, | ||
Roughness = 9, | ||
RoadGeometry = 10, | ||
WaterEntrapment = 11, | ||
Shoving = 12, | ||
PickOut = 13, | ||
Bleeding = 14, | ||
SealedCrack = 15, | ||
Manholes = 16, | ||
Patch = 17, | ||
Pumping = 18, | ||
} |
Oops, something went wrong.