terra-draw 0.0.1-alpha.31 → 0.0.1-alpha.33

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.1-alpha.33](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.32...v0.0.1-alpha.33) (2023-06-04)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * improve performance of mapbox gl/maplibre gl adapter ([67082af](https://github.com/JamesLMilner/terra-draw/commit/67082af096cf1b1d5a0426f7db651122fb897b49))
11
+
12
+ ### [0.0.1-alpha.32](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.31...v0.0.1-alpha.32) (2023-06-04)
13
+
14
+
15
+ ### Features
16
+
17
+ * add the addFeatures method to allow adding of external data ([b6e0043](https://github.com/JamesLMilner/terra-draw/commit/b6e004377f1baff78e01f9324413469677f2df5b))
18
+
19
+
20
+ ### Chore
21
+
22
+ * update docs ([36997cc](https://github.com/JamesLMilner/terra-draw/commit/36997cc7c7071af1af1a27ad457cab0361f3e5e9))
23
+
5
24
  ### [0.0.1-alpha.31](https://github.com/JamesLMilner/terra-draw/compare/v0.0.1-alpha.30...v0.0.1-alpha.31) (2023-05-22)
6
25
 
7
26
 
@@ -6,6 +6,7 @@ export declare class TerraDrawMapboxGLAdapter extends TerraDrawBaseAdapter {
6
6
  map: mapboxgl.Map;
7
7
  coordinatePrecision?: number;
8
8
  });
9
+ private _nextRender;
9
10
  private _map;
10
11
  private _container;
11
12
  private _rendered;
@@ -0,0 +1,4 @@
1
+ export declare function validLatitude(lat: number): boolean;
2
+ export declare function validLongitude(lng: number): boolean;
3
+ export declare function coordinateIsValid(coordinate: unknown[], coordinatePrecision: number): boolean;
4
+ export declare function getDecimalPlaces(value: number): number;
@@ -0,0 +1,2 @@
1
+ import { GeoJSONStoreFeatures } from "../../terra-draw";
2
+ export declare function isValidLineStringFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
@@ -0,0 +1,2 @@
1
+ import { GeoJSONStoreFeatures } from "../../terra-draw";
2
+ export declare function isValidPoint(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
@@ -0,0 +1,3 @@
1
+ import { GeoJSONStoreFeatures } from "../../terra-draw";
2
+ export declare function isValidPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
3
+ export declare function isValidNonIntersectingPolygonFeature(feature: GeoJSONStoreFeatures, coordinatePrecision: number): boolean;
@@ -29,6 +29,7 @@ export declare abstract class TerraDrawBaseDrawMode<T extends CustomStyling> {
29
29
  protected setStarted(): void;
30
30
  protected setStopped(): void;
31
31
  register(config: TerraDrawModeRegisterConfig): void;
32
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
32
33
  abstract start(): void;
33
34
  abstract stop(): void;
34
35
  abstract cleanUp(): void;
@@ -44,5 +44,6 @@ export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<FreehandP
44
44
  cleanUp(): void;
45
45
  /** @internal */
46
46
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
47
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
47
48
  }
48
49
  export {};
@@ -50,5 +50,6 @@ export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<Freehan
50
50
  cleanUp(): void;
51
51
  /** @internal */
52
52
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
53
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
53
54
  }
54
55
  export {};
@@ -53,5 +53,6 @@ export declare class TerraDrawGreatCircleMode extends TerraDrawBaseDrawMode<Grea
53
53
  cleanUp(): void;
54
54
  /** @internal */
55
55
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
56
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
56
57
  }
57
58
  export {};
@@ -56,5 +56,6 @@ export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineS
56
56
  cleanUp(): void;
57
57
  /** @internal */
58
58
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
59
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
59
60
  }
60
61
  export {};
@@ -34,5 +34,6 @@ export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeS
34
34
  onDragEnd(): void;
35
35
  /** @internal */
36
36
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
37
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
37
38
  }
38
39
  export {};
@@ -59,5 +59,6 @@ export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonS
59
59
  cleanUp(): void;
60
60
  /** @internal */
61
61
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
62
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
62
63
  }
63
64
  export {};
@@ -45,5 +45,6 @@ export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<Rectan
45
45
  cleanUp(): void;
46
46
  /** @internal */
47
47
  styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
48
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
48
49
  }
49
50
  export {};
@@ -1,6 +1,7 @@
1
1
  import { TerraDrawAdapterStyling } from "../../common";
2
2
  import { TerraDrawBaseDrawMode } from "../base.mode";
3
3
  import { BehaviorConfig } from "../base.behavior";
4
+ import { GeoJSONStoreFeatures } from "../../terra-draw";
4
5
  type RenderModeStylingExt<T extends TerraDrawAdapterStyling> = {};
5
6
  type RenderModeStyling = RenderModeStylingExt<TerraDrawAdapterStyling>;
6
7
  export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
@@ -32,5 +33,6 @@ export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderMod
32
33
  cleanUp(): void;
33
34
  /** @internal */
34
35
  styleFeature(): TerraDrawAdapterStyling;
36
+ validateFeature(feature: unknown): feature is GeoJSONStoreFeatures;
35
37
  }
36
38
  export {};
@@ -0,0 +1,15 @@
1
+ import { GeoJSONStoreFeatures } from "./store";
2
+ export declare const StoreValidationErrors: {
3
+ readonly FeatureHasNoId: "Feature has no id";
4
+ readonly FeatureIsNotObject: "Feature is not object";
5
+ readonly InvalidTrackedProperties: "updatedAt and createdAt are not valid timestamps";
6
+ readonly FeatureHasNoMode: "Feature does not have a set mode";
7
+ readonly FeatureIdIsNotUUID4: "Feature must have UUID4 id";
8
+ readonly FeatureHasNoGeometry: "Feature has no geometry";
9
+ readonly FeatureHasNoProperties: "Feature has no properties";
10
+ readonly FeatureGeometryNotSupported: "Feature is not Point, LineString or Polygon";
11
+ readonly FeatureCoordinatesNotAnArray: "Feature coordinates is not an array";
12
+ readonly InvalidModeProperty: "Feature does not have a valid mode property";
13
+ };
14
+ export declare function isValidTimestamp(timestamp: unknown): boolean;
15
+ export declare function isValidStoreFeature(feature: unknown): feature is GeoJSONStoreFeatures;
@@ -11,9 +11,7 @@ export type GeoJSONStoreFeatures = Feature<GeoJSONStoreGeometries, DefinedProper
11
11
  export type StoreChangeEvents = "delete" | "create" | "update" | "styling";
12
12
  export type StoreChangeHandler = (ids: string[], change: StoreChangeEvents) => void;
13
13
  export type GeoJSONStoreConfig = {
14
- data?: GeoJSONStoreFeatures[];
15
14
  tracked?: boolean;
16
- validateFeature?: (feature: unknown, tracked?: boolean) => void;
17
15
  };
18
16
  export declare class GeoJSONStore {
19
17
  constructor(config?: GeoJSONStoreConfig);
@@ -24,7 +22,7 @@ export declare class GeoJSONStore {
24
22
  private getId;
25
23
  private clone;
26
24
  has(id: string): boolean;
27
- load(data: GeoJSONStoreFeatures[], featureValidation?: (feature: unknown, tracked?: boolean) => void): void;
25
+ load(data: GeoJSONStoreFeatures[], featureValidation?: (feature: unknown, tracked?: boolean) => boolean): void;
28
26
  search(bbox: BBoxPolygon, filter?: (feature: GeoJSONStoreFeatures) => boolean): GeoJSONStoreFeatures[];
29
27
  registerOnChange(onChange: StoreChangeHandler): void;
30
28
  getGeometryCopy<T extends GeoJSONStoreGeometries>(id: string): T;