aur-openlayers 1.0.4 → 19.6.3
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/README.md +63 -63
- package/fesm2022/aur-openlayers.mjs +65 -37
- package/fesm2022/aur-openlayers.mjs.map +1 -1
- package/lib/map-framework/public/types.d.ts +9 -0
- package/lib/map-framework/runtime/fit-layer.utils.d.ts +2 -1
- package/lib/map-framework/runtime/vector-layer-base.d.ts +1 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
# Lib
|
|
2
|
-
|
|
3
|
-
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
ng generate component component-name
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
ng generate --help
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Building
|
|
20
|
-
|
|
21
|
-
To build the library, run:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
ng build lib
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
-
|
|
29
|
-
### Publishing the Library
|
|
30
|
-
|
|
31
|
-
Once the project is built, you can publish your library by following these steps:
|
|
32
|
-
|
|
33
|
-
1. Navigate to the `dist` directory:
|
|
34
|
-
```bash
|
|
35
|
-
cd dist/lib
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
-
```bash
|
|
40
|
-
npm publish
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Running unit tests
|
|
44
|
-
|
|
45
|
-
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
ng test
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Running end-to-end tests
|
|
52
|
-
|
|
53
|
-
For end-to-end (e2e) testing, run:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
ng e2e
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
-
|
|
61
|
-
## Additional Resources
|
|
62
|
-
|
|
63
|
-
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
1
|
+
# Lib
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build lib
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/lib
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -3,12 +3,12 @@ import { Injectable, Component } from '@angular/core';
|
|
|
3
3
|
import VectorLayer from 'ol/layer/Vector';
|
|
4
4
|
import ClusterSource from 'ol/source/Cluster';
|
|
5
5
|
import VectorSource from 'ol/source/Vector';
|
|
6
|
+
import { createEmpty, extend, isEmpty } from 'ol/extent';
|
|
6
7
|
import Feature from 'ol/Feature';
|
|
7
8
|
import Collection from 'ol/Collection';
|
|
8
9
|
import DragPan from 'ol/interaction/DragPan';
|
|
9
10
|
import Modify from 'ol/interaction/Modify';
|
|
10
11
|
import * as Observable from 'ol/Observable';
|
|
11
|
-
import { createEmpty, extend, isEmpty } from 'ol/extent';
|
|
12
12
|
|
|
13
13
|
class LibService {
|
|
14
14
|
constructor() { }
|
|
@@ -24,18 +24,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
24
24
|
|
|
25
25
|
class LibComponent {
|
|
26
26
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: LibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
27
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: LibComponent, isStandalone: true, selector: "lib-lib", ngImport: i0, template: `
|
|
28
|
-
<p>
|
|
29
|
-
lib works!
|
|
30
|
-
</p>
|
|
27
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: LibComponent, isStandalone: true, selector: "lib-lib", ngImport: i0, template: `
|
|
28
|
+
<p>
|
|
29
|
+
lib works!
|
|
30
|
+
</p>
|
|
31
31
|
`, isInline: true, styles: [""] });
|
|
32
32
|
}
|
|
33
33
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: LibComponent, decorators: [{
|
|
34
34
|
type: Component,
|
|
35
|
-
args: [{ selector: 'lib-lib', imports: [], template: `
|
|
36
|
-
<p>
|
|
37
|
-
lib works!
|
|
38
|
-
</p>
|
|
35
|
+
args: [{ selector: 'lib-lib', imports: [], template: `
|
|
36
|
+
<p>
|
|
37
|
+
lib works!
|
|
38
|
+
</p>
|
|
39
39
|
` }]
|
|
40
40
|
}] });
|
|
41
41
|
|
|
@@ -161,34 +161,6 @@ class FlushScheduler {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
const createMapContext = (map, layers, popupHost, scheduler = new FlushScheduler()) => {
|
|
165
|
-
return {
|
|
166
|
-
map,
|
|
167
|
-
layers,
|
|
168
|
-
popupHost,
|
|
169
|
-
batch: (fn, options) => scheduler.batch(fn, options),
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const CLUSTER_FEATURES_KEY = 'features';
|
|
174
|
-
const getClusterFeatures = (feature) => {
|
|
175
|
-
const features = feature.get(CLUSTER_FEATURES_KEY);
|
|
176
|
-
if (!Array.isArray(features)) {
|
|
177
|
-
return null;
|
|
178
|
-
}
|
|
179
|
-
const items = features.filter((item) => {
|
|
180
|
-
if (!item || typeof item !== 'object') {
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
const candidate = item;
|
|
184
|
-
return typeof candidate.get === 'function' && typeof candidate.getGeometry === 'function';
|
|
185
|
-
});
|
|
186
|
-
if (items.length === 0) {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
return items;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
164
|
/**
|
|
193
165
|
* Default padding for View#fit in pixels.
|
|
194
166
|
* Order: [top, right, bottom, left]
|
|
@@ -218,6 +190,58 @@ function toOlFitOptions(opts) {
|
|
|
218
190
|
}
|
|
219
191
|
return fitOpts;
|
|
220
192
|
}
|
|
193
|
+
function collectLayersExtent(layers, layerIds) {
|
|
194
|
+
const extent = createEmpty();
|
|
195
|
+
const ids = layerIds ?? Object.keys(layers);
|
|
196
|
+
for (const id of ids) {
|
|
197
|
+
const layer = layers[id];
|
|
198
|
+
if (!layer || !layer.isVisible())
|
|
199
|
+
continue;
|
|
200
|
+
const layerExtent = layer.getExtent();
|
|
201
|
+
if (layerExtent) {
|
|
202
|
+
extend(extent, layerExtent);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return isEmpty(extent) ? null : extent;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const createMapContext = (map, layers, popupHost, scheduler = new FlushScheduler()) => {
|
|
209
|
+
return {
|
|
210
|
+
map,
|
|
211
|
+
layers,
|
|
212
|
+
popupHost,
|
|
213
|
+
batch: (fn, options) => scheduler.batch(fn, options),
|
|
214
|
+
centerOnAllLayers: (opts) => {
|
|
215
|
+
const extent = collectLayersExtent(layers);
|
|
216
|
+
if (extent)
|
|
217
|
+
map.getView().fit(extent, toOlFitOptions(opts));
|
|
218
|
+
},
|
|
219
|
+
centerOnLayers: (layerIds, opts) => {
|
|
220
|
+
const extent = collectLayersExtent(layers, layerIds);
|
|
221
|
+
if (extent)
|
|
222
|
+
map.getView().fit(extent, toOlFitOptions(opts));
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const CLUSTER_FEATURES_KEY = 'features';
|
|
228
|
+
const getClusterFeatures = (feature) => {
|
|
229
|
+
const features = feature.get(CLUSTER_FEATURES_KEY);
|
|
230
|
+
if (!Array.isArray(features)) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
const items = features.filter((item) => {
|
|
234
|
+
if (!item || typeof item !== 'object') {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
const candidate = item;
|
|
238
|
+
return typeof candidate.get === 'function' && typeof candidate.getGeometry === 'function';
|
|
239
|
+
});
|
|
240
|
+
if (items.length === 0) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
return items;
|
|
244
|
+
};
|
|
221
245
|
|
|
222
246
|
const STATES_KEY = '__mff_states__';
|
|
223
247
|
const getFeatureStates = (feature) => {
|
|
@@ -1893,6 +1917,10 @@ class VectorLayerBase {
|
|
|
1893
1917
|
}
|
|
1894
1918
|
this.ctx.map.getView().fit(extent, toOlFitOptions(opts));
|
|
1895
1919
|
}
|
|
1920
|
+
getExtent() {
|
|
1921
|
+
const extent = this.source.getExtent();
|
|
1922
|
+
return isEmpty(extent) ? null : extent;
|
|
1923
|
+
}
|
|
1896
1924
|
setVisible(visible) {
|
|
1897
1925
|
this.layer.setVisible(visible);
|
|
1898
1926
|
}
|