@equinor/videx-map 1.12.5 → 1.13.0-beta.1

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.
Files changed (44) hide show
  1. package/dist/ExplorationLayer.d.ts +1 -1
  2. package/dist/FaultlineModule.d.ts +2 -2
  3. package/dist/FieldModule.d.ts +3 -3
  4. package/dist/GeoJSONModule/GeoJSONModule.d.ts +2 -2
  5. package/dist/GeoJSONModule/labels.d.ts +1 -1
  6. package/dist/GeoJSONModule/linestring.d.ts +2 -2
  7. package/dist/GeoJSONModule/multipolygon.d.ts +2 -2
  8. package/dist/GeoJSONModule/point.d.ts +1 -1
  9. package/dist/GeoJSONModule/polygon.d.ts +1 -1
  10. package/dist/ModuleInterface.d.ts +3 -3
  11. package/dist/WellboreModule.d.ts +2 -2
  12. package/dist/index.esm.js +1 -15
  13. package/dist/index.js +1 -1
  14. package/dist/index.umd.js +1 -1
  15. package/dist/utils/ComparableArray.d.ts +60 -0
  16. package/dist/utils/LineDictionary.d.ts +2 -2
  17. package/dist/utils/Mesh.d.ts +2 -2
  18. package/dist/utils/PointDictionary.d.ts +1 -1
  19. package/dist/utils/Rect.d.ts +27 -0
  20. package/dist/utils/TriangleDictionary.d.ts +1 -1
  21. package/dist/utils/centerOfMass.d.ts +1 -1
  22. package/dist/utils/fields/Highlighter.d.ts +1 -1
  23. package/dist/utils/fields/LabelManager.d.ts +2 -2
  24. package/dist/utils/generateCircle.d.ts +1 -1
  25. package/dist/utils/lineReducer.d.ts +9 -0
  26. package/dist/utils/wellbores/Colors.d.ts +1 -1
  27. package/dist/utils/wellbores/Config.d.ts +3 -3
  28. package/dist/utils/wellbores/DataManager.d.ts +15 -0
  29. package/dist/utils/wellbores/Highlight.d.ts +1 -1
  30. package/dist/utils/wellbores/LabelType.d.ts +9 -0
  31. package/dist/utils/wellbores/Projector.d.ts +1 -1
  32. package/dist/utils/wellbores/RealtimeWellbore.d.ts +1 -1
  33. package/dist/utils/wellbores/Shader.d.ts +2 -1
  34. package/dist/utils/wellbores/data/Group.d.ts +1 -1
  35. package/dist/utils/wellbores/data/RootData.d.ts +2 -1
  36. package/dist/utils/wellbores/data/SourceData.d.ts +25 -0
  37. package/dist/utils/wellbores/data/WellboreData.d.ts +4 -0
  38. package/dist/utils/wellbores/data/WellboreEventData.d.ts +2 -2
  39. package/dist/utils/wellbores/highlight-helper.d.ts +3 -3
  40. package/dist/utils/wellbores/labels/label-helper.d.ts +1 -1
  41. package/dist/utils/wellbores/registries/CallbackRegistry.d.ts +23 -0
  42. package/dist/utils/wellbores/registries/ColorRegistry.d.ts +22 -0
  43. package/dist/utils/wellbores/registries/index.d.ts +2 -0
  44. package/package.json +24 -12
@@ -0,0 +1,27 @@
1
+ import Vector2 from '@equinor/videx-vector2';
2
+ import { VectorLike } from '@equinor/videx-linear-algebra';
3
+ export default class Rect {
4
+ lowerLeft: Vector2;
5
+ width: number;
6
+ height: number;
7
+ rotation: number;
8
+ constructor(lowerLeft: Vector2, width: number, height: number, rotation: number);
9
+ /**
10
+ * Check if a point is inside.
11
+ * @param vector Vector to evaluate
12
+ * @returns True if point is inside rectangle
13
+ */
14
+ isInside(vector: VectorLike): boolean;
15
+ /**
16
+ * Check if a point is inside.
17
+ * @param x X position to evaluate
18
+ * @param y Y position to evaluate
19
+ * @returns True if point is inside rectangle
20
+ */
21
+ isInside(x: number, y: number): boolean;
22
+ /**
23
+ * Transforms position from world space to local space.
24
+ * @param position
25
+ */
26
+ inverseTransformPoint(x: number, y: number): Vector2;
27
+ }
@@ -1,4 +1,4 @@
1
- declare type vec2 = [number, number];
1
+ type vec2 = [number, number];
2
2
  interface Triangle {
3
3
  v1: vec2;
4
4
  v2: vec2;
@@ -1,4 +1,4 @@
1
- import Vector2 from "@equinor/videx-vector2";
1
+ import Vector2 from '@equinor/videx-vector2';
2
2
  /**
3
3
  * Get the center of mass of a polygon.
4
4
  * @param vertices Vertices of polygon
@@ -1,5 +1,5 @@
1
1
  import { FieldMesh } from '../../FieldModule';
2
- declare type vec3 = [number, number, number];
2
+ type vec3 = [number, number, number];
3
3
  interface Cache {
4
4
  fillCol1: vec3;
5
5
  fillCol2: vec3;
@@ -1,7 +1,7 @@
1
1
  import * as PIXI from 'pixi.js';
2
2
  import Vector2 from '@equinor/videx-vector2';
3
3
  /** Data for label. */
4
- export declare type LabelData = {
4
+ export type LabelData = {
5
5
  position: Vector2;
6
6
  mass: number;
7
7
  };
@@ -12,7 +12,7 @@ interface Field {
12
12
  instance?: PIXI.Text;
13
13
  }
14
14
  /** Instance of a multi-label entry. */
15
- export declare type Label = {
15
+ export type Label = {
16
16
  position: Vector2;
17
17
  mass: number;
18
18
  instance: PIXI.Text;
@@ -1,4 +1,4 @@
1
- import Vector2 from "@equinor/videx-vector2";
1
+ import Vector2 from '@equinor/videx-vector2';
2
2
  import * as PIXI from 'pixi.js';
3
3
  /**
4
4
  *
@@ -0,0 +1,9 @@
1
+ import { VectorLike } from '@equinor/videx-linear-algebra';
2
+ /**
3
+ * Reduce complexity of a line by removing points with little information.
4
+ * @param points Collection of points to reduce
5
+ * @param maxDeviation Max deviation of a single point
6
+ * @param distanceWeight Scale allowed deviatin by distance from last point
7
+ * @returns Reduced line
8
+ */
9
+ export declare function reduce<T extends VectorLike>(points: T[], maxDeviation: number, distanceWeight: number): T[];
@@ -1,4 +1,4 @@
1
- declare type vec3 = [number, number, number];
1
+ type vec3 = [number, number, number];
2
2
  export interface Color {
3
3
  col1: vec3;
4
4
  col2: vec3;
@@ -1,6 +1,6 @@
1
- import { WellboreEventData } from "./data";
2
- import { HighlightEvent } from "./data/WellboreEventData";
3
- import { EventHandler } from "../../EventHandler";
1
+ import { WellboreEventData } from './data';
2
+ import { HighlightEvent } from './data/WellboreEventData';
3
+ import { EventHandler } from '../../EventHandler';
4
4
  import { ResizeConfig } from '../../ResizeConfigInterface';
5
5
  export interface TickConfig {
6
6
  width: number;
@@ -0,0 +1,15 @@
1
+ import { SourceData, WellboreData, RootData, Group } from './data';
2
+ export default abstract class DataManager {
3
+ wellbores: {
4
+ [key: number]: WellboreData;
5
+ };
6
+ roots: {
7
+ [key: number]: RootData;
8
+ };
9
+ /** Map group keys ('Drilled', 'Planned', etc.) to keys in wellbores dictionary. */
10
+ groups: {
11
+ [key: string]: Group;
12
+ };
13
+ addWellbore(_key: number, _data: SourceData): void;
14
+ removeWellbore(_key: number): void;
15
+ }
@@ -1,4 +1,4 @@
1
- import { WellboreData, RootData } from "./data";
1
+ import { WellboreData, RootData } from './data';
2
2
  export declare class Highlight {
3
3
  active: boolean;
4
4
  root: RootData;
@@ -0,0 +1,9 @@
1
+ /** Enum for dividing labels into three groups. */
2
+ export declare enum LabelType {
3
+ /** Labels attached to wellbores. */
4
+ Wellbore = 0,
5
+ /** Multiple wellbore-labels or under root. */
6
+ Multi = 1,
7
+ /** Single label under root. */
8
+ Single = 2
9
+ }
@@ -1,5 +1,5 @@
1
1
  import Vector2 from '@equinor/videx-vector2';
2
- declare type projectFunction = (coord: [number, number], zoom?: number) => {
2
+ type projectFunction = (coord: [number, number], zoom?: number) => {
3
3
  x: number;
4
4
  y: number;
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { WellboreData } from './data/WellboreData';
2
2
  import { pixiOverlayBase } from '../../pixiOverlayInterfaces';
3
- declare type vec2 = [number, number];
3
+ type vec2 = [number, number];
4
4
  /** Class for handling realtime position of wellbore. */
5
5
  export default class RealtimeWellbore {
6
6
  private map;
@@ -1,6 +1,6 @@
1
1
  import * as PIXI from 'pixi.js';
2
2
  import { Color } from './Colors';
3
- declare type vec3 = [number, number, number];
3
+ type vec3 = [number, number, number];
4
4
  /** Uniforms used by the shader. */
5
5
  export interface WellboreUniforms {
6
6
  /** Color of lighted wellbore on the format: [R, G, B]. */
@@ -29,6 +29,7 @@ export interface RootUniforms {
29
29
  active: boolean;
30
30
  circleColor1: [number, number, number];
31
31
  circleColor2: [number, number, number];
32
+ rootRadius: number;
32
33
  }
33
34
  export declare class RootShader {
34
35
  private static program;
@@ -10,7 +10,7 @@ interface WellboreState {
10
10
  completionVisible: boolean;
11
11
  wellboreVisible: boolean;
12
12
  }
13
- declare type Filter = (data: SourceData) => boolean;
13
+ type Filter = (data: SourceData) => boolean;
14
14
  export declare class Group {
15
15
  key: string;
16
16
  colors: Colors;
@@ -1,5 +1,6 @@
1
- import { WellboreData } from './WellboreData';
1
+ import * as PIXI from 'pixi.js';
2
2
  import Vector2 from '@equinor/videx-vector2';
3
+ import { WellboreData } from './WellboreData';
3
4
  export declare class RootData {
4
5
  mesh: PIXI.Mesh;
5
6
  wellbores: WellboreData[];
@@ -0,0 +1,25 @@
1
+ /** Date for each interval. */
2
+ export interface Interval {
3
+ /** Type of interval [Screen, Perforation]. */
4
+ type: string;
5
+ /** Start of interval as distance along wellbore. */
6
+ start: number;
7
+ /** End of interval as distance along wellbore. */
8
+ end: number;
9
+ /** Start of interval along wellbore as a value between 0 and 1. */
10
+ l1: number;
11
+ /** End of interval along wellbore as a value between 0 and 1. */
12
+ l2: number;
13
+ }
14
+ /** Wellbore data. */
15
+ export interface SourceData {
16
+ [key: string]: any;
17
+ /** Collection of intervals. */
18
+ intervals: Interval[];
19
+ /** Full label of wellbore. */
20
+ label: string;
21
+ /** Short label of wellbore, ie. no country code. */
22
+ labelShort: string;
23
+ /** Path along wellbore on lat/long format. */
24
+ path: [number, number][];
25
+ }
@@ -32,6 +32,10 @@ export declare enum FilterStatus {
32
32
  hard = 2
33
33
  }
34
34
  export declare class WellboreData {
35
+ static state: {
36
+ wellboreRadius: number;
37
+ rootRadius: number;
38
+ };
35
39
  data: SourceData;
36
40
  group: Group;
37
41
  wellboreWidth: number;
@@ -1,5 +1,5 @@
1
- import { SourceData } from "./SourceData";
2
- import { WellboreData } from "./WellboreData";
1
+ import { SourceData } from './SourceData';
2
+ import { WellboreData } from './WellboreData';
3
3
  export declare class WellboreEventData {
4
4
  group: string;
5
5
  data: SourceData;
@@ -1,6 +1,6 @@
1
- import { WellboreData, HighlightEvent } from "./data";
2
- import Vector2 from "@equinor/videx-vector2";
3
- import WellboreModule from "../../WellboreModule";
1
+ import Vector2 from '@equinor/videx-vector2';
2
+ import { WellboreData, HighlightEvent } from './data';
3
+ import WellboreModule from '../../WellboreModule';
4
4
  export declare function updateHighlighted(module: WellboreModule, pos: Vector2, onHighlightOn?: (event: HighlightEvent) => void, onHighlightOff?: () => void, originalEvent?: any): void;
5
5
  export declare function forceHighlight(module: WellboreModule, wellbore: WellboreData): void;
6
6
  export declare function clearHighlight(module: WellboreModule, onHighlightOff?: () => void): void;
@@ -1,3 +1,3 @@
1
- import { WellboreData } from "../data";
1
+ import { WellboreData } from '../data';
2
2
  export declare function positionAtRoot(wellbore: WellboreData, position: number): void;
3
3
  export declare function positionAlongWellbore(wellbore: WellboreData): void;
@@ -0,0 +1,23 @@
1
+ type Callback = (wellboreId: number) => void;
2
+ export declare class CallbackRegistry {
3
+ /** Internal callback register. */
4
+ registry: {
5
+ [key: string]: Callback;
6
+ };
7
+ /** Can map multiple strings to same callback. */
8
+ map: {
9
+ [key: string]: Callback;
10
+ };
11
+ constructor();
12
+ /** Register callback */
13
+ register(key: string, callback: Callback): void;
14
+ /**
15
+ * Used to map key given as first parameter in 'WellboreModule' with a callback in internal registy.
16
+ * If key is blank, will try to retrieve 'setKey' from registry. Else key will map to default callback.
17
+ * @param setKey Key to map to registry.
18
+ * @param key Key in registry.
19
+ */
20
+ mapKey(setKey: string, key?: string): void;
21
+ get(setKey?: string): Callback;
22
+ }
23
+ export {};
@@ -0,0 +1,22 @@
1
+ import { Colors } from '../Colors';
2
+ export declare class ColorRegistry {
3
+ /** Internal color register. */
4
+ registry: {
5
+ [key: string]: Colors;
6
+ };
7
+ /** Can map multiple strings to same instance in registry. */
8
+ map: {
9
+ [key: string]: Colors;
10
+ };
11
+ constructor();
12
+ /** Color collection */
13
+ register(key: string, colors: Colors): void;
14
+ /**
15
+ * Used to map key given as first parameter in 'WellboreModule' with a color collection in internal registy.
16
+ * If key is blank, will try to retrieve 'setKey' from registry. Else key will map to default color configurations.
17
+ * @param setKey Key to map to registry.
18
+ * @param key Key in registry.
19
+ */
20
+ mapKey(setKey: string, key?: string): void;
21
+ get(setKey?: string): Colors;
22
+ }
@@ -0,0 +1,2 @@
1
+ export { ColorRegistry } from './ColorRegistry';
2
+ export { CallbackRegistry } from './CallbackRegistry';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/videx-map",
3
- "version": "1.12.5",
3
+ "version": "1.13.0-beta.1",
4
4
  "description": "Component for Pixi-overlay in Leaflet.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -17,9 +17,14 @@
17
17
  "pub": "npm publish --access=public",
18
18
  "test": "jest",
19
19
  "test:watch": "jest --watchAll",
20
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx src --color",
21
+ "lint:ci": "eslint --ext .js,.jsx,.ts,.tsx src --color --format table --quiet",
22
+ "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx src --fix",
20
23
  "predocs": "rimraf docs",
21
24
  "docs": "typedoc --out docs src",
22
- "postdocs": "copyfiles images/* docs && copyfiles .nojekyll docs"
25
+ "postdocs": "copyfiles images/* docs && copyfiles .nojekyll docs",
26
+ "lint-staged": "lint-staged",
27
+ "prepare": "husky install"
23
28
  },
24
29
  "repository": {
25
30
  "type": "git",
@@ -47,17 +52,17 @@
47
52
  "@types/jest": "^26.0.13",
48
53
  "@types/leaflet": "^1.5.17",
49
54
  "@types/uuid": "^8.3.0",
50
- "awesome-typescript-loader": "^5.2.1",
55
+ "@typescript-eslint/eslint-plugin": "^5.46.1",
56
+ "@typescript-eslint/parser": "^5.46.1",
51
57
  "babel-loader": "^8.1.0",
52
58
  "copyfiles": "^2.3.0",
53
- "d3": "^6.1.1",
54
- "eslint": "^7.8.1",
55
- "eslint-config-airbnb-base": "^14.2.0",
56
- "eslint-plugin-import": "^2.22.0",
59
+ "eslint-formatter-table": "^7.32.1",
60
+ "husky": "^8.0.3",
57
61
  "jest": "^26.4.2",
58
62
  "jest-canvas-mock": "^2.2.0",
59
63
  "leaflet": "^1.7.1",
60
- "leaflet-pixi-overlay": "^1.8.1",
64
+ "leaflet-pixi-overlay": "^1.8.2",
65
+ "lint-staged": "^11.1.2",
61
66
  "rimraf": "^3.0.2",
62
67
  "rollup": "^2.45.2",
63
68
  "rollup-plugin-node-resolve": "^5.2.0",
@@ -65,9 +70,10 @@
65
70
  "rollup-plugin-typescript2": "^0.30.0",
66
71
  "simplex-noise": "^2.4.0",
67
72
  "ts-jest": "^26.3.0",
68
- "tslib": "^2.2.0",
69
- "typedoc": "^0.20.28",
70
- "typescript": "^4.2.4"
73
+ "ts-loader": "^9.4.2",
74
+ "tslib": "^2.4.1",
75
+ "typedoc": "^0.23.23",
76
+ "typescript": "^4.9.4"
71
77
  },
72
78
  "jest": {
73
79
  "transform": {
@@ -78,12 +84,18 @@
78
84
  "jest-canvas-mock"
79
85
  ]
80
86
  },
87
+ "lint-staged": {
88
+ "*.ts": [
89
+ "npm run lint:ci"
90
+ ]
91
+ },
81
92
  "dependencies": {
82
93
  "@equinor/videx-linear-algebra": "^1.0.7",
83
94
  "@equinor/videx-math": "^1.1.0",
84
95
  "@equinor/videx-vector2": "^1.0.44",
96
+ "d3-color": "^3.1.0",
85
97
  "earcut": "^2.2.2",
86
- "pixi.js": "5.3.3",
98
+ "pixi.js": "^7.1.2",
87
99
  "uuid": "^8.3.2"
88
100
  }
89
101
  }