Skip to content

Commit

Permalink
test: add OpenLayers adapter unit tests (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesLMilner authored Sep 22, 2024
1 parent 6168265 commit 8436939
Show file tree
Hide file tree
Showing 4 changed files with 826 additions and 77 deletions.
15 changes: 7 additions & 8 deletions development/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ import {
import { TerraDrawRenderMode } from "../../src/modes/render/render.mode";
import { ValidateNotSelfIntersecting } from "../../src/validations/not-self-intersecting.validation";

import Circle from "ol/geom/Circle";
import Feature from "ol/Feature";
import GeoJSON from "ol/format/GeoJSON";
import Map from "ol/Map";
import { TerraDrawOpenLayersAdapter } from "../../src/adapters/openlayers.adapter";
import View from "ol/View";
import { Circle as CircleStyle, Stroke, Style } from "ol/style";
import { Circle, Fill, Stroke, Style } from "ol/style";
import { OSM, Vector as VectorSource } from "ol/source";
import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer";
import { fromLonLat, getUserProjection } from "ol/proj";
Expand Down Expand Up @@ -188,10 +187,10 @@ const getModes = () => {
};

const currentSelected: { button: undefined | HTMLButtonElement; mode: string } =
{
button: undefined,
mode: "static",
};
{
button: undefined,
mode: "static",
};

// Used by both Mapbox and MapLibre
const OSMStyle = {
Expand Down Expand Up @@ -393,15 +392,15 @@ const example = {
const draw = new TerraDraw({
adapter: new TerraDrawOpenLayersAdapter({
lib: {
Circle,
Feature,
GeoJSON,
Style,
VectorLayer,
VectorSource,
Stroke,
CircleStyle,
getUserProjection,
Circle,
Fill,
},
map,
coordinatePrecision: 9,
Expand Down
21 changes: 10 additions & 11 deletions guides/3.ADAPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,11 @@ import {
TerraDrawOpenLayersAdapter,
} from "terra-draw";

import Circle from "ol/geom/Circle";
import Feature from "ol/Feature";
import GeoJSON from "ol/format/GeoJSON";
import Map from "ol/Map";
import View from "ol/View";
import { Circle as CircleStyle, Stroke, Style } from "ol/style";
import { Circle, Stroke, Style } from "ol/style";
import { OSM, Vector as VectorSource } from "ol/source";
import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer";
import { fromLonLat, getUserProjection } from "ol/proj";
Expand All @@ -290,15 +289,15 @@ map.once("postrender", () => {
const draw = new TerraDraw({
adapter: new TerraDrawOpenLayersAdapter({
lib: {
Circle,
Feature,
GeoJSON,
Style,
VectorLayer,
VectorSource,
Stroke,
CircleStyle,
getUserProjection,
Feature,
GeoJSON,
Style,
VectorLayer,
VectorSource,
Stroke,
getUserProjection,
Circle,
Fill,
},
map,
coordinatePrecision: 9,
Expand Down
Loading

0 comments on commit 8436939

Please sign in to comment.