Skip to content

Commit

Permalink
maj demos
Browse files Browse the repository at this point in the history
  • Loading branch information
lowzonenose committed Dec 13, 2024
1 parent 040444b commit 5c28f3d
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 32 deletions.
62 changes: 51 additions & 11 deletions demos/esmodule-project/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Map,
View
} from "ol";
import ScaleLine from 'ol/control/ScaleLine';
import TileLayer from "ol/layer/Tile";
import OSM from "ol/source/OSM";

Expand All @@ -29,7 +30,8 @@ import {
ReverseGeocode,
Route,
SearchEngine,
Territories
Territories,
ControlList
} from "geopf-extensions-openlayers";

import Gp from "geoportal-access-lib";
Expand Down Expand Up @@ -58,6 +60,12 @@ var cfg = new Gp.Services.Config({
})
});

const scaleControl = new ScaleLine({
units: 'metric',
bar: false,
});
map.addControl(scaleControl);

var territories = new Territories({
collapsed: true,
draggable: true,
Expand All @@ -66,7 +74,8 @@ var cfg = new Gp.Services.Config({
auto: true,
thumbnail : false,
reduce: false,
tiles: 3
tiles: 3,
listable: true,
});
map.addControl(territories);

Expand Down Expand Up @@ -134,17 +143,20 @@ var cfg = new Gp.Services.Config({
map.addControl(catalog);

var drawing = new Drawing({
position : "top-left"
position : "top-left",
listable: true
});
map.addControl(drawing);

var iso = new Isocurve({
position : "bottom-left"
position : "bottom-left",
listable: true
});
map.addControl(iso);

var layerImport = new LayerImport({
position : "bottom-left"
position : "bottom-left",
listable: true
});
map.addControl(layerImport);

Expand All @@ -161,7 +173,8 @@ var cfg = new Gp.Services.Config({
map.addControl(mp);

var route = new Route({
position : "top-right"
position : "top-right",
listable: true,
});
map.addControl(route);

Expand All @@ -171,7 +184,24 @@ var cfg = new Gp.Services.Config({
map.addControl(reverse);

var search = new SearchEngine({
position : "top-right"
displayButtonAdvancedSearch : true,
displayButtonGeolocate : true,
displayButtonCoordinateSearch : true,
displayButtonClose : false,
collapsible : false,
resources : {
search : true
},
searchOptions: {
addToMap: true,
filterServices : "WMTS,WMS,TMS,WFS",
filterLayersPriority : "PLAN.IGN,GEOGRAPHICALGRIDSYSTEMS.MAPS.BDUNI.J1,GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2,CADASTRALPARCELS.PARCELLAIRE_EXPRESS,ORTHOIMAGERY.ORTHOPHOTOS",
filterWMTSPriority : true,
serviceOptions: {
maximumResponses : 20
}
},
markerUrl : "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAzNiIgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4Ij48cGF0aCBmaWxsPSIjMDAwMDkxIiBkPSJNMTguMzY0IDMuNjM2YTkgOSAwIDAgMSAwIDEyLjcyOEwxMiAyMi43MjhsLTYuMzY0LTYuMzY0QTkgOSAwIDAgMSAxOC4zNjQgMy42MzZaTTEyIDhhMiAyIDAgMSAwIDAgNCAyIDIgMCAwIDAgMC00WiIvPjwvc3ZnPg=="
});
map.addControl(search);

Expand All @@ -183,29 +213,39 @@ var cfg = new Gp.Services.Config({
map.addControl(feature);

var measureLength = new MeasureLength({
position : "bottom-left"
position : "bottom-left",
listable: true
});
map.addControl(measureLength);

var measureArea = new MeasureArea({
position : "bottom-left"
position : "bottom-left",
listable: true
});
map.addControl(measureArea);

var measureAzimuth = new MeasureAzimuth({
position : "bottom-left"
position : "bottom-left",
listable: true
});
map.addControl(measureAzimuth);

var measureProfil = new ElevationPath({
position : "bottom-left"
position : "bottom-left",
listable: true
});
map.addControl(measureProfil);

var attributions = new GeoportalAttribution({
position : "bottom-right"
});
map.addControl(attributions);

var controlList = new ControlList({
draggable: false,
position: "bottom-right"
});
map.addControl(controlList);
},
onFailure : (e) => {
console.error(e);
Expand Down
61 changes: 50 additions & 11 deletions demos/react-project/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { useState, useEffect, useRef } from 'react';

import View from 'ol/View';
import Map from 'ol/Map';
import ScaleLine from 'ol/control/ScaleLine';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';

Expand Down Expand Up @@ -33,7 +34,8 @@ import {
ReverseGeocode,
Route,
SearchEngine,
Territories
Territories,
ControlList
} from "geopf-extensions-openlayers";

import Gp from "geoportal-access-lib";
Expand All @@ -59,7 +61,13 @@ function App() {
})

CRS.load();


const scaleControl = new ScaleLine({
units: 'metric',
bar: false,
});
map.addControl(scaleControl);

var territories = new Territories({
collapsed: true,
draggable: true,
Expand Down Expand Up @@ -141,12 +149,14 @@ function App() {
map.addControl(drawing);

var iso = new Isocurve({
position: "bottom-left"
position: "bottom-left",
listable: true
});
map.addControl(iso);

var layerImport = new LayerImport({
position: "bottom-left"
position: "bottom-left",
listable: true
});
map.addControl(layerImport);

Expand All @@ -163,17 +173,36 @@ function App() {
map.addControl(mp);

var route = new Route({
position: "top-right"
position: "top-right",
listable: true
});
map.addControl(route);

var reverse = new ReverseGeocode({
position: "top-right"
position: "top-right",
listable: true
});
map.addControl(reverse);

var search = new SearchEngine({
position: "top-right"
displayButtonAdvancedSearch : true,
displayButtonGeolocate : true,
displayButtonCoordinateSearch : true,
displayButtonClose : false,
collapsible : false,
resources : {
search : true
},
searchOptions: {
addToMap: true,
filterServices : "WMTS,WMS,TMS,WFS",
filterLayersPriority : "PLAN.IGN,GEOGRAPHICALGRIDSYSTEMS.MAPS.BDUNI.J1,GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2,CADASTRALPARCELS.PARCELLAIRE_EXPRESS,ORTHOIMAGERY.ORTHOPHOTOS",
filterWMTSPriority : true,
serviceOptions: {
maximumResponses : 20
}
},
markerUrl : "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAzNiIgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4Ij48cGF0aCBmaWxsPSIjMDAwMDkxIiBkPSJNMTguMzY0IDMuNjM2YTkgOSAwIDAgMSAwIDEyLjcyOEwxMiAyMi43MjhsLTYuMzY0LTYuMzY0QTkgOSAwIDAgMSAxOC4zNjQgMy42MzZaTTEyIDhhMiAyIDAgMSAwIDAgNCAyIDIgMCAwIDAgMC00WiIvPjwvc3ZnPg=="
});
map.addControl(search);

Expand All @@ -185,28 +214,38 @@ function App() {
map.addControl(feature);

var measureLength = new MeasureLength({
position: "bottom-left"
position: "bottom-left",
listable: true
});
map.addControl(measureLength);

var measureArea = new MeasureArea({
position: "bottom-left"
position: "bottom-left",
listable: true
});
map.addControl(measureArea);

var measureAzimuth = new MeasureAzimuth({
position: "bottom-left"
position: "bottom-left",
listable: true
});
map.addControl(measureAzimuth);

var measureProfil = new ElevationPath({
position: "bottom-left"
position: "bottom-left",
listable: true
});
map.addControl(measureProfil);

var attributions = new GeoportalAttribution();
map.addControl(attributions);

var controlList = new ControlList({
draggable: false,
position: "bottom-right"
});
map.addControl(controlList);

setMap(map);
};

Expand Down
Loading

0 comments on commit 5c28f3d

Please sign in to comment.