jmapcloud-ng-core-types 1.0.6 → 1.0.8

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/index.ts CHANGED
@@ -148,6 +148,7 @@ export interface JPhotoService {
148
148
  export interface JFeatureService {
149
149
  getById(layerId: JId, featureId: JId): Promise<GeoJSON.Feature>
150
150
  getByIds(layerId: JId, featureIds: JId[]): Promise<GeoJSON.Feature[]>
151
+ getByLayerId(layerId: JId, bbox: JBoundaryBox): Promise<GeoJSON.Feature[]>
151
152
  geometryUpdateById(params: JFeatureGeometryUpdateParams): Promise<GeoJSON.Feature>
152
153
  deleteById(layerId: JId, featureId: JId): Promise<JId>
153
154
  // deleteByIds(layerId: JId, featureIds: JId[]): Promise<JFeatureDeleteByIdsResult>
@@ -708,14 +709,10 @@ export interface JMapService {
708
709
  setMapInfoControlVisibility(isVisible: boolean): void
709
710
  isMapInfoControlExpanded(): boolean
710
711
  setMapInfoControlExpansion(isExpanded: boolean): void
711
- isLayerRendered(layerId: JId): boolean
712
- getLayersVisibilityStatus(): JMapLayersVisibilityStatus
713
- getLayersVisibilityStatusAsArray(): JMapLayerVisibilityStatus[]
714
712
  getMaplibreSupportedJMapLayerIds(): JId[]
715
713
  getMaplibreSupportedJMapLayerIdBefore(layerId: JId): JId | undefined
716
714
  getMaplibreSupportedJMapLayerIdAfter(layerId: JId): JId | undefined
717
715
  refreshLayerById(layerId: JId): void
718
- getRenderedJMapLayerIds(): JId[]
719
716
  getRenderedFeatures(layerId: JId, params?: JLocation | JBoundaryBox | JCircle | JGetRenderedFeaturesParams): Feature[]
720
717
  getSourceFeatures(layerId: JId, params?: JGetSourceFeaturesParams): Feature[]
721
718
  getRenderedFeaturesAttributeValues(
@@ -825,8 +822,8 @@ export interface JMapFilterService {
825
822
  }
826
823
 
827
824
  export interface JProjectionService {
828
- reprojectLocation(location: JLocation, toProjection: string, fromProjection?: string): JLocation
829
- reprojectBoundaryBox(boundaryBox: JBoundaryBox, toProjection: string, fromProjection?: string): JBoundaryBox
825
+ reprojectLocation(location: JLocation, toProjection: string, fromProjection?: string): Promise<JLocation>
826
+ reprojectBoundaryBox(boundaryBox: JBoundaryBox, toProjection: string, fromProjection?: string): Promise<JBoundaryBox>
830
827
  }
831
828
 
832
829
  export interface JProjectService {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/public/core.d.ts CHANGED
@@ -129,7 +129,6 @@ declare namespace JMap {
129
129
  */
130
130
  function getVersion(): JServerVersion
131
131
 
132
-
133
132
  /**
134
133
  * **JMap.Server.isMinimumVersionRespected**
135
134
  *
@@ -456,6 +455,33 @@ declare namespace JMap {
456
455
  */
457
456
  function getById(layerId: JId, featureId: JId): Promise<GeoJSON.Feature>
458
457
 
458
+ /**
459
+ * **JMap.Feature.getByLayerId**
460
+ *
461
+ * Returns the feature (EPSG:4326 projection) for the given layer and bbox.
462
+ *
463
+ * @param layerId the JMap layer id
464
+ * @param bbox the bounding box
465
+ * @throws if layer not found or bbox is invalid
466
+ * @example ```ts
467
+ *
468
+ * // returns the feature of layer id="36885146-7eed-4071-9f86-8e29c505af91" and bbox
469
+ * JMap.Feature.getByLayer("36885146-7eed-4071-9f86-8e29c505af91", {
470
+ * ne: {
471
+ * x: -73.69935286533261,
472
+ * y: 45.51487645603402
473
+ * },
474
+ * sw: {
475
+ * x: -73.78637009135603,
476
+ * y: 45.47581946298703
477
+ * }
478
+ * })
479
+ * .then(features => console.info("Features has been fetched", features))
480
+ * .catch(error => console.error("An error occured", error))
481
+ * ```
482
+ */
483
+
484
+ function getByLayerId(layerId: JId, bbox: JBoundaryBox): Promise<GeoJSON.Feature[]>
459
485
  /**
460
486
  * **JMap.Feature.getByIds**
461
487
  *
@@ -1834,20 +1860,16 @@ declare namespace JMap {
1834
1860
  *
1835
1861
  * Returns the extent of the layer in ESPG:4326 coordinates
1836
1862
  *
1837
- * With a JMap Cloud server, a call is made to the server.
1838
- *
1839
- * With a JMap 7 server, no call to server is made, returns the cached extent.
1840
- *
1841
1863
  * @example ```ts
1842
1864
  *
1843
- * // returns the bounding box (JBoundaryBox) of the layer ID 3 in decimal degrees
1865
+ * // returns the bounding box (JBoundaryBox) of the layer ID "5d86a209-3a09-49d9-92f0-dce3c46bb23d" in decimal degrees
1844
1866
  * JMap.Layer
1845
- * .getEPSG4326Extent(3)
1846
- * .then(extent => console.info("Extent of layer id=3", extent))
1867
+ * .getEPSG4326Extent("5d86a209-3a09-49d9-92f0-dce3c46bb23d")
1868
+ * .then(extent => console.info("Extent of layer id=\"5d86a209-3a09-49d9-92f0-dce3c46bb23d\"", extent))
1847
1869
  * .catch(error => console.error(error))
1848
1870
  * ```
1849
1871
  *
1850
- * @throws Error if no layer found for the id
1872
+ * @throws Error if no layer found for the id or if layer is a group
1851
1873
  * @param layerId The JMap layer id
1852
1874
  */
1853
1875
  function getEPSG4326Extent(layerId: JId): Promise<JBoundaryBox | null>
@@ -3151,96 +3173,6 @@ declare namespace JMap {
3151
3173
  */
3152
3174
  function getScaleControlPosition(): JMAP_POSITIONS
3153
3175
 
3154
- /**
3155
- * **JMap.Map.isLayerRendered**
3156
- *
3157
- * Returns true if layer is visible on the map.
3158
- *
3159
- * To be true the layer visibility property has to be true,
3160
- * and the current map scale between the layer min and max scale.
3161
- *
3162
- * @example ```ts
3163
- *
3164
- * // returns true if layer is visible on the map
3165
- * JMap.Map.isLayerRendered(4)
3166
- * ```
3167
- */
3168
- function isLayerRendered(layerId: JId): boolean
3169
-
3170
- /**
3171
- * **JMap.Map.getLayersVisibilityStatus**
3172
- *
3173
- * Returns layers visibility status.
3174
- *
3175
- * The result is a map (= javascript object) where :
3176
- * - the key is the JMap layer id
3177
- * - the value is a JMapLayersVisibilityStatus object
3178
- *
3179
- * A JMapLayersVisibilityStatus object has the following properties :
3180
- * - layerId: the layer id
3181
- * - layerName: the layer name
3182
- * - isRendered: true if 'visibilityProperty', 'parentVisibility',
3183
- * 'scaleVisibility' and 'extentVisibility' are all true
3184
- * - visibilityProperty: user can show or hide a layer
3185
- * - parentVisibility: returns false if one of its group parent(s) has
3186
- * its visibility property equals to false
3187
- * - scaleVisibility: returns false if at the current scale the layer
3188
- * cannot be displayed
3189
- * - extentVisibility: returns false if the extent of the layer is not
3190
- * contains by the current view of the map
3191
- *
3192
- * @example ```ts
3193
- *
3194
- * // returns the visibility status
3195
- * JMap.Map.getLayersVisibilityStatus()
3196
- *
3197
- * // Example of result :
3198
- * {
3199
- * 1: { layerId: 1, layerName: "layer 1", isRendered: true, visibilityProperty: true, parentVisibility: true, scaleVisibility: true, extentVisibility: true }
3200
- * 2: { layerId: 2, layerName: "layer 2", isRendered: false, visibilityProperty: true, parentVisibility: true, scaleVisibility: false, extentVisibility: true }
3201
- * 3: { layerId: 3, layerName: "layer 3", isRendered: false, visibilityProperty: false, parentVisibility: true, scaleVisibility: false, extentVisibility: true }
3202
- * 4: { layerId: 4, layerName: "layer 4", isRendered: false, visibilityProperty: false, parentVisibility: false, scaleVisibility: false, extentVisibility: true }
3203
- * 5: { layerId: 5, layerName: "layer 5", isRendered: false, visibilityProperty: true, parentVisibility: true, scaleVisibility: true, extentVisibility: false }
3204
- * }
3205
- * ```
3206
- */
3207
- function getLayersVisibilityStatus(): JMapLayersVisibilityStatus
3208
-
3209
- /**
3210
- * **JMap.Map.getLayersVisibilityStatusAsArray**
3211
- *
3212
- * Returns layers visibility status as an array of JMapLayersVisibilityStatus object.
3213
- *
3214
- * A JMapLayersVisibilityStatus object has the following properties :
3215
- * - layerId: the layer id
3216
- * - layerName: the layer name
3217
- * - isRendered: true if 'visibilityProperty', 'parentVisibility',
3218
- * 'scaleVisibility' and 'extentVisibility' are all true
3219
- * - visibilityProperty: user can show or hide a layer
3220
- * - parentVisibility: returns false if one of its group parent(s) has
3221
- * its visibility property equals to false
3222
- * - scaleVisibility: returns false if at the current scale the layer
3223
- * cannot be displayed
3224
- * - extentVisibility: returns false if the extent of the layer is not
3225
- * contains by the current view of the map
3226
- *
3227
- * @example ```ts
3228
- *
3229
- * // returns the visibility status as an object array
3230
- * JMap.Map.getLayersVisibilityStatusAsArray()
3231
- *
3232
- * // Example of result :
3233
- * [
3234
- * { layerId: 1, layerName: "layer 1", isRendered: true, visibilityProperty: true, parentVisibility: true, scaleVisibility: true, extentVisibility: true }
3235
- * { layerId: 2, layerName: "layer 2", isRendered: false, visibilityProperty: true, parentVisibility: true, scaleVisibility: false, extentVisibility: true }
3236
- * { layerId: 3, layerName: "layer 3", isRendered: false, visibilityProperty: false, parentVisibility: true, scaleVisibility: false, extentVisibility: true }
3237
- * { layerId: 4, layerName: "layer 4", isRendered: false, visibilityProperty: false, parentVisibility: false, scaleVisibility: false, extentVisibility: true }
3238
- * { layerId: 5, layerName: "layer 5", isRendered: false, visibilityProperty: true, parentVisibility: true, scaleVisibility: true, extentVisibility: false }
3239
- * ]
3240
- * ```
3241
- */
3242
- function getLayersVisibilityStatusAsArray(): JMapLayerVisibilityStatus[]
3243
-
3244
3176
  /**
3245
3177
  * **JMap.Map.getMaplibreSupportedJMapLayerIds**
3246
3178
  *
@@ -3308,23 +3240,6 @@ declare namespace JMap {
3308
3240
  */
3309
3241
  function refreshLayerById(layerId: JId): void
3310
3242
 
3311
- /**
3312
- * **JMap.Map.getRenderedJMapLayerIds**
3313
- *
3314
- * Returns the ids of the layers that are displayed on the map.
3315
- *
3316
- * The Map JS library doesn't support all layer types defined on JMap Server.
3317
- *
3318
- * This function returns all layers ids that are managed by the map.
3319
- *
3320
- * @example ```ts
3321
- *
3322
- * // returns all layer ids that are managed by the map
3323
- * JMap.Map.getRenderedJMapLayerIds()
3324
- * ```
3325
- */
3326
- function getRenderedJMapLayerIds(): JId[]
3327
-
3328
3243
  /**
3329
3244
  * **JMap.Map.getRenderedFeatures**
3330
3245
  *
@@ -5939,7 +5854,7 @@ declare namespace JMap {
5939
5854
  * @example ```ts
5940
5855
  *
5941
5856
  * // returns the location in long/lat
5942
- * const longLatLocation = JMap.Projection.reprojectLocation({
5857
+ * const longLatLocation = await JMap.Projection.reprojectLocation({
5943
5858
  * x: -8251305.053809433,
5944
5859
  * y: 5683448.361086178
5945
5860
  * },
@@ -5949,7 +5864,7 @@ declare namespace JMap {
5949
5864
  * console.log("Long/lat location", longLatLocation)
5950
5865
  * ```
5951
5866
  */
5952
- function reprojectLocation(location: JLocation, toProjection: string, fromProjection?: string): JLocation
5867
+ function reprojectLocation(location: JLocation, toProjection: string, fromProjection?: string): Promise<JLocation>
5953
5868
 
5954
5869
  /**
5955
5870
  * ***JMap.Projection.reprojectBoundaryBox***
@@ -5963,7 +5878,7 @@ declare namespace JMap {
5963
5878
  * @example ```ts
5964
5879
  *
5965
5880
  * // returns the boundary box in long/lat
5966
- * const longLatBbox = JMap.Projection.reprojectBoundaryBox({
5881
+ * const longLatBbox = await JMap.Projection.reprojectBoundaryBox({
5967
5882
  * x: -8251305.053809433,
5968
5883
  * y: 5683448.361086178
5969
5884
  * },
@@ -5977,7 +5892,7 @@ declare namespace JMap {
5977
5892
  boundaryBox: JBoundaryBox,
5978
5893
  toProjection: string,
5979
5894
  fromProjection?: string
5980
- ): JBoundaryBox
5895
+ ): Promise<JBoundaryBox>
5981
5896
  }
5982
5897
 
5983
5898
  /**
@@ -6474,9 +6389,7 @@ declare namespace JMap {
6474
6389
  * /*
6475
6390
  * ```
6476
6391
  */
6477
- function getPasswordPolicyCompliance(
6478
- password: string
6479
- ): JJMapPasswordPolicyCompliance
6392
+ function getPasswordPolicyCompliance(password: string): JJMapPasswordPolicyCompliance
6480
6393
 
6481
6394
  /**
6482
6395
  * ***JMap.User.isPseudoUser***
@@ -123,20 +123,6 @@ declare type JMapSelection = {
123
123
  [key in JId]: GeoJSON.Feature[]
124
124
  }
125
125
 
126
- declare interface JMapLayerVisibilityStatus {
127
- layerId: JId
128
- layerName: string
129
- isRendered: boolean
130
- visibilityProperty: boolean
131
- parentVisibility: boolean
132
- scaleVisibility: boolean
133
- extentVisibility: boolean
134
- }
135
-
136
- declare type JMapLayersVisibilityStatus = {
137
- [key in JId]: JMapLayerVisibilityStatus
138
- }
139
-
140
126
  declare interface JProjection {
141
127
  code: string
142
128
  name: string