@nextgis/ngw-map 1.9.7 → 1.10.0

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/lib/index.d.ts CHANGED
@@ -206,7 +206,7 @@ export declare interface NgwMapOptions<C = any> extends MapOptions<C> {
206
206
  *
207
207
  * @example
208
208
  * ```javascript
209
- * var ngwMap = new NgwMap({webmapId: [3985, 'my-webmap']});
209
+ * const ngwMap = new NgwMap({webmapId: [3985, 'my-webmap']});
210
210
  * ngwMap.hideLayer('my-webmap');
211
211
  * ```
212
212
  */
@@ -219,25 +219,52 @@ export declare interface NgwMapOptions<C = any> extends MapOptions<C> {
219
219
  *
220
220
  * @example
221
221
  * ```javascript
222
- * var ngwMap = new NgwMap({qmsId: [465, 'qms-basemap']});
222
+ * const ngwMap = new NgwMap({qmsId: [465, 'qms-basemap']});
223
223
  * ngwMap.hideLayer('qms-basemap');
224
224
  * ```
225
225
  */
226
- resources?: NgwResourceDefinition[];
227
226
  qmsId?: number | [number, string];
228
227
  /**
229
- * Shortcut to add OSM baselayer
230
- */
231
- osm?: boolean;
232
- /**
233
- * Set default paint for vector layers geometry objects.
228
+ * List of NGW resources to be displayed on the map.
229
+ *
230
+ * The resources list may include:
231
+ *
232
+ * - number - resource id; // also for resource
233
+ * - string - resource keyname; // also for resource
234
+ * - object - configuration of the layer to be added
235
+ * with the one required parameter `resource` (the comment "also for resource" above refers to it)
236
+ *
237
+ * @example
238
+ * ```javascript
239
+ * NgwMap.create({
240
+ * baseUrl: "https://demo.nextgis.com",
241
+ * target: "map",
242
+ * resources: [
243
+ * // Basemap resource
244
+ * 1665,
245
+ * // Digital Elevation Model (DEM)-style
246
+ * 4117,
247
+ * // Hillshade-style
248
+ * { resource: 4115, adapter: "TILE", opacity: 0.3 },
249
+ * // Elevation contours-style
250
+ * 'contours-style',
251
+ * // Vector from Order boundary-style
252
+ * {
253
+ * resource: 4111,
254
+ * fit: true,
255
+ * adapter: "GEOJSON",
256
+ * adapterOptions: { paint: { color: "red", fill: false, weight: 4 } },
257
+ * },
258
+ * ],
259
+ * });
260
+ * ```
234
261
  */
262
+ resources?: NgwResourceDefinition[];
235
263
  /**
236
- * Get information from NGW webmap layers by click.
237
- *
238
- * @defaultValue false
264
+ * Shortcut to add OSM baselayer.
239
265
  */
240
- identification?: boolean;
266
+ osm?: boolean;
267
+ /* Excluded from this release type: identification */
241
268
  whitlabel?: boolean;
242
269
  companyLogoOptions?: CompanyLogoOptions;
243
270
  pixelRadius?: number;
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.9.7; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.10.0; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.9.7; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.10.0; author: NextGIS */
2
2
  var events = {exports: {}};
3
3
 
4
4
  var R = typeof Reflect === 'object' ? Reflect : null;
@@ -1686,7 +1686,7 @@ const OPTIONS$1 = {
1686
1686
  minZoom: 0,
1687
1687
  maxZoom: 20,
1688
1688
  paint: {
1689
- color: 'blue',
1689
+ color: '#0000ff',
1690
1690
  opacity: 0.4,
1691
1691
  strokeOpacity: 1,
1692
1692
  stroke: true,
@@ -1694,7 +1694,7 @@ const OPTIONS$1 = {
1694
1694
  weight: 1,
1695
1695
  },
1696
1696
  selectedPaint: {
1697
- color: 'darkblue',
1697
+ color: '#00008b',
1698
1698
  opacity: 0.4,
1699
1699
  strokeOpacity: 1,
1700
1700
  stroke: true,
@@ -2844,6 +2844,30 @@ class WebMapLayers extends WebMapMain {
2844
2844
  adapter.clearLayer(cb);
2845
2845
  }
2846
2846
  }
2847
+ setLayerPaint(layerDef, paint) {
2848
+ const layer = this.getLayer(layerDef);
2849
+ if (paint && layer && layer.setPaint) {
2850
+ layer.setPaint(paint);
2851
+ }
2852
+ }
2853
+ setLayerSelectedPaint(layerDef, paint) {
2854
+ const layer = this.getLayer(layerDef);
2855
+ if (paint && layer && layer.setSelectedPaint) {
2856
+ layer.setSelectedPaint(paint);
2857
+ }
2858
+ }
2859
+ updateLayerPaint(layerDef, paint) {
2860
+ const layer = this.getLayer(layerDef);
2861
+ if (paint && layer && layer.updatePaint) {
2862
+ layer.updatePaint(paint);
2863
+ }
2864
+ }
2865
+ updateLayerSelectedPaint(layerDef, paint) {
2866
+ const layer = this.getLayer(layerDef);
2867
+ if (paint && layer && layer.updateSelectedPaint) {
2868
+ layer.updateSelectedPaint(paint);
2869
+ }
2870
+ }
2847
2871
  getAttributions(options) {
2848
2872
  const attributions = [];
2849
2873
  for (const l in this._layers) {