projects
/
gpl
/
argeo-suite.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add controls to OpenLayers map
[gpl/argeo-suite.git]
/
js
/
src
/
geo
/
OpenLayersMapPart.js
diff --git
a/js/src/geo/OpenLayersMapPart.js
b/js/src/geo/OpenLayersMapPart.js
index 0e32e8832c410226de3e2c56fd9e6df105f671d1..160930d6b7447563b309de34030dcf808d24b00a 100644
(file)
--- a/
js/src/geo/OpenLayersMapPart.js
+++ b/
js/src/geo/OpenLayersMapPart.js
@@
-2,19
+2,26
@@
* @module OpenLayersMapPart
*/
* @module OpenLayersMapPart
*/
-import Map from 'ol/Map.js';
-import View from 'ol/View.js';
import { fromLonLat, getPointResolution } from 'ol/proj.js';
import { fromLonLat, getPointResolution } from 'ol/proj.js';
-import VectorSource from 'ol/source/Vector.js';
import Feature from 'ol/Feature.js';
import { Point } from 'ol/geom.js';
import Feature from 'ol/Feature.js';
import { Point } from 'ol/geom.js';
+import { transformExtent } from 'ol/proj.js';
+
import VectorLayer from 'ol/layer/Vector.js';
import VectorLayer from 'ol/layer/Vector.js';
+import TileLayer from 'ol/layer/Tile.js';
+
+import VectorSource from 'ol/source/Vector.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import GPX from 'ol/format/GPX.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import GPX from 'ol/format/GPX.js';
+import OSM from 'ol/source/OSM.js';
+
import Select from 'ol/interaction/Select.js';
import Overlay from 'ol/Overlay.js';
import { Style, Icon } from 'ol/style.js';
import Select from 'ol/interaction/Select.js';
import Overlay from 'ol/Overlay.js';
import { Style, Icon } from 'ol/style.js';
-import { transformExtent } from 'ol/proj.js';
+
+import Map from 'ol/Map.js';
+import View from 'ol/View.js';
+import { OverviewMap, ScaleLine, defaults as defaultControls } from 'ol/control.js';
import * as SLDReader from '@nieuwlandgeo/sldreader';
import * as SLDReader from '@nieuwlandgeo/sldreader';
@@
-25,6
+32,8
@@
export default class OpenLayersMapPart extends MapPart {
/** The OpenLayers Map. */
#map;
/** The OpenLayers Map. */
#map;
+ #overviewMap;
+
/** Styled layer descriptor */
#sld;
/** Styled layer descriptor */
#sld;
@@
-34,7
+43,24
@@
export default class OpenLayersMapPart extends MapPart {
/** Constructor taking the mapName as an argument. */
constructor(mapName) {
super(mapName);
/** Constructor taking the mapName as an argument. */
constructor(mapName) {
super(mapName);
+ this.#overviewMap = new OverviewMap({
+ layers: [
+ new TileLayer({
+ source: new OSM(),
+ }),
+ ],
+ });
this.#map = new Map({
this.#map = new Map({
+ controls: defaultControls({
+ attribution: false,
+ rotate: false,
+ }).extend([this.#overviewMap, new ScaleLine({
+ bar: false,
+ steps: 2,
+ text: false,
+ minWidth: 150,
+ maxWidth: 200,
+ })]),
layers: [
],
// view: new View({
layers: [
],
// view: new View({