geonetwork-ui 2.7.0-dev.b9840dab3 → 2.7.0-dev.c5e7f06ca
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/esm2022/libs/api/metadata-converter/src/lib/dcat-ap/read-parts.mjs +4 -7
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +20 -20
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/metadata-url.service.mjs +3 -3
- package/esm2022/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.mjs +3 -3
- package/esm2022/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.mjs +3 -3
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/read-parts.mjs +4 -4
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +5 -5
- package/esm2022/libs/api/repository/src/index.mjs +2 -2
- package/esm2022/libs/api/repository/src/lib/gn4/auth/auth.service.mjs +5 -5
- package/esm2022/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.mjs +55 -12
- package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +3 -3
- package/esm2022/libs/api/repository/src/lib/gn4/organizations/organizations-from-groups.service.mjs +3 -3
- package/esm2022/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.mjs +3 -3
- package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +21 -21
- package/esm2022/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.mjs +3 -1
- package/esm2022/libs/api/repository/src/lib/metadata-language.token.mjs +3 -0
- package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +11 -1
- package/esm2022/libs/common/domain/src/lib/platform.service.interface.mjs +1 -1
- package/esm2022/libs/feature/catalog/src/lib/sources/sources.service.mjs +3 -3
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-inspire-field/form-field-inspire-theme.component.mjs +55 -0
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +8 -3
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/index.mjs +2 -1
- package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +77 -1
- package/esm2022/libs/feature/map/src/lib/utils/map-utils.service.mjs +3 -5
- package/esm2022/libs/feature/router/src/lib/default/state/query-params.utils.mjs +4 -3
- package/esm2022/libs/feature/router/src/lib/default/state/router.facade.mjs +3 -2
- package/esm2022/libs/feature/search/src/lib/state/reducer.mjs +5 -2
- package/esm2022/libs/ui/elements/src/lib/api-card/api-card.component.mjs +3 -3
- package/esm2022/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.mjs +1 -4
- package/esm2022/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.mjs +7 -7
- package/esm2022/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.mjs +1 -6
- package/esm2022/libs/util/app-config/src/lib/app-config.mjs +3 -1
- package/esm2022/libs/util/app-config/src/lib/fixtures.mjs +2 -2
- package/esm2022/libs/util/app-config/src/lib/model.mjs +1 -1
- package/esm2022/libs/util/app-config/src/lib/parse-utils.mjs +5 -4
- package/esm2022/libs/util/i18n/src/lib/language-codes.mjs +50 -9
- package/esm2022/libs/util/shared/src/lib/record/quality-score.util.mjs +9 -8
- package/esm2022/libs/util/shared/src/lib/utils/geojson.mjs +58 -1
- package/esm2022/translations/de.json +52 -20
- package/esm2022/translations/en.json +53 -21
- package/esm2022/translations/es.json +39 -7
- package/esm2022/translations/fr.json +57 -25
- package/esm2022/translations/it.json +52 -20
- package/esm2022/translations/nl.json +39 -7
- package/esm2022/translations/pt.json +39 -7
- package/esm2022/translations/sk.json +43 -11
- package/fesm2022/geonetwork-ui.mjs +3013 -2925
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/metadata-converter/src/lib/dcat-ap/read-parts.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts +2 -2
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
- package/libs/api/repository/src/index.d.ts +1 -1
- package/libs/api/repository/src/index.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts +1 -2
- package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +6 -7
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.d.ts +2 -0
- package/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.d.ts.map +1 -1
- package/libs/api/repository/src/lib/metadata-language.token.d.ts +5 -0
- package/libs/api/repository/src/lib/metadata-language.token.d.ts.map +1 -0
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +5 -1
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/platform.service.interface.d.ts +1 -0
- package/libs/common/domain/src/lib/platform.service.interface.d.ts.map +1 -1
- package/libs/feature/catalog/src/lib/sources/sources.service.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-inspire-field/form-field-inspire-theme.component.d.ts +20 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-inspire-field/form-field-inspire-theme.component.d.ts.map +1 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts +1 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/index.d.ts +1 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/index.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/fields.config.d.ts +8 -1
- package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
- package/libs/feature/map/src/lib/utils/map-utils.service.d.ts +2 -2
- package/libs/feature/map/src/lib/utils/map-utils.service.d.ts.map +1 -1
- package/libs/feature/router/src/lib/default/state/query-params.utils.d.ts.map +1 -1
- package/libs/feature/router/src/lib/default/state/router.facade.d.ts.map +1 -1
- package/libs/feature/search/src/lib/state/reducer.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts +0 -1
- package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.d.ts.map +1 -1
- package/libs/util/app-config/src/lib/app-config.d.ts.map +1 -1
- package/libs/util/app-config/src/lib/model.d.ts +1 -0
- package/libs/util/app-config/src/lib/model.d.ts.map +1 -1
- package/libs/util/app-config/src/lib/parse-utils.d.ts.map +1 -1
- package/libs/util/i18n/src/lib/language-codes.d.ts +91 -31
- package/libs/util/i18n/src/lib/language-codes.d.ts.map +1 -1
- package/libs/util/shared/src/lib/record/quality-score.util.d.ts.map +1 -1
- package/libs/util/shared/src/lib/utils/geojson.d.ts +7 -2
- package/libs/util/shared/src/lib/utils/geojson.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/libs/api/metadata-converter/src/lib/dcat-ap/read-parts.ts +3 -6
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +47 -22
- package/src/libs/api/metadata-converter/src/lib/gn4/metadata-url.service.ts +2 -2
- package/src/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.ts +2 -2
- package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +2 -2
- package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +3 -3
- package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +6 -6
- package/src/libs/api/repository/src/index.ts +1 -1
- package/src/libs/api/repository/src/lib/gn4/auth/auth.service.ts +4 -4
- package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +65 -14
- package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +2 -2
- package/src/libs/api/repository/src/lib/gn4/organizations/organizations-from-groups.service.ts +2 -2
- package/src/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts +2 -2
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +22 -35
- package/src/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.ts +8 -0
- package/src/libs/api/repository/src/lib/metadata-language.token.ts +8 -0
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +17 -1
- package/src/libs/common/domain/src/lib/platform.service.interface.ts +1 -0
- package/src/libs/feature/catalog/src/lib/sources/sources.service.ts +2 -5
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-inspire-field/form-field-inspire-theme.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-inspire-field/form-field-inspire-theme.component.html +22 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-inspire-field/form-field-inspire-theme.component.ts +57 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +6 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +5 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/index.ts +1 -0
- package/src/libs/feature/editor/src/lib/fields.config.ts +85 -1
- package/src/libs/feature/map/src/lib/utils/map-utils.service.ts +8 -8
- package/src/libs/feature/router/src/lib/default/state/query-params.utils.ts +5 -2
- package/src/libs/feature/router/src/lib/default/state/router.facade.ts +2 -1
- package/src/libs/feature/search/src/lib/state/reducer.ts +4 -1
- package/src/libs/ui/elements/src/lib/api-card/api-card.component.html +4 -1
- package/src/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.ts +0 -4
- package/src/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.ts +6 -6
- package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +0 -6
- package/src/libs/util/app-config/src/lib/app-config.ts +2 -0
- package/src/libs/util/app-config/src/lib/fixtures.ts +1 -1
- package/src/libs/util/app-config/src/lib/model.ts +1 -0
- package/src/libs/util/app-config/src/lib/parse-utils.ts +4 -7
- package/src/libs/util/i18n/src/lib/language-codes.ts +62 -11
- package/src/libs/util/shared/src/lib/record/quality-score.util.ts +13 -10
- package/src/libs/util/shared/src/lib/utils/geojson.ts +72 -2
- package/translations/de.json +52 -20
- package/translations/en.json +53 -21
- package/translations/es.json +39 -7
- package/translations/fr.json +57 -25
- package/translations/it.json +52 -20
- package/translations/nl.json +39 -7
- package/translations/pt.json +39 -7
- package/translations/sk.json +43 -11
- package/esm2022/libs/api/repository/src/lib/metadata-language.mjs +0 -3
- package/esm2022/libs/util/app-config/src/lib/constants.mjs +0 -439
- package/libs/api/repository/src/lib/metadata-language.d.ts +0 -3
- package/libs/api/repository/src/lib/metadata-language.d.ts.map +0 -1
- package/libs/util/app-config/src/lib/constants.d.ts +0 -2
- package/libs/util/app-config/src/lib/constants.d.ts.map +0 -1
- package/src/libs/api/repository/src/lib/metadata-language.ts +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable, Injector } from '@angular/core'
|
|
2
|
-
import { Geometry } from 'geojson'
|
|
2
|
+
import type { Geometry } from 'geojson'
|
|
3
3
|
import {
|
|
4
4
|
ES_QUERY_FIELDS_PRIORITY,
|
|
5
5
|
ES_SOURCE_SUMMARY,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
FiltersAggregationParams,
|
|
16
16
|
SortByField,
|
|
17
17
|
} from '../../../../../../../libs/common/domain/src/lib/model/search'
|
|
18
|
-
import { METADATA_LANGUAGE } from '../../metadata-language'
|
|
18
|
+
import { METADATA_LANGUAGE } from '../../metadata-language.token'
|
|
19
19
|
import {
|
|
20
20
|
AggregationResult,
|
|
21
21
|
EsSearchParams,
|
|
@@ -26,10 +26,16 @@ import {
|
|
|
26
26
|
SortParams,
|
|
27
27
|
TermsAggregationResult,
|
|
28
28
|
} from '../../../../../../../libs/api/metadata-converter/src'
|
|
29
|
-
import {
|
|
29
|
+
import { toLang3 } from '../../../../../../../libs/util/i18n/src'
|
|
30
30
|
import { formatDate, isDateRange } from './date-range.utils'
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
CatalogRecord,
|
|
33
|
+
LanguageCode,
|
|
34
|
+
} from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
32
35
|
import { TranslateService } from '@ngx-translate/core'
|
|
36
|
+
import { getGeometryBoundingBox } from '../../../../../../../libs/util/shared/src'
|
|
37
|
+
import { getLength as getGeodesicLength } from 'ol/sphere'
|
|
38
|
+
import { LineString } from 'ol/geom'
|
|
33
39
|
|
|
34
40
|
export type DateRange = { start?: Date; end?: Date }
|
|
35
41
|
|
|
@@ -42,11 +48,9 @@ export class ElasticsearchService {
|
|
|
42
48
|
private runtimeFields: Record<string, string> = {}
|
|
43
49
|
|
|
44
50
|
// we're using getters in case the defined languages change over time
|
|
45
|
-
private get
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
private get metadataLang() {
|
|
49
|
-
return this.injector.get(METADATA_LANGUAGE, null)
|
|
51
|
+
private get metadataLang(): LanguageCode {
|
|
52
|
+
const mdLangValue = this.injector.get(METADATA_LANGUAGE, null)
|
|
53
|
+
return typeof mdLangValue === 'function' ? mdLangValue() : mdLangValue
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
constructor(
|
|
@@ -230,9 +234,12 @@ export class ElasticsearchService {
|
|
|
230
234
|
|
|
231
235
|
private getQueryLang(): string {
|
|
232
236
|
if (this.metadataLang) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
const lang3 = toLang3(
|
|
238
|
+
this.isCurrentSearchLang()
|
|
239
|
+
? this.translateService.currentLang
|
|
240
|
+
: this.metadataLang
|
|
241
|
+
)
|
|
242
|
+
return `lang${lang3}`
|
|
236
243
|
} else return '*'
|
|
237
244
|
}
|
|
238
245
|
private isCurrentSearchLang() {
|
|
@@ -351,6 +358,11 @@ export class ElasticsearchService {
|
|
|
351
358
|
})
|
|
352
359
|
}
|
|
353
360
|
if (geometry) {
|
|
361
|
+
// boosts applied using the filter geometry:
|
|
362
|
+
// * records completely within the geometry receive a boost of 5
|
|
363
|
+
// * records intersecting the geometry receive a boost of 2
|
|
364
|
+
// * records close to the geometry center receive a boost of 5 (based on the `location` field)
|
|
365
|
+
// * records on the outskirt of the geometry receive a boost of 2.5
|
|
354
366
|
should.push(
|
|
355
367
|
{
|
|
356
368
|
geo_shape: {
|
|
@@ -358,7 +370,7 @@ export class ElasticsearchService {
|
|
|
358
370
|
shape: geometry,
|
|
359
371
|
relation: 'within',
|
|
360
372
|
},
|
|
361
|
-
boost:
|
|
373
|
+
boost: 5.0,
|
|
362
374
|
},
|
|
363
375
|
},
|
|
364
376
|
{
|
|
@@ -367,10 +379,49 @@ export class ElasticsearchService {
|
|
|
367
379
|
shape: geometry,
|
|
368
380
|
relation: 'intersects',
|
|
369
381
|
},
|
|
370
|
-
boost:
|
|
382
|
+
boost: 2.0,
|
|
371
383
|
},
|
|
372
384
|
}
|
|
373
385
|
)
|
|
386
|
+
|
|
387
|
+
// this will boost the results variably depending on their distance from the given geometry
|
|
388
|
+
// note: this takes into account the `location` field of a record; this is generally the center of all spatial extents
|
|
389
|
+
// combined, and thus the actual size/coverage of the record spatial extent isn't relevant here
|
|
390
|
+
const bbox = getGeometryBoundingBox(geometry)
|
|
391
|
+
const center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2]
|
|
392
|
+
const northToCenter = new LineString([
|
|
393
|
+
[center[0], bbox[3]],
|
|
394
|
+
center,
|
|
395
|
+
]).transform('EPSG:4326', 'EPSG:3857')
|
|
396
|
+
const southToCenter = new LineString([
|
|
397
|
+
[center[0], bbox[1]],
|
|
398
|
+
center,
|
|
399
|
+
]).transform('EPSG:4326', 'EPSG:3857')
|
|
400
|
+
const westToCenter = new LineString([
|
|
401
|
+
[bbox[0], center[1]],
|
|
402
|
+
center,
|
|
403
|
+
]).transform('EPSG:4326', 'EPSG:3857')
|
|
404
|
+
const eastToCenter = new LineString([
|
|
405
|
+
[bbox[2], center[1]],
|
|
406
|
+
center,
|
|
407
|
+
]).transform('EPSG:4326', 'EPSG:3857')
|
|
408
|
+
// cutoff distance is the distance from where the boost will only be half of the max value
|
|
409
|
+
// it is an average of the "size" of the bounding box in every direction, in meters
|
|
410
|
+
const cutoffDistance =
|
|
411
|
+
(getGeodesicLength(northToCenter) +
|
|
412
|
+
getGeodesicLength(southToCenter) +
|
|
413
|
+
getGeodesicLength(westToCenter) +
|
|
414
|
+
getGeodesicLength(eastToCenter)) /
|
|
415
|
+
4
|
|
416
|
+
|
|
417
|
+
should.push({
|
|
418
|
+
distance_feature: {
|
|
419
|
+
field: 'location',
|
|
420
|
+
pivot: `${Math.round(cutoffDistance).toFixed(0)}m`,
|
|
421
|
+
origin: center,
|
|
422
|
+
boost: 5.0,
|
|
423
|
+
},
|
|
424
|
+
})
|
|
374
425
|
}
|
|
375
426
|
|
|
376
427
|
return {
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
import { catchError, map, tap } from 'rxjs/operators'
|
|
49
49
|
import { lt } from 'semver'
|
|
50
50
|
import { ElasticsearchService } from './elasticsearch'
|
|
51
|
-
import {
|
|
51
|
+
import { toLang2 } from '../../../../../../libs/util/i18n/src'
|
|
52
52
|
import { Gn4SettingsService } from './settings/gn4-settings.service'
|
|
53
53
|
|
|
54
54
|
const minPublicationApiVersion = '4.2.5'
|
|
@@ -562,7 +562,7 @@ export class Gn4Repository implements RecordsRepositoryInterface {
|
|
|
562
562
|
.pipe(
|
|
563
563
|
map((languages) =>
|
|
564
564
|
languages
|
|
565
|
-
.map((lang) =>
|
|
565
|
+
.map((lang) => toLang2(lang.id))
|
|
566
566
|
.filter((code): code is string => !!code)
|
|
567
567
|
)
|
|
568
568
|
)
|
package/src/libs/api/repository/src/lib/gn4/organizations/organizations-from-groups.service.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { forkJoin, Observable, of } from 'rxjs'
|
|
8
8
|
import { map, shareReplay } from 'rxjs/operators'
|
|
9
9
|
import { TranslateService } from '@ngx-translate/core'
|
|
10
|
-
import {
|
|
10
|
+
import { toLang3 } from '../../../../../../../libs/util/i18n/src'
|
|
11
11
|
import { FieldFilters } from '../../../../../../../libs/common/domain/src/lib/model/search'
|
|
12
12
|
import {
|
|
13
13
|
CatalogRecord,
|
|
@@ -52,7 +52,7 @@ export class OrganizationsFromGroupsService
|
|
|
52
52
|
organisationsCount$ = this.organisations$.pipe(map((orgs) => orgs.length))
|
|
53
53
|
|
|
54
54
|
private get lang3() {
|
|
55
|
-
return
|
|
55
|
+
return toLang3(this.translateService.currentLang)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
constructor(
|
package/src/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
tap,
|
|
34
34
|
withLatestFrom,
|
|
35
35
|
} from 'rxjs/operators'
|
|
36
|
-
import {
|
|
36
|
+
import { toLang3 } from '../../../../../../../libs/util/i18n/src'
|
|
37
37
|
import { PlatformServiceInterface } from '../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
38
38
|
import { coerce, satisfies, valid } from 'semver'
|
|
39
39
|
import { TranslateService } from '@ngx-translate/core'
|
|
@@ -126,7 +126,7 @@ export class OrganizationsFromMetadataService
|
|
|
126
126
|
) {}
|
|
127
127
|
|
|
128
128
|
private get langIndex() {
|
|
129
|
-
return
|
|
129
|
+
return `lang${toLang3(this.translateService.currentLang)}`
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
equalsNormalizedStrings(
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
MeApiService,
|
|
12
12
|
RecordsApiService,
|
|
13
13
|
RegistriesApiService,
|
|
14
|
-
SiteApiService,
|
|
15
14
|
ToolsApiService,
|
|
16
15
|
UserfeedbackApiService,
|
|
17
16
|
UsersApiService,
|
|
@@ -45,7 +44,8 @@ import {
|
|
|
45
44
|
throwError,
|
|
46
45
|
} from 'rxjs'
|
|
47
46
|
import { TranslateService } from '@ngx-translate/core'
|
|
48
|
-
import {
|
|
47
|
+
import { toLang3 } from '../../../../../../../libs/util/i18n/src'
|
|
48
|
+
import { Gn4SettingsService } from '../settings/gn4-settings.service'
|
|
49
49
|
|
|
50
50
|
const minApiVersion = '4.2.2'
|
|
51
51
|
|
|
@@ -66,31 +66,6 @@ export class Gn4PlatformService implements PlatformServiceInterface {
|
|
|
66
66
|
}),
|
|
67
67
|
shareReplay(1)
|
|
68
68
|
)
|
|
69
|
-
|
|
70
|
-
private settings$ = of(true).pipe(
|
|
71
|
-
switchMap(() => this.siteApiService.getSiteOrPortalDescription()),
|
|
72
|
-
shareReplay(1)
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
private readonly apiVersion$ = this.settings$.pipe(
|
|
76
|
-
map((info) => info['system/platform/version'] as string),
|
|
77
|
-
tap((version) => {
|
|
78
|
-
if (ltr(version, minApiVersion)) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
`Gn4 API version is not compatible.\nMinimum: ${minApiVersion}\nYour version: ${version}`
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
}),
|
|
84
|
-
shareReplay(1)
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
private readonly allowEditHarvestedMd$ = this.settings$.pipe(
|
|
88
|
-
map((info) => {
|
|
89
|
-
return info['system/harvester/enableEditing'] as boolean
|
|
90
|
-
}),
|
|
91
|
-
shareReplay(1)
|
|
92
|
-
)
|
|
93
|
-
|
|
94
69
|
/**
|
|
95
70
|
* A map of already loaded thesauri (groups of keywords); the key is a URI
|
|
96
71
|
* @private
|
|
@@ -98,11 +73,10 @@ export class Gn4PlatformService implements PlatformServiceInterface {
|
|
|
98
73
|
private keywordsByThesauri: Record<string, Observable<Keyword[]>> = {}
|
|
99
74
|
|
|
100
75
|
private get lang3() {
|
|
101
|
-
return
|
|
76
|
+
return toLang3(this.translateService.currentLang)
|
|
102
77
|
}
|
|
103
78
|
|
|
104
79
|
constructor(
|
|
105
|
-
private siteApiService: SiteApiService,
|
|
106
80
|
private meApi: MeApiService,
|
|
107
81
|
private usersApi: UsersApiService,
|
|
108
82
|
private mapper: Gn4PlatformMapper,
|
|
@@ -111,7 +85,8 @@ export class Gn4PlatformService implements PlatformServiceInterface {
|
|
|
111
85
|
private translateService: TranslateService,
|
|
112
86
|
private userfeedbackApiService: UserfeedbackApiService,
|
|
113
87
|
private httpClient: HttpClient,
|
|
114
|
-
private recordsApiService: RecordsApiService
|
|
88
|
+
private recordsApiService: RecordsApiService,
|
|
89
|
+
private settingsService: Gn4SettingsService
|
|
115
90
|
) {
|
|
116
91
|
this.me$ = this.meApi.getMe().pipe(
|
|
117
92
|
switchMap((apiUser) => this.mapper.userFromMeApi(apiUser)),
|
|
@@ -128,16 +103,28 @@ export class Gn4PlatformService implements PlatformServiceInterface {
|
|
|
128
103
|
)
|
|
129
104
|
}
|
|
130
105
|
|
|
106
|
+
getFeedbacksAllowed(): Observable<boolean> {
|
|
107
|
+
return this.settingsService.allowFeedbacks$
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getAllowEditHarvestedMd(): Observable<boolean> {
|
|
111
|
+
return this.settingsService.allowEditHarvested$
|
|
112
|
+
}
|
|
113
|
+
|
|
131
114
|
getType(): string {
|
|
132
115
|
return this.type
|
|
133
116
|
}
|
|
134
117
|
|
|
135
118
|
getApiVersion(): Observable<string> {
|
|
136
|
-
return this.apiVersion
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
119
|
+
return this.settingsService.apiVersion$.pipe(
|
|
120
|
+
tap((version) => {
|
|
121
|
+
if (ltr(version, minApiVersion)) {
|
|
122
|
+
throw new Error(
|
|
123
|
+
`Gn4 API version is not compatible.\nMinimum: ${minApiVersion}\nYour version: ${version}`
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
)
|
|
141
128
|
}
|
|
142
129
|
|
|
143
130
|
getMe(): Observable<UserModel> {
|
|
@@ -14,6 +14,14 @@ export class Gn4SettingsService {
|
|
|
14
14
|
public allowEditHarvested$: Observable<boolean> =
|
|
15
15
|
this.getSettingsSetValueByKey('system/harvester/enableEditing')
|
|
16
16
|
|
|
17
|
+
public allowFeedbacks$: Observable<boolean> = this.getSettingsSetValueByKey(
|
|
18
|
+
'system/userFeedback/enable'
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
public apiVersion$: Observable<string> = this.getSettingsSetValueByKey(
|
|
22
|
+
'system/platform/version'
|
|
23
|
+
)
|
|
24
|
+
|
|
17
25
|
constructor(private siteApiService: SiteApiService) {}
|
|
18
26
|
|
|
19
27
|
private getSettingsSetValueByKey(key: string) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core'
|
|
2
|
+
import { LanguageCode } from '../../../../../libs/common/domain/src/lib/model/record'
|
|
3
|
+
|
|
4
|
+
export type LanguageCodeFactory = () => LanguageCode
|
|
5
|
+
|
|
6
|
+
export const METADATA_LANGUAGE = new InjectionToken<
|
|
7
|
+
LanguageCode | LanguageCodeFactory
|
|
8
|
+
>('metadata-language')
|
|
@@ -108,6 +108,11 @@ export interface Keyword {
|
|
|
108
108
|
translations?: KeywordTranslations
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
export interface INSPIRE_theme {
|
|
112
|
+
value: string
|
|
113
|
+
label: string
|
|
114
|
+
}
|
|
115
|
+
|
|
111
116
|
export interface BaseRecord {
|
|
112
117
|
uniqueIdentifier: Uuid
|
|
113
118
|
ownerOrganization: Organization
|
|
@@ -160,6 +165,17 @@ export type ServiceProtocol =
|
|
|
160
165
|
| 'maplibre-style'
|
|
161
166
|
| 'other'
|
|
162
167
|
|
|
168
|
+
marker('record.metadata.api.accessServiceProtocol.wms')
|
|
169
|
+
marker('record.metadata.api.accessServiceProtocol.wfs')
|
|
170
|
+
marker('record.metadata.api.accessServiceProtocol.wps')
|
|
171
|
+
marker('record.metadata.api.accessServiceProtocol.wmts')
|
|
172
|
+
marker('record.metadata.api.accessServiceProtocol.esriRest')
|
|
173
|
+
marker('record.metadata.api.accessServiceProtocol.ogcFeatures')
|
|
174
|
+
marker('record.metadata.api.accessServiceProtocol.GPFDL')
|
|
175
|
+
marker('record.metadata.api.accessServiceProtocol.tms')
|
|
176
|
+
marker('record.metadata.api.accessServiceProtocol.maplibre-style')
|
|
177
|
+
marker('record.metadata.api.accessServiceProtocol.other')
|
|
178
|
+
|
|
163
179
|
export type OnlineResourceType = 'service' | 'download' | 'link' | 'endpoint'
|
|
164
180
|
|
|
165
181
|
export interface DatasetServiceDistribution {
|
|
@@ -258,7 +274,7 @@ export interface ServiceRecord extends BaseRecord {
|
|
|
258
274
|
export interface ReuseRecord extends BaseRecord {
|
|
259
275
|
kind: 'reuse'
|
|
260
276
|
lineage: string // Explanation of the origin of this record (e.g: how, why)"
|
|
261
|
-
onlineResources: Array<
|
|
277
|
+
onlineResources: Array<DatasetOnlineResource>
|
|
262
278
|
reuseType: ReuseType
|
|
263
279
|
spatialExtents: Array<DatasetSpatialExtent>
|
|
264
280
|
temporalExtents: Array<DatasetTemporalExtent>
|
|
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs'
|
|
|
4
4
|
import { filter, map, shareReplay } from 'rxjs/operators'
|
|
5
5
|
import { CatalogSource } from './sources.model'
|
|
6
6
|
import { TranslateService } from '@ngx-translate/core'
|
|
7
|
-
import {
|
|
7
|
+
import { toLang3 } from '../../../../../../libs/util/i18n/src'
|
|
8
8
|
|
|
9
9
|
@Injectable({
|
|
10
10
|
providedIn: 'root',
|
|
@@ -23,10 +23,7 @@ export class SourcesService {
|
|
|
23
23
|
return this.sources$.pipe(
|
|
24
24
|
map((sources) => sources.filter((source) => source.uuid === uuid)[0]),
|
|
25
25
|
filter((source) => !!source),
|
|
26
|
-
map(
|
|
27
|
-
(source) =>
|
|
28
|
-
source.label[getLang3FromLang2(this.translateService.currentLang)]
|
|
29
|
-
)
|
|
26
|
+
map((source) => source.label[toLang3(this.translateService.currentLang)])
|
|
30
27
|
)
|
|
31
28
|
}
|
|
32
29
|
}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<div class="flex flex-col gap-3">
|
|
2
|
+
<div class="flex flex-col gap-4">
|
|
3
|
+
<gn-ui-dropdown-multiselect
|
|
4
|
+
class="w-full"
|
|
5
|
+
[title]="'editor.record.form.inspire.placeholder' | translate"
|
|
6
|
+
[maxRows]="6"
|
|
7
|
+
[selected]="themes"
|
|
8
|
+
[choices]="availableThemes || []"
|
|
9
|
+
[allowSearch]="true"
|
|
10
|
+
(selectValues)="handleItemSelection($event)"
|
|
11
|
+
>
|
|
12
|
+
</gn-ui-dropdown-multiselect>
|
|
13
|
+
<div class="flex gap-2 flex-wrap">
|
|
14
|
+
<gn-ui-badge
|
|
15
|
+
*ngFor="let theme of themes"
|
|
16
|
+
[removable]="true"
|
|
17
|
+
(badgeRemoveClicked)="removeTheme(theme)"
|
|
18
|
+
>{{ getTranslatedTheme(theme) }}
|
|
19
|
+
</gn-ui-badge>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core'
|
|
2
|
+
import { CommonModule } from '@angular/common'
|
|
3
|
+
import {
|
|
4
|
+
AutocompleteComponent,
|
|
5
|
+
BadgeComponent,
|
|
6
|
+
DropdownMultiselectComponent,
|
|
7
|
+
} from '../../../../../../../../../libs/ui/inputs/src'
|
|
8
|
+
import { NgIconComponent } from '@ng-icons/core'
|
|
9
|
+
import { INSPIRE_THEMES } from '../../../../fields.config'
|
|
10
|
+
import { TranslatePipe, TranslateService } from '@ngx-translate/core'
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'gn-ui-form-field-inspire-theme',
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [
|
|
16
|
+
CommonModule,
|
|
17
|
+
AutocompleteComponent,
|
|
18
|
+
NgIconComponent,
|
|
19
|
+
BadgeComponent,
|
|
20
|
+
TranslatePipe,
|
|
21
|
+
DropdownMultiselectComponent,
|
|
22
|
+
],
|
|
23
|
+
templateUrl: './form-field-inspire-theme.component.html',
|
|
24
|
+
styleUrl: './form-field-inspire-theme.component.css',
|
|
25
|
+
})
|
|
26
|
+
export class FormFieldInspireThemeComponent {
|
|
27
|
+
themes = []
|
|
28
|
+
@Input() set value(themes: string[]) {
|
|
29
|
+
this.themes = themes
|
|
30
|
+
}
|
|
31
|
+
@Output() valueChange: EventEmitter<string[]> = new EventEmitter()
|
|
32
|
+
availableThemes = INSPIRE_THEMES.map((theme) => {
|
|
33
|
+
return {
|
|
34
|
+
label: this.translateService.instant(theme.label),
|
|
35
|
+
value: theme.value,
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
constructor(private translateService: TranslateService) {}
|
|
40
|
+
|
|
41
|
+
handleItemSelection(selectedItems: string[]) {
|
|
42
|
+
this.themes = selectedItems
|
|
43
|
+
this.valueChange.emit(this.themes)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
removeTheme(theme: string) {
|
|
47
|
+
this.themes = this.themes.filter((t) => t !== theme)
|
|
48
|
+
this.valueChange.emit(this.themes)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getTranslatedTheme(theme: string) {
|
|
52
|
+
const themeKey = this.availableThemes.find(
|
|
53
|
+
(avail) => avail.value === theme
|
|
54
|
+
)?.label
|
|
55
|
+
return themeKey ? this.translateService.instant(themeKey) : ''
|
|
56
|
+
}
|
|
57
|
+
}
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html
CHANGED
|
@@ -109,6 +109,12 @@
|
|
|
109
109
|
(valueChange)="valueChange.emit($event)"
|
|
110
110
|
></gn-ui-form-field-keywords>
|
|
111
111
|
</ng-container>
|
|
112
|
+
<ng-container *ngSwitchCase="'topics'">
|
|
113
|
+
<gn-ui-form-field-inspire-theme
|
|
114
|
+
[value]="valueAsInspireTheme"
|
|
115
|
+
(valueChange)="valueChange.emit($event)"
|
|
116
|
+
></gn-ui-form-field-inspire-theme>
|
|
117
|
+
</ng-container>
|
|
112
118
|
<ng-container *ngSwitchCase="'licenses'">
|
|
113
119
|
<gn-ui-form-field-license
|
|
114
120
|
[label]="config.labelKey! | translate"
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts
CHANGED
|
@@ -45,6 +45,7 @@ import { FormFieldConstraintsShortcutsComponent } from './form-field-constraints
|
|
|
45
45
|
import { FormFieldConstraintsComponent } from './form-field-constraints/form-field-constraints.component'
|
|
46
46
|
import { TextFieldModule } from '@angular/cdk/text-field'
|
|
47
47
|
import { FormFieldSpatialToggleComponent } from './form-field-spatial-toggle/form-field-spatial-toggle.component'
|
|
48
|
+
import { FormFieldInspireThemeComponent } from './form-field-inspire-field/form-field-inspire-theme.component'
|
|
48
49
|
|
|
49
50
|
@Component({
|
|
50
51
|
selector: 'gn-ui-form-field',
|
|
@@ -73,6 +74,7 @@ import { FormFieldSpatialToggleComponent } from './form-field-spatial-toggle/for
|
|
|
73
74
|
FormFieldConstraintsComponent,
|
|
74
75
|
FormFieldConstraintsShortcutsComponent,
|
|
75
76
|
FormFieldSpatialToggleComponent,
|
|
77
|
+
FormFieldInspireThemeComponent,
|
|
76
78
|
TextFieldModule,
|
|
77
79
|
],
|
|
78
80
|
})
|
|
@@ -128,6 +130,9 @@ export class FormFieldComponent {
|
|
|
128
130
|
get valueAsKeywords() {
|
|
129
131
|
return this.value as Array<Keyword>
|
|
130
132
|
}
|
|
133
|
+
get valueAsInspireTheme() {
|
|
134
|
+
return this.value as Array<string>
|
|
135
|
+
}
|
|
131
136
|
get valueAsConstraints() {
|
|
132
137
|
return this.value as Array<Constraint>
|
|
133
138
|
}
|
|
@@ -10,3 +10,4 @@ export * from './form-field-array/form-field-array.component'
|
|
|
10
10
|
export * from './form-field-spatial-extent/form-field-spatial-extent.component'
|
|
11
11
|
export * from './form-field.component'
|
|
12
12
|
export * from './form-field-constraints-shortcuts/constraints.utils'
|
|
13
|
+
export * from './form-field-inspire-field/form-field-inspire-theme.component'
|
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
EditorField,
|
|
5
5
|
EditorSection,
|
|
6
6
|
} from './models/editor-config.model'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
INSPIRE_theme,
|
|
9
|
+
Keyword,
|
|
10
|
+
} from '../../../../../libs/common/domain/src/lib/model/record'
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* This file contains the configuration of the fields that will be displayed in the editor.
|
|
@@ -64,6 +67,11 @@ export const RECORD_KEYWORDS_FIELD: EditorField = {
|
|
|
64
67
|
formFieldConfig: {},
|
|
65
68
|
}
|
|
66
69
|
|
|
70
|
+
export const RECORD_TOPICS_FIELD: EditorField = {
|
|
71
|
+
model: 'topics',
|
|
72
|
+
formFieldConfig: {},
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
export const RECORD_RESOURCE_CREATED_FIELD: EditorField = {
|
|
68
76
|
model: 'resourceCreated',
|
|
69
77
|
formFieldConfig: {
|
|
@@ -235,6 +243,13 @@ export const CLASSIFICATION_SECTION: EditorSection = {
|
|
|
235
243
|
fields: [RECORD_KEYWORDS_FIELD],
|
|
236
244
|
}
|
|
237
245
|
|
|
246
|
+
export const INSPIRE_SECTION: EditorSection = {
|
|
247
|
+
labelKey: marker('editor.record.form.section.inspire.label'),
|
|
248
|
+
descriptionKey: marker('editor.record.form.section.inspire.description'),
|
|
249
|
+
hidden: false,
|
|
250
|
+
fields: [RECORD_TOPICS_FIELD],
|
|
251
|
+
}
|
|
252
|
+
|
|
238
253
|
export const USE_AND_ACCESS_CONDITIONS_SECTION: EditorSection = {
|
|
239
254
|
labelKey: marker('editor.record.form.section.useAndAccessConditions.label'),
|
|
240
255
|
hidden: false,
|
|
@@ -274,6 +289,7 @@ export const DEFAULT_CONFIGURATION: EditorConfig = {
|
|
|
274
289
|
sections: [
|
|
275
290
|
TITLE_SECTION,
|
|
276
291
|
CLASSIFICATION_SECTION,
|
|
292
|
+
INSPIRE_SECTION,
|
|
277
293
|
ABOUT_SECTION,
|
|
278
294
|
GEOGRAPHICAL_COVERAGE_SECTION,
|
|
279
295
|
],
|
|
@@ -341,3 +357,71 @@ export const SPATIAL_SCOPES: Keyword[] = [
|
|
|
341
357
|
type: 'theme',
|
|
342
358
|
},
|
|
343
359
|
]
|
|
360
|
+
|
|
361
|
+
/************************************************************
|
|
362
|
+
*************** INSPIRE THEMES **************
|
|
363
|
+
************************************************************
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
export const INSPIRE_THEMES: INSPIRE_theme[] = [
|
|
367
|
+
{ value: 'biota', label: 'editor.record.form.inspire.biota' },
|
|
368
|
+
{ value: 'boundaries', label: 'editor.record.form.inspire.boundaries' },
|
|
369
|
+
{
|
|
370
|
+
value: 'climatologyMeteorologyAtmosphere',
|
|
371
|
+
label: 'editor.record.form.inspire.climatology',
|
|
372
|
+
},
|
|
373
|
+
{ value: 'economy', label: 'editor.record.form.inspire.economy' },
|
|
374
|
+
{ value: 'elevation', label: 'editor.record.form.inspire.elevation' },
|
|
375
|
+
{ value: 'environment', label: 'editor.record.form.inspire.environnement' },
|
|
376
|
+
{ value: 'farming', label: 'editor.record.form.inspire.farming' },
|
|
377
|
+
{
|
|
378
|
+
value: 'geoscientific information',
|
|
379
|
+
label: 'editor.record.form.inspire.geoscientific',
|
|
380
|
+
},
|
|
381
|
+
{ value: 'health', label: 'editor.record.form.inspire.health' },
|
|
382
|
+
{
|
|
383
|
+
value: 'imageryBaseMapsEarthCover',
|
|
384
|
+
label: 'editor.record.form.inspire.imagery',
|
|
385
|
+
},
|
|
386
|
+
{ value: 'inlandWaters', label: 'editor.record.form.inspire.waters' },
|
|
387
|
+
{
|
|
388
|
+
value: 'intelligenceMilitary',
|
|
389
|
+
label: 'editor.record.form.inspire.intelligence',
|
|
390
|
+
},
|
|
391
|
+
{ value: 'Location', label: 'editor.record.form.inspire.location' },
|
|
392
|
+
{ value: 'Oceans', label: 'editor.record.form.inspire.oceans' },
|
|
393
|
+
{
|
|
394
|
+
value: 'planningCadastre',
|
|
395
|
+
label: 'editor.record.form.inspire.planning',
|
|
396
|
+
},
|
|
397
|
+
{ value: 'Society', label: 'editor.record.form.inspire.society' },
|
|
398
|
+
{ value: 'Structure', label: 'editor.record.form.inspire.structure' },
|
|
399
|
+
{
|
|
400
|
+
value: 'Transportation',
|
|
401
|
+
label: 'editor.record.form.inspire.transportation',
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
value: 'utilitiesCommunication',
|
|
405
|
+
label: 'editor.record.form.inspire.utilities',
|
|
406
|
+
},
|
|
407
|
+
]
|
|
408
|
+
|
|
409
|
+
marker('editor.record.form.inspire.biota')
|
|
410
|
+
marker('editor.record.form.inspire.boundaries')
|
|
411
|
+
marker('editor.record.form.inspire.climatology')
|
|
412
|
+
marker('editor.record.form.inspire.economy')
|
|
413
|
+
marker('editor.record.form.inspire.elevation')
|
|
414
|
+
marker('editor.record.form.inspire.environnement')
|
|
415
|
+
marker('editor.record.form.inspire.farming')
|
|
416
|
+
marker('editor.record.form.inspire.geoscientific')
|
|
417
|
+
marker('editor.record.form.inspire.health')
|
|
418
|
+
marker('editor.record.form.inspire.imagery')
|
|
419
|
+
marker('editor.record.form.inspire.intelligence')
|
|
420
|
+
marker('editor.record.form.inspire.location')
|
|
421
|
+
marker('editor.record.form.inspire.oceans')
|
|
422
|
+
marker('editor.record.form.inspire.planning')
|
|
423
|
+
marker('editor.record.form.inspire.society')
|
|
424
|
+
marker('editor.record.form.inspire.structure')
|
|
425
|
+
marker('editor.record.form.inspire.transportation')
|
|
426
|
+
marker('editor.record.form.inspire.utilities')
|
|
427
|
+
marker('editor.record.form.inspire.waters')
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core'
|
|
2
|
-
import { extend
|
|
3
|
-
import GeoJSON from 'ol/format/GeoJSON'
|
|
2
|
+
import { extend } from 'ol/extent'
|
|
4
3
|
import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
5
|
-
|
|
6
|
-
const GEOJSON = new GeoJSON()
|
|
4
|
+
import { BoundingBox, getGeometryBoundingBox } from '../../../../../../libs/util/shared/src'
|
|
7
5
|
|
|
8
6
|
@Injectable({
|
|
9
7
|
providedIn: 'root',
|
|
10
8
|
})
|
|
11
9
|
export class MapUtilsService {
|
|
12
|
-
getRecordExtent(record: Partial<CatalogRecord>):
|
|
10
|
+
getRecordExtent(record: Partial<CatalogRecord>): BoundingBox {
|
|
13
11
|
if (!('spatialExtents' in record) || record.spatialExtents.length === 0) {
|
|
14
12
|
return null
|
|
15
13
|
}
|
|
16
14
|
// extend all the spatial extents into an including bbox
|
|
17
15
|
return record.spatialExtents.reduce(
|
|
18
16
|
(prev, curr) => {
|
|
19
|
-
if ('bbox' in curr) return extend(prev, curr.bbox)
|
|
17
|
+
if ('bbox' in curr) return extend(prev, curr.bbox) as BoundingBox
|
|
20
18
|
else if ('geometry' in curr) {
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return extend(
|
|
20
|
+
prev,
|
|
21
|
+
getGeometryBoundingBox(curr.geometry)
|
|
22
|
+
) as BoundingBox
|
|
23
23
|
}
|
|
24
24
|
return prev
|
|
25
25
|
},
|