@geogirafe/lib-geoportal 1.3.0-dev.3046054236 → 1.3.0-dev.3060317043

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.
Files changed (111) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +3 -2
  3. package/api/apigeogirafeapp.js +3 -1
  4. package/assets/i18n/de.json +34 -3
  5. package/assets/i18n/en.json +33 -2
  6. package/assets/i18n/fr.json +35 -4
  7. package/assets/i18n/it.json +37 -6
  8. package/assets/icons/edit.svg +1 -1
  9. package/assets/icons/lock.svg +1 -0
  10. package/assets/icons/streetview-marker-mapillary.svg +1 -0
  11. package/components/cross-section/cross-section-settings/component.js +1 -1
  12. package/components/edit/component.d.ts +52 -36
  13. package/components/edit/component.js +340 -292
  14. package/components/edit/editcomponentstate.d.ts +1 -0
  15. package/components/edit/editcomponentstate.js +1 -0
  16. package/components/edit/editform/component.d.ts +34 -4
  17. package/components/edit/editform/component.js +224 -37
  18. package/components/edit/editform/style.css +51 -16
  19. package/components/edit/geometryedithelper.d.ts +47 -0
  20. package/components/edit/geometryedithelper.js +324 -0
  21. package/components/edit/style.css +71 -28
  22. package/components/layout/component.d.ts +5 -0
  23. package/components/main.d.ts +1 -1
  24. package/components/main.js +1 -1
  25. package/components/map-grid/component.d.ts +4 -0
  26. package/components/map-grid/component.js +6 -0
  27. package/components/print/component.d.ts +1 -1
  28. package/components/streetview/component.d.ts +9 -2
  29. package/components/streetview/component.js +20 -8
  30. package/components/streetview/google.js +1 -1
  31. package/components/streetview/mapillary.d.ts +8 -0
  32. package/components/streetview/mapillary.js +20 -0
  33. package/components/streetview/style.css +16 -0
  34. package/components/streetview/tools/googleprovider.js +9 -2
  35. package/components/streetview/tools/mapillaryprovider.d.ts +70 -0
  36. package/components/streetview/tools/mapillaryprovider.js +150 -0
  37. package/components/treeview/tools/treeviewelement.d.ts +1 -0
  38. package/components/treeview/tools/treeviewelement.js +22 -0
  39. package/components/treeview/treeviewitem/component.js +7 -1
  40. package/models/gmf.d.ts +18 -2
  41. package/models/gmf.js +3 -1
  42. package/models/layers/editablelayer.d.ts +7 -0
  43. package/models/layers/editablelayer.js +7 -0
  44. package/models/layers/layerwms.d.ts +1 -2
  45. package/models/layers/layerwms.js +4 -8
  46. package/models/main.d.ts +9 -4
  47. package/models/main.js +6 -2
  48. package/models/oapiflayer.d.ts +25 -0
  49. package/models/oapiflayer.js +36 -0
  50. package/models/oapiftypes.d.ts +71 -0
  51. package/models/oapiftypes.js +29 -0
  52. package/models/serverogc.d.ts +5 -3
  53. package/models/serverogc.js +19 -6
  54. package/models/serverogcapi.d.ts +2 -0
  55. package/models/serverogcapi.js +2 -0
  56. package/models/serverogcapifeatures.d.ts +5 -62
  57. package/models/serverogcapifeatures.js +8 -4
  58. package/package.json +1 -1
  59. package/templates/iframe.html +1 -0
  60. package/templates/index.html +2 -0
  61. package/templates/mobile.html +1 -0
  62. package/templates/public/about.json +1 -1
  63. package/tools/app/geogirafeapp-mobile.js +2 -0
  64. package/tools/app/geogirafeapp.js +4 -2
  65. package/tools/configuration/girafeconfig.js +1 -8
  66. package/tools/configuration/streetviewconfig.d.ts +12 -1
  67. package/tools/configuration/streetviewconfig.js +26 -4
  68. package/tools/drawing/olDrawing.js +2 -22
  69. package/tools/drawing/shapeConstraints.d.ts +2 -1
  70. package/tools/drawing/shapeConstraints.js +18 -2
  71. package/tools/main.d.ts +9 -7
  72. package/tools/main.js +8 -6
  73. package/tools/ogcapi/ogcapiclient.d.ts +7 -3
  74. package/tools/ogcapi/ogcapiclient.js +49 -4
  75. package/tools/ogcapi/ogcapiconformance.d.ts +2 -2
  76. package/tools/ogcapi/ogcapiconformance.js +7 -13
  77. package/tools/ogcapi/ogcapifeaturesclient.d.ts +65 -30
  78. package/tools/ogcapi/ogcapifeaturesclient.js +265 -139
  79. package/tools/ogcapi/ogcapifeaturesclientgeorama.d.ts +0 -5
  80. package/tools/ogcapi/ogcapifeaturesclientgeorama.js +0 -11
  81. package/tools/ogcapi/ogcapifeaturesclientqgis.d.ts +8 -0
  82. package/tools/ogcapi/ogcapifeaturesclientqgis.js +13 -0
  83. package/tools/ogcapi/ogcapifeaturesmanager.d.ts +61 -8
  84. package/tools/ogcapi/ogcapifeaturesmanager.js +179 -30
  85. package/tools/ogcapi/ogcapifeaturesschema.d.ts +31 -13
  86. package/tools/ogcapi/ogcapifeaturesschema.js +69 -39
  87. package/tools/ogcapi/ogcapifeaturesschemaproperty.d.ts +44 -0
  88. package/tools/ogcapi/ogcapifeaturesschemaproperty.js +137 -0
  89. package/tools/ogcapi/ogcapifeaturesschemavalidator.d.ts +22 -0
  90. package/tools/ogcapi/ogcapifeaturesschemavalidator.js +121 -0
  91. package/tools/state/layout.d.ts +5 -0
  92. package/tools/state/layout.js +2 -1
  93. package/tools/state/state.d.ts +6 -0
  94. package/tools/state/state.js +4 -0
  95. package/tools/state/streetview.d.ts +1 -1
  96. package/tools/state/streetview.js +1 -1
  97. package/tools/themes/themesmanager.d.ts +10 -3
  98. package/tools/themes/themesmanager.js +29 -9
  99. package/tools/time/layertimeformatter.d.ts +0 -5
  100. package/tools/time/layertimeformatter.js +10 -19
  101. package/tools/utils/dateutils.d.ts +40 -0
  102. package/tools/utils/dateutils.js +111 -0
  103. package/tools/utils/utils.d.ts +4 -0
  104. package/tools/utils/utils.js +12 -0
  105. package/tools/wfs/wfsmanager.js +3 -0
  106. package/tools/wms/wmsclient.d.ts +1 -0
  107. package/tools/wms/wmsclient.js +4 -0
  108. package/tools/ogcapi/demolayers.d.ts +0 -1
  109. package/tools/ogcapi/demolayers.js +0 -99
  110. package/tools/ogcapi/ogcapifeaturesclientgmf.d.ts +0 -13
  111. package/tools/ogcapi/ogcapifeaturesclientgmf.js +0 -30
@@ -0,0 +1,36 @@
1
+ import { getEpsgCodeFromCrsUri } from '../tools/ogcapi/ogcapifeaturesclient.js';
2
+ export class OapifLayer {
3
+ id;
4
+ title;
5
+ description;
6
+ server;
7
+ storageCrs;
8
+ geometryLayout;
9
+ schema;
10
+ permissions;
11
+ constructor(server, collection) {
12
+ this.id = collection.id;
13
+ this.title = collection.title;
14
+ this.description = collection.description;
15
+ this.storageCrs = collection.storageCrs ? getEpsgCodeFromCrsUri(collection.storageCrs) : undefined;
16
+ this.server = server;
17
+ }
18
+ get geometryType() {
19
+ return this.schema?.geometryType;
20
+ }
21
+ /**
22
+ * Generates a unique layer name by combining the server name and collection id
23
+ */
24
+ get uniqueLayerName() {
25
+ return this.server?.getUniqueLayerName(this.id) ?? '';
26
+ }
27
+ /**
28
+ * Validity decides if this layer can be used for editing
29
+ */
30
+ get valid() {
31
+ return !!this.storageCrs && !!this.schema && !!this.geometryType && !!this.geometryLayout;
32
+ }
33
+ hasPermission(permission) {
34
+ return this.permissions?.includes(permission) ?? false;
35
+ }
36
+ }
@@ -0,0 +1,71 @@
1
+ import { OgcApiLinksResponse } from './serverogcapi.js';
2
+ import { Type as olGeometryType } from 'ol/geom/Geometry.js';
3
+ export type OapifPropertyTypes = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array';
4
+ export declare const oapifNumericFormats: string[];
5
+ export declare const oapifStringFormats: string[];
6
+ export declare const oapifTemporalFormats: string[];
7
+ export declare const oapifPropertyFormatList: readonly string[];
8
+ export type OapifPropertyFormats = (typeof oapifPropertyFormatList)[number];
9
+ export interface OapifSchemaResponse {
10
+ $id: string;
11
+ $schema: string;
12
+ title?: string;
13
+ description?: string;
14
+ type?: string;
15
+ required?: string[];
16
+ properties: Record<string, OapifSchemaPropertyOptions>;
17
+ }
18
+ export interface OapifSchemaPropertyOptions {
19
+ 'title'?: string;
20
+ 'description'?: string;
21
+ 'type'?: OapifPropertyTypes;
22
+ 'format'?: OapifPropertyFormats;
23
+ 'x-ogc-role'?: string;
24
+ 'x-ogc-propertySeq'?: number;
25
+ 'readOnly'?: boolean;
26
+ 'pattern'?: string;
27
+ 'minLength'?: number;
28
+ 'maxLength'?: number;
29
+ 'minimum'?: number;
30
+ 'maximum'?: number;
31
+ 'exclusiveMinimum'?: number;
32
+ 'exclusiveMaximum'?: number;
33
+ 'enum'?: string[] | number[];
34
+ 'oneOf'?: {
35
+ const: string | number;
36
+ title?: string;
37
+ }[];
38
+ 'x-ogc-collectionId'?: string;
39
+ 'x-ogc-nullValues'?: Array<string | number>;
40
+ }
41
+ export interface OapifReferenceList {
42
+ value: string | number;
43
+ title: string;
44
+ }
45
+ export interface OapifCollection {
46
+ id: string;
47
+ title?: string;
48
+ description?: string;
49
+ links: OgcApiLinksResponse[];
50
+ itemType?: string;
51
+ extent?: {
52
+ spatial: {
53
+ bbox: number[][];
54
+ crs: string;
55
+ };
56
+ temporal?: {
57
+ interval: string[][];
58
+ trs: string;
59
+ };
60
+ };
61
+ crs?: string[];
62
+ storageCrs?: string;
63
+ }
64
+ export declare const supportedGeometryTypesForEditing: olGeometryType[];
65
+ export declare const EditingOperations: {
66
+ readonly POST: "CREATE";
67
+ readonly PUT: "REPLACE";
68
+ readonly PATCH: "UPDATE";
69
+ readonly DELETE: "DELETE";
70
+ };
71
+ export type EditingPermission = 'CREATE' | 'REPLACE' | 'UPDATE' | 'DELETE';
@@ -0,0 +1,29 @@
1
+ export const oapifNumericFormats = [
2
+ 'integer',
3
+ 'number',
4
+ 'double',
5
+ 'float',
6
+ 'decimal',
7
+ 'int',
8
+ 'int32',
9
+ 'int64',
10
+ 'uint32',
11
+ 'uint64'
12
+ ];
13
+ export const oapifStringFormats = ['string', 'uuid', 'uri-template'];
14
+ export const oapifTemporalFormats = ['date', 'time', 'date-time', 'datetime'];
15
+ export const oapifPropertyFormatList = [
16
+ ...oapifNumericFormats,
17
+ ...oapifStringFormats,
18
+ ...oapifTemporalFormats
19
+ ];
20
+ export const supportedGeometryTypesForEditing = [
21
+ 'Point',
22
+ 'LineString',
23
+ 'LinearRing',
24
+ 'Polygon',
25
+ 'MultiPoint',
26
+ 'MultiLineString',
27
+ 'MultiPolygon'
28
+ ];
29
+ export const EditingOperations = { POST: 'CREATE', PUT: 'REPLACE', PATCH: 'UPDATE', DELETE: 'DELETE' };
@@ -1,17 +1,19 @@
1
- import { GMFServerOgc, GMFServerOgcType } from './gmf.js';
1
+ import { GMFServerOgc, GMFServerOgcServices, GMFServerOgcType } from './gmf.js';
2
2
  export default class ServerOgc {
3
3
  name: string;
4
4
  url: string;
5
5
  wfsSupport: boolean;
6
6
  urlWfs?: string;
7
- oapifSupport: boolean;
8
- urlOapif?: string;
9
7
  type: GMFServerOgcType;
10
8
  imageType: string;
11
9
  aliases: Record<string, string>;
10
+ services: GMFServerOgcServices;
12
11
  constructor(name: string, elem: GMFServerOgc);
13
12
  private getAliasKey;
14
13
  private initializeAliases;
14
+ private initializeServices;
15
15
  getAlias(table: string, column: string): string;
16
16
  get uniqueWmsQueryId(): string;
17
+ getUniqueLayerName(layerName: string): string;
18
+ get hasEditService(): boolean;
17
19
  }
@@ -1,23 +1,23 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { supportedOgcServicesForEdit } from './gmf.js';
1
3
  export default class ServerOgc {
2
4
  name;
3
5
  url;
4
- wfsSupport;
5
- urlWfs;
6
- oapifSupport;
7
- urlOapif;
6
+ wfsSupport; // Deprecated for use in GeoGirafe since GMF version 2.10
7
+ urlWfs; // Deprecated for use in GeoGirafe since GMF version 2.10
8
8
  type;
9
9
  imageType;
10
10
  aliases;
11
+ services;
11
12
  constructor(name, elem) {
12
13
  this.name = name;
13
14
  this.url = elem.url;
14
15
  this.wfsSupport = elem.wfsSupport;
15
16
  this.urlWfs = elem.urlWfs;
16
- this.oapifSupport = elem.oapifSupport ?? false;
17
- this.urlOapif = elem.urlOapif;
18
17
  this.type = elem.type;
19
18
  this.imageType = elem.imageType;
20
19
  this.aliases = this.initializeAliases(elem);
20
+ this.services = this.initializeServices(elem);
21
21
  }
22
22
  getAliasKey(table, column) {
23
23
  return `${table}-${column}`;
@@ -35,6 +35,13 @@ export default class ServerOgc {
35
35
  }
36
36
  return aliases;
37
37
  }
38
+ initializeServices(elem) {
39
+ if (elem.uses?.edit && !supportedOgcServicesForEdit.includes(elem.uses?.edit.protocol)) {
40
+ console.warn(`OgcServer - Unsupported protocol '${elem.uses.edit.protocol}' for edit service`);
41
+ delete elem.uses.edit;
42
+ }
43
+ return elem.uses ?? {};
44
+ }
38
45
  getAlias(table, column) {
39
46
  const key = this.getAliasKey(table, column);
40
47
  return this.aliases[key];
@@ -42,4 +49,10 @@ export default class ServerOgc {
42
49
  get uniqueWmsQueryId() {
43
50
  return this.name + this.imageType;
44
51
  }
52
+ getUniqueLayerName(layerName) {
53
+ return `${this.name}-${layerName}`;
54
+ }
55
+ get hasEditService() {
56
+ return !!this.services.edit && !!this.services.edit.url && this.services.edit.protocol === 'OGC API - Features';
57
+ }
45
58
  }
@@ -6,6 +6,8 @@ export default class ServerOgcApi {
6
6
  }
7
7
  export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS';
8
8
  export declare const OgcApiDefaultEncoding = "application/json";
9
+ export declare const OgcApiGeoJsonEncoding = "application/geo+json";
10
+ export declare const OgcApiSchemaEncoding = "application/schema+json";
9
11
  export type OgcApiLinksResponse = {
10
12
  href: string;
11
13
  rel: string;
@@ -6,3 +6,5 @@ export default class ServerOgcApi {
6
6
  }
7
7
  }
8
8
  export const OgcApiDefaultEncoding = 'application/json';
9
+ export const OgcApiGeoJsonEncoding = 'application/geo+json';
10
+ export const OgcApiSchemaEncoding = 'application/schema+json';
@@ -1,65 +1,8 @@
1
- import ServerOgcApi, { OgcApiLinksResponse } from './serverogcapi.js';
2
- import ServerOgc from './serverogc.js';
3
- export declare const oapifNumericTypes: string[];
4
- export declare const oapifTextTypes: string[];
5
- export declare const oapifTemporalTypes: string[];
6
- export declare const oapifPropertyTypesList: readonly string[];
7
- export type oapifPropertyTypes = (typeof oapifPropertyTypesList)[number];
1
+ import ServerOgcApi from './serverogcapi.js';
2
+ import { OapifCollection } from './oapiftypes.js';
8
3
  export default class ServerOgcApiFeatures extends ServerOgcApi {
4
+ collections: Map<string, OapifCollection>;
9
5
  constructor(url: string);
6
+ addCollection(collection: OapifCollection): void;
7
+ get hasEditableLayers(): boolean;
10
8
  }
11
- export type OapifSchemaResponse = {
12
- $id?: string;
13
- $schema?: string;
14
- title?: string;
15
- description?: string;
16
- type?: string;
17
- properties: Record<string, OapifPropertySchema>;
18
- };
19
- export type OapifPropertySchema = {
20
- 'title'?: string;
21
- 'description'?: string;
22
- 'type'?: oapifPropertyTypes;
23
- 'format'?: string;
24
- 'x-ogc-role'?: string;
25
- 'x-ogc-propertySeq'?: number;
26
- 'readOnly'?: boolean;
27
- 'required'?: boolean;
28
- 'maxLength'?: number;
29
- 'minimum'?: number;
30
- 'maximum'?: number;
31
- 'enum'?: Array<string | number>;
32
- 'oneOf'?: {
33
- const: string;
34
- value: string;
35
- }[];
36
- 'x-orc-codelistUri'?: string;
37
- };
38
- export type OapifCollection = {
39
- id: string;
40
- title: string;
41
- description?: string;
42
- links: OgcApiLinksResponse[];
43
- itemType: string;
44
- extent?: {
45
- spatial: {
46
- bbox: number[][];
47
- crs: string;
48
- };
49
- };
50
- crs?: string[];
51
- storageCrs?: string;
52
- };
53
- export type OapifLayer = {
54
- url: string;
55
- collectionId: string;
56
- collectionTitle: string;
57
- displayName: string;
58
- crs: string;
59
- credentials?: string;
60
- geometryType: 'Point' | 'LineString' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon';
61
- attributeName: string;
62
- attributeType: string;
63
- serverType: string;
64
- server: ServerOgc;
65
- };
@@ -1,11 +1,15 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  import ServerOgcApi from './serverogcapi.js';
3
- export const oapifNumericTypes = ['integer', 'number', 'double', 'float', 'decimal', 'int', 'int32', 'int64'];
4
- export const oapifTextTypes = ['string', 'date', 'time', 'datetime', 'date-time', 'duration'];
5
- export const oapifTemporalTypes = ['date', 'time', 'date-time', 'datetime'];
6
- export const oapifPropertyTypesList = [...oapifNumericTypes, ...oapifTextTypes, ...oapifTemporalTypes];
7
3
  export default class ServerOgcApiFeatures extends ServerOgcApi {
4
+ collections;
8
5
  constructor(url) {
9
6
  super(url);
7
+ this.collections = new Map();
8
+ }
9
+ addCollection(collection) {
10
+ this.collections.set(collection.id, collection);
11
+ }
12
+ get hasEditableLayers() {
13
+ return this.collections.size > 0;
10
14
  }
11
15
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "GeoGirafe PSC",
6
6
  "url": "https://doc.geogirafe.org"
7
7
  },
8
- "version": "1.3.0-dev.3046054236",
8
+ "version": "1.3.0-dev.3060317043",
9
9
  "type": "module",
10
10
  "engines": {
11
11
  "node": ">=20.19.0"
@@ -82,6 +82,7 @@
82
82
  <girafe-map-2d></girafe-map-2d>
83
83
  <girafe-map-3d></girafe-map-3d>
84
84
  <girafe-streetview-google></girafe-streetview-google>
85
+ <girafe-streetview-mapillary></girafe-streetview-mapillary>
85
86
  </girafe-map-grid>
86
87
  <girafe-basemap></girafe-basemap>
87
88
  <girafe-search id="search"></girafe-search>
@@ -110,6 +110,7 @@
110
110
  <girafe-map-2d></girafe-map-2d>
111
111
  <girafe-map-3d></girafe-map-3d>
112
112
  <girafe-streetview-google></girafe-streetview-google>
113
+ <girafe-streetview-mapillary></girafe-streetview-mapillary>
113
114
  </girafe-map-grid>
114
115
  <div class="info-area">
115
116
  <girafe-basemap data-tour="basemap-selection"></girafe-basemap>
@@ -238,6 +239,7 @@
238
239
  <button
239
240
  tip="edit-panel"
240
241
  slot="menu-content"
242
+ data-visibility-control="edit"
241
243
  class="gg-icon-button gg-big"
242
244
  onclick="
243
245
  document.geogirafe.state.interface.editPanelVisible = !document.geogirafe.state.interface.editPanelVisible
@@ -97,6 +97,7 @@
97
97
  <girafe-map-2d></girafe-map-2d>
98
98
  <girafe-map-3d></girafe-map-3d>
99
99
  <girafe-streetview-google></girafe-streetview-google>
100
+ <girafe-streetview-mapillary></girafe-streetview-mapillary>
100
101
  </girafe-map-grid>
101
102
  <girafe-infobox></girafe-infobox>
102
103
  </div>
@@ -1 +1 @@
1
- {"version":"1.3.0-dev.3046054236", "build":"3046054236", "date":"09/11/2026"}
1
+ {"version":"1.3.0-dev.3060317043", "build":"3060317043", "date":"12/11/2026"}
@@ -12,6 +12,7 @@ import Map2dComponent from '../../components/map-2d/component.js';
12
12
  import DeprecatedMapComponent from '../../components/map-2d/deprecatedmapcomponent.js';
13
13
  import Map3dComponent from '../../components/map-3d/component.js';
14
14
  import GoogleStreetViewComponent from '../../components/streetview/google.js';
15
+ import MapillaryStreetViewComponent from '../../components/streetview/mapillary.js';
15
16
  import MapGridComponent from '../../components/map-grid/component.js';
16
17
  import MenuMobile3dButton from '../../components/menu-buttons-mobile/MenuMobile3dButton.js';
17
18
  import MenuMobileDrawingButton from '../../components/menu-buttons-mobile/MenuMobileDrawingButton.js';
@@ -52,6 +53,7 @@ export default class GeoGirafeAppMobile extends GeoGirafeApp {
52
53
  customElements.define('girafe-map-2d', Map2dComponent);
53
54
  customElements.define('girafe-map-3d', Map3dComponent);
54
55
  customElements.define('girafe-streetview-google', GoogleStreetViewComponent);
56
+ customElements.define('girafe-streetview-mapillary', MapillaryStreetViewComponent);
55
57
  customElements.define('girafe-map-grid', MapGridComponent);
56
58
  // Deprecated alias of <girafe-map-2d>, kept for the applications that were not migrated yet.
57
59
  customElements.define('girafe-map', DeprecatedMapComponent);
@@ -11,7 +11,7 @@ import CrossSectionSettingsComponent from '../../components/cross-section/cross-
11
11
  import CrossSectionViewComponent from '../../components/cross-section/cross-section-viewer/component.js';
12
12
  import DrawingComponent, { DrawingStateLocation } from '../../components/drawing/component.js';
13
13
  import EditComponent from '../../components/edit/component.js';
14
- import EditFromComponent from '../../components/edit/editform/component.js';
14
+ import EditFormComponent from '../../components/edit/editform/component.js';
15
15
  import HelpComponent from '../../components/help/component.js';
16
16
  import InfoboxComponent from '../../components/infobox/component.js';
17
17
  import InfoWindowComponent from '../../components/infowindow/component.js';
@@ -21,6 +21,7 @@ import Map2dComponent from '../../components/map-2d/component.js';
21
21
  import DeprecatedMapComponent from '../../components/map-2d/deprecatedmapcomponent.js';
22
22
  import Map3dComponent from '../../components/map-3d/component.js';
23
23
  import GoogleStreetViewComponent from '../../components/streetview/google.js';
24
+ import MapillaryStreetViewComponent from '../../components/streetview/mapillary.js';
24
25
  import MapGridComponent from '../../components/map-grid/component.js';
25
26
  import MenuButtonComponent from '../../components/menubutton/component.js';
26
27
  import ModalsComponent from '../../components/modals/component.js';
@@ -126,6 +127,7 @@ export default class GeoGirafeApp {
126
127
  customElements.define('girafe-map-2d', Map2dComponent);
127
128
  customElements.define('girafe-map-3d', Map3dComponent);
128
129
  customElements.define('girafe-streetview-google', GoogleStreetViewComponent);
130
+ customElements.define('girafe-streetview-mapillary', MapillaryStreetViewComponent);
129
131
  customElements.define('girafe-map-grid', MapGridComponent);
130
132
  // Deprecated alias of <girafe-map-2d>, kept for the applications that were not migrated yet.
131
133
  customElements.define('girafe-map', DeprecatedMapComponent);
@@ -141,7 +143,7 @@ export default class GeoGirafeApp {
141
143
  customElements.define('girafe-drawing', DrawingComponent);
142
144
  customElements.define('girafe-drawing-toolbar', DrawingToolbarComponent);
143
145
  customElements.define('girafe-edit', EditComponent);
144
- customElements.define('girafe-edit-form', EditFromComponent);
146
+ customElements.define('girafe-edit-form', EditFormComponent);
145
147
  customElements.define('girafe-scale', ScaleComponent);
146
148
  customElements.define('girafe-search-filter', SearchFilterComponent);
147
149
  customElements.define('girafe-search', SearchComponent);
@@ -117,14 +117,7 @@ class GirafeConfig {
117
117
  // We just display a warning in the console
118
118
  console.warn(e);
119
119
  }
120
- try {
121
- this.streetview = initConfigStreetView(config);
122
- }
123
- catch (e) {
124
- // The application can be started even if the StreetView is not correctly configured
125
- // We just display a warning in the console
126
- console.warn(e);
127
- }
120
+ this.streetview = initConfigStreetView(config);
128
121
  try {
129
122
  this.news = this.initConfigNews(config);
130
123
  }
@@ -1,13 +1,24 @@
1
1
  import type { StreetViewProvider } from '../state/streetview.js';
2
2
  /** Maximal distance, in meters, between a click on the map and the footage displayed for it. */
3
3
  export declare const DEFAULT_STREETVIEW_SEARCH_RADIUS = 100;
4
+ /** The Mapillary API does not search the images further than this distance, in meters. */
5
+ export declare const MAPILLARY_MAX_SEARCH_RADIUS = 50;
6
+ export type MapillaryConfig = {
7
+ accessToken: string;
8
+ searchRadius: number;
9
+ };
4
10
  export type StreetViewConfig = {
5
11
  searchRadius: number;
6
12
  google?: {
7
13
  apiKey: string;
8
14
  };
15
+ mapillary?: MapillaryConfig;
16
+ };
17
+ type StreetViewConfigInput = Partial<Omit<StreetViewConfig, 'mapillary'>> & {
18
+ mapillary?: Partial<MapillaryConfig>;
9
19
  };
10
20
  export declare function initConfigStreetView(config: {
11
- streetview?: Partial<StreetViewConfig>;
21
+ streetview?: StreetViewConfigInput;
12
22
  }): StreetViewConfig | undefined;
13
23
  export declare function isStreetViewProviderConfigured(config: StreetViewConfig | undefined, provider: StreetViewProvider): boolean;
24
+ export {};
@@ -1,16 +1,38 @@
1
1
  /** Maximal distance, in meters, between a click on the map and the footage displayed for it. */
2
2
  export const DEFAULT_STREETVIEW_SEARCH_RADIUS = 100;
3
+ /** The Mapillary API does not search the images further than this distance, in meters. */
4
+ export const MAPILLARY_MAX_SEARCH_RADIUS = 50;
5
+ function initConfigMapillary(mapillary) {
6
+ if (!mapillary) {
7
+ return undefined;
8
+ }
9
+ if (!mapillary.accessToken) {
10
+ console.warn(`Configuration for streetview.mapillary requires an accessToken. See https://doc.geogirafe.org/docs/configuration#streetview`);
11
+ return undefined;
12
+ }
13
+ const searchRadius = mapillary.searchRadius ?? MAPILLARY_MAX_SEARCH_RADIUS;
14
+ if (searchRadius > MAPILLARY_MAX_SEARCH_RADIUS) {
15
+ console.warn(`Configuration for streetview.mapillary.searchRadius cannot exceed ${MAPILLARY_MAX_SEARCH_RADIUS} meters. See https://doc.geogirafe.org/docs/configuration#streetview`);
16
+ return undefined;
17
+ }
18
+ return { accessToken: mapillary.accessToken, searchRadius: searchRadius };
19
+ }
20
+ function initConfigGoogle(google) {
21
+ if (google && !google.apiKey) {
22
+ console.warn(`Configuration for streetview.google requires an apiKey. See https://doc.geogirafe.org/docs/configuration#streetview`);
23
+ return undefined;
24
+ }
25
+ return google;
26
+ }
3
27
  export function initConfigStreetView(config) {
4
28
  const streetview = config.streetview;
5
29
  if (!streetview) {
6
30
  return undefined;
7
31
  }
8
- if (streetview.google && !streetview.google.apiKey) {
9
- throw new Error(`Configuration for streetview.google requires an apiKey. See https://doc.geogirafe.org/docs/configuration`);
10
- }
11
32
  return {
12
33
  searchRadius: streetview.searchRadius ?? DEFAULT_STREETVIEW_SEARCH_RADIUS,
13
- google: streetview.google
34
+ google: initConfigGoogle(streetview.google),
35
+ mapillary: initConfigMapillary(streetview.mapillary)
14
36
  };
15
37
  }
16
38
  export function isStreetViewProviderConfigured(config, provider) {
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  import DrawingFeature, { DrawingShape } from './drawingFeature.js';
3
3
  import { Collection, Feature } from 'ol';
4
- import { Circle as CircleGeom, Geometry, LinearRing, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from 'ol/geom.js';
4
+ import { Circle as CircleGeom, Geometry, LineString, Point, Polygon } from 'ol/geom.js';
5
5
  import { createBox, createRegularPolygon } from 'ol/interaction/Draw.js';
6
6
  import { Circle, Fill, RegularShape, Stroke, Style, Text } from 'ol/style.js';
7
7
  import { Draw, Modify, Snap, Translate } from 'ol/interaction.js';
@@ -15,7 +15,7 @@ import { ContextMenu, EntryInteractionType } from './contextmenu.js';
15
15
  import { formatCoordinates } from '../geometrytools.js';
16
16
  import { v4 as uuidv4 } from 'uuid';
17
17
  import { isAlternateMouseClick, isPrimaryPointerAction } from '../state/userinteractionevent.js';
18
- import { calculateCenterAndMinRadius, createScaledAndRotatedGeometry, getGeometryForRendering, shouldAllowVertexInsertionForShape } from './shapeConstraints.js';
18
+ import { calculateCenterAndMinRadius, createScaledAndRotatedGeometry, extractVerticesFromGeometry, getGeometryForRendering, shouldAllowVertexInsertionForShape } from './shapeConstraints.js';
19
19
  import Transform from 'ol-ext/interaction/Transform.js';
20
20
  function getLineStroke(strokeType, lineWidth) {
21
21
  switch (strokeType) {
@@ -29,26 +29,6 @@ function getLineStroke(strokeType, lineWidth) {
29
29
  return [0.01, 5 * lineWidth];
30
30
  }
31
31
  }
32
- function extractVerticesFromGeometry(geometry) {
33
- let vertices = [];
34
- // Extract coordinates depending on coordinate array depth
35
- if (geometry instanceof Point) {
36
- vertices = [geometry.getCoordinates()];
37
- }
38
- else if (geometry instanceof MultiPoint || geometry instanceof LineString || geometry instanceof LinearRing) {
39
- vertices = geometry.getCoordinates();
40
- }
41
- else if (geometry instanceof Polygon || geometry instanceof MultiLineString) {
42
- vertices = geometry.getCoordinates().flat();
43
- }
44
- else if (geometry instanceof MultiPolygon) {
45
- vertices = geometry
46
- .getCoordinates()
47
- .flat()
48
- .map((coordinateList) => coordinateList.flat());
49
- }
50
- return new MultiPoint(vertices);
51
- }
52
32
  export default class OlDrawing {
53
33
  map;
54
34
  // Writes drawn features into the specified location in the extended state
@@ -1,7 +1,7 @@
1
1
  import { Coordinate } from 'ol/coordinate.js';
2
- import Geometry from 'ol/geom/Geometry.js';
3
2
  import Feature from 'ol/Feature.js';
4
3
  import { DrawingShape } from './drawingFeature.js';
4
+ import { Geometry, MultiPoint } from 'ol/geom.js';
5
5
  export declare function calculateCenterAndMinRadius(geometry: Geometry): {
6
6
  center: Coordinate;
7
7
  minRadius: number;
@@ -9,3 +9,4 @@ export declare function calculateCenterAndMinRadius(geometry: Geometry): {
9
9
  export declare function createScaledAndRotatedGeometry(geometry0: Geometry, center: Coordinate, minRadius: number, initialPoint: Coordinate, currentPoint: Coordinate): Geometry;
10
10
  export declare function getGeometryForRendering(feature: Feature<Geometry>): Geometry | undefined;
11
11
  export declare function shouldAllowVertexInsertionForShape(shapeType: DrawingShape | undefined): boolean;
12
+ export declare function extractVerticesFromGeometry(geometry: Geometry): MultiPoint;
@@ -1,8 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  import { getCenter, getHeight, getWidth } from 'ol/extent.js';
3
- import LineString from 'ol/geom/LineString.js';
4
- import Polygon from 'ol/geom/Polygon.js';
5
3
  import { DrawingShape } from './drawingFeature.js';
4
+ import { LinearRing, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from 'ol/geom.js';
6
5
  const EPSILON = 1e-12;
7
6
  function sqDistance(a, b) {
8
7
  const dx = a[0] - b[0];
@@ -62,3 +61,20 @@ export function getGeometryForRendering(feature) {
62
61
  export function shouldAllowVertexInsertionForShape(shapeType) {
63
62
  return shapeType !== DrawingShape.Square && shapeType !== DrawingShape.Rectangle;
64
63
  }
64
+ export function extractVerticesFromGeometry(geometry) {
65
+ let vertices = [];
66
+ // Extract coordinates depending on coordinate array depth
67
+ if (geometry instanceof Point) {
68
+ vertices = [geometry.getCoordinates()];
69
+ }
70
+ else if (geometry instanceof MultiPoint || geometry instanceof LineString || geometry instanceof LinearRing) {
71
+ vertices = geometry.getCoordinates();
72
+ }
73
+ else if (geometry instanceof Polygon || geometry instanceof MultiLineString) {
74
+ vertices = geometry.getCoordinates().flat();
75
+ }
76
+ else if (geometry instanceof MultiPolygon) {
77
+ vertices = geometry.getCoordinates().flat().flat();
78
+ }
79
+ return new MultiPoint(vertices);
80
+ }