Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
Create layer interface to abstract common properties.

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
  • Loading branch information
VijayanB committed Feb 3, 2023
1 parent 224f397 commit 1e8400f
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions public/model/map/layer_operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@ export const updateLayerVisibility = (map: Maplibre, layerId: string, visibility
});
};

export interface LineLayerSpecification {
// Common properties that every DashboardMap layer contains
interface Layer {
sourceId: string;
visibility: string;
color: string;
opacity: number;
width: number;
minZoom: number;
maxZoom: number;
}

export interface LineLayerSpecification extends Layer {
visibility: string;
color: string;
width: number;
}

export const addLineLayer = (
map: Maplibre,
specification: LineLayerSpecification,
Expand Down Expand Up @@ -90,16 +94,12 @@ export const updateLineLayer = (
return lineLayerId;
};

export interface CircleLayerSpecification {
sourceId: string;
export interface CircleLayerSpecification extends Layer {
visibility: string;
fillColor: string;
outlineColor: string;
radius: number;
opacity: number;
width: number;
minZoom: number;
maxZoom: number;
}

export const addCircleLayer = (
Expand Down Expand Up @@ -137,15 +137,11 @@ export const updateCircleLayer = (
return circleLayerId;
};

export interface PolygonLayerSpecification {
sourceId: string;
export interface PolygonLayerSpecification extends Layer {
visibility: string;
fillColor: string;
outlineColor: string;
opacity: number;
width: number;
minZoom: number;
maxZoom: number;
}

export const addPolygonLayer = (
Expand Down

0 comments on commit 1e8400f

Please sign in to comment.