Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TM-905] Update map instance #244

Merged
merged 9 commits into from
Jun 10, 2024
Merged
59 changes: 59 additions & 0 deletions src/components/elements/Map-mapbox/GeoJSON.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export as namespace GeoJSON;
export type GeoJsonGeometryTypes = Geometry["type"];

export type GeoJsonTypes = GeoJSON["type"];

export type BBox = [number, number, number, number];

export type Position = number[];

export interface GeoJsonObject {
type: GeoJsonTypes;
bbox?: BBox | undefined;
}
export type GeoJSON = Geometry | Feature | FeatureCollection;
export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
export type GeometryObject = Geometry;

export interface Point extends GeoJsonObject {
type: "Point";
coordinates: Position;
}

export interface MultiPoint extends GeoJsonObject {
type: "MultiPoint";
coordinates: Position[];
}

export interface LineString extends GeoJsonObject {
type: "LineString";
coordinates: Position[];
}

export interface MultiLineString extends GeoJsonObject {
type: "MultiLineString";
coordinates: Position[][];
}
export interface Polygon extends GeoJsonObject {
type: "Polygon";
coordinates: Position[][];
}

export interface MultiPolygon extends GeoJsonObject {
type: "MultiPolygon";
coordinates: Position[][][];
}

export type GeoJsonProperties = { [name: string]: unknown } | null;

export interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
type: "Feature";
geometry: G;
id?: string | number | undefined;
properties: P;
}

export interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
type: "FeatureCollection";
features: Array<Feature<G, P>>;
}
14 changes: 14 additions & 0 deletions src/components/elements/Map-mapbox/Map.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import mapboxgl, { FillLayer, LineLayer } from "mapbox-gl";

type LayerStyle = Pick<mapboxgl.Style, "metadata"> & (FillLayer | LineLayer);

export type LayerWithStyle = LayerStyle;

export interface LayerType {
name: string;
styles: LayerWithStyle[];
}

export type ControlType = Control | IControl;

export type TooltipType = "edit" | "goTo" | "view";
Loading