Skip to content

Commit

Permalink
Feature/coordinate search (#70, #355)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Pia Melina Rolf <[email protected]>
Co-authored-by: Matheisen, Alexander <[email protected]>
Co-authored-by: Antonia van Eek <[email protected]>
Co-authored-by: Michael Beckemeyer <[email protected]>
  • Loading branch information
5 people authored Dec 5, 2024
1 parent 7a5f1e1 commit b1d253e
Show file tree
Hide file tree
Showing 34 changed files with 2,998 additions and 28 deletions.
42 changes: 21 additions & 21 deletions .changeset/eighty-peaches-learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
"@open-pioneer/map": minor
---

- **Breaking:** Remove most events from the map model and the layer interfaces.
All events that were merely used to synchronized state (e.g. `changed:title` etc.) have been removed.
**Breaking:** Remove most events from the map model and the layer interfaces.
All events that were merely used to synchronized state (e.g. `changed:title` etc.) have been removed.

The map model and related objects (layers, layer collections, etc.) are now based on the [Reactivity API](https://github.com/conterra/reactivity/blob/main/packages/reactivity-core/README.md).
This change greatly simplifies the code that is necessary to access up-to-date values and to react to changes.
The map model and related objects (layers, layer collections, etc.) are now based on the [Reactivity API](https://github.com/conterra/reactivity/blob/main/packages/reactivity-core/README.md).
This change greatly simplifies the code that is necessary to access up-to-date values and to react to changes.

For example, from inside a React component, you can now write:
For example, from inside a React component, you can now write:

```jsx
import { useReactiveSnapshot } from "@open-pioneer/reactivity";
```jsx
import { useReactiveSnapshot } from "@open-pioneer/reactivity";

function YourComponent() {
function YourComponent() {
// Always up to date, even if the layer's title changes.
// No more need to listen to events.
const title = useReactiveSnapshot(() => layer.title, [layer]);
return <div>{title}</div>;
}
```
}
```

And inside a normal JavaScript function, you can watch for changes like this:
And inside a normal JavaScript function, you can watch for changes like this:

```js
import { watch } from "@conterra/reactivity-core";
```js
import { watch } from "@conterra/reactivity-core";

const watchHandle = watch(
const watchHandle = watch(
() => [layer.title],
([newTitle]) => {
console.log("The title changed to", newTitle);
},
);
console.log("The title changed to", newTitle);
}
);

// Later, cleanup:
watchHandle.destroy();
```
// Later, cleanup:
watchHandle.destroy();
```

For more details, check the [Reactivity API documentation](https://github.com/conterra/reactivity/blob/main/packages/reactivity-core/README.md).
For more details, check the [Reactivity API documentation](https://github.com/conterra/reactivity/blob/main/packages/reactivity-core/README.md).
13 changes: 13 additions & 0 deletions .changeset/red-rice-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@open-pioneer/coordinate-search": minor
---

Added new component CoordinateSearch with functionality to search for coordinates via input. Additionally added component CoordinateInput that allows the user to input coordinates manually and validates the input.

```tsx
<CoordinateSearch mapId="map_id" />
```

```tsx
<CoordinateInput mapId="map_id" />
```
2 changes: 1 addition & 1 deletion .changeset/selfish-squids-travel.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Add new layer type `GroupLayer` to to the Map API.

A `GroupLayer` contains a list of `Layer` (e.g. `SimpleLayer` or `WMSLayer`). Because `GroupLayer` is a `Layer` as well nested groups are supported.
The child layers of a `GroupLayer` can be accessed with the `layers` property - `layers` is `undefined` if it is not a group.
The parent `GroupLayer` of a child layer can be accessed with the `parent` property - `parent` is `undefined` if this layer is not part of a group (or not a sublayer).
The parent `GroupLayer` of a child layer can be accessed with the `parent` property - `parent` is `undefined` if this layer is not part of a group (or not a sublayer).

```js
const olLayer1 = new TileLayer({
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ This repository publishes the following packages:
| Name | Version |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| [@open-pioneer/basemap-switcher](./src/packages/basemap-switcher/) | [![NPM Version](https://img.shields.io/npm/v/%40open-pioneer%2Fbasemap-switcher)](https://www.npmjs.com/package/@open-pioneer/basemap-switcher) |
| [@open-pioneer/coordinate-search](./src/packages/coordinate-search/) | [![NPM Version](https://img.shields.io/npm/v/%40open-pioneer%2Fcoordinate-search)](https://www.npmjs.com/package/@open-pioneer/coordinate-search) |
| [@open-pioneer/coordinate-viewer](./src/packages/coordinate-viewer/) | [![NPM Version](https://img.shields.io/npm/v/%40open-pioneer%2Fcoordinate-viewer)](https://www.npmjs.com/package/@open-pioneer/coordinate-viewer) |
| [@open-pioneer/editing](./src/packages/editing/) | [![NPM Version](https://img.shields.io/npm/v/%40open-pioneer%2Fediting)](https://www.npmjs.com/package/@open-pioneer/editing) |
| [@open-pioneer/geolocation](./src/packages/geolocation/) | [![NPM Version](https://img.shields.io/npm/v/%40open-pioneer%2Fgeolocation)](https://www.npmjs.com/package/@open-pioneer/geolocation) |
Expand Down
69 changes: 68 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/packages/coordinate-search/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @open-pioneer/coordinate-search
Loading

0 comments on commit b1d253e

Please sign in to comment.