Introduce tight integration with JavaScript classes
[gpl/argeo-suite.git] / js / src / geo / OpenLayersMapPart.js
index e1d8642c0fd99a8bd85098b1706c2e6af957cb26..177ce33862919d750769ae9029e187d1467df6db 100644 (file)
@@ -20,7 +20,6 @@ import { Style, Icon } from 'ol/style.js';
 import * as SLDReader from '@nieuwlandgeo/sldreader';
 
 import MapPart from './MapPart.js';
-import { SentinelCloudless } from './OpenLayerTileSources.js';
 
 /** OpenLayers implementation of MapPart. */
 export default class OpenLayersMapPart extends MapPart {
@@ -38,12 +37,16 @@ export default class OpenLayersMapPart extends MapPart {
                                //                              new TileLayer({
                                //                                      source: new SentinelCloudless(),
                                //                              }),
-                               new TileLayer({
-                                       source: new OSM(),
-                                       opacity: 0.4,
-                                       transition: 0,
-                               }),
+//                                                             new TileLayer({
+//                                                                     source: new OSM(),
+//                                                                     opacity: 0.4,
+//                                                                     transition: 0,
+//                                                             }),
                        ],
+//                     view: new View({
+//                             center: [0, 0],
+//                             zoom: 2,
+//                     }),
                        target: this.getMapName(),
                });
        }
@@ -95,6 +98,15 @@ export default class OpenLayersMapPart extends MapPart {
                this.#map.addLayer(vectorLayer);
        }
 
+       addLayer(js) {
+               const func = new Function(js);
+               const layer = (func)();
+               this.#map.addLayer(layer);
+       }
+
+       getMap() {
+               return this.#map;
+       }
 
        /* CALLBACKS */
        enableFeatureSingleClick() {