Skip to content

Commit

Permalink
fix and merge PnX-SI#415
Browse files Browse the repository at this point in the history
  • Loading branch information
hypsug0 committed Nov 20, 2024
1 parent d83a920 commit 8fbf926
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 72 deletions.
9 changes: 5 additions & 4 deletions frontend/src/app/programs/observations/form/form.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { geometryValidator, ngbDateMaxIsToday } from './formValidators';
import { MainConfig } from './../../../../conf/main.config';
import { BaseLayer } from '../../programs.models';
import * as L from 'leaflet';

import {
Expand Down Expand Up @@ -47,8 +48,8 @@ import { ControlPosition } from 'leaflet';
const map_conf = {
GEOLOCATION_CONTROL_POSITION: 'topright',
GEOLOCATION_HIGH_ACCURACY: false,
BASE_LAYERS: MainConfig['BASEMAPS'].reduce((acc, baseLayer: Object) => {
const layerConf: any = {
BASE_LAYERS: MainConfig['BASEMAPS'].reduce((acc, baseLayer: BaseLayer) => {
const layerConf: BaseLayer = {
name: baseLayer['name'],
attribution: baseLayer['attribution'],
detectRetina: baseLayer['detectRetina'],
Expand Down Expand Up @@ -249,8 +250,8 @@ export class ObsFormComponent implements AfterViewInit {
L.control['fullscreen']({
position: 'topright',
title: {
false: 'View Fullscreen',
true: 'Exit Fullscreefullscreenn',
false: 'Voir en plein écran',
true: 'Sortir du plein écran',
},
pseudoFullscreen: true,
}).addTo(formMap);
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/app/programs/programs.models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SafeHtml } from '@angular/platform-browser';
import { TileLayerOptions } from 'leaflet';

export class Program {
id_program: number;
Expand All @@ -15,3 +16,12 @@ export class Program {
registration_required: boolean;
on_sidebar: boolean;
}

export interface BaseLayer extends TileLayerOptions {
name: string;
layer?: string;
attribution: string;
detectRetina?: boolean;
apiKey?: string;
layerName?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Observable } from 'rxjs';
import { NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { Position, Point } from 'geojson';
import * as L from 'leaflet';
import { BaseLayer } from '../../programs.models';
import { LeafletMouseEvent } from 'leaflet';
import 'leaflet-fullscreen/dist/Leaflet.fullscreen';
import 'leaflet-gesture-handling';
Expand All @@ -31,8 +32,8 @@ import { MapService } from '../../base/map/map.service';
const map_conf = {
GEOLOCATION_CONTROL_POSITION: 'topright',
GEOLOCATION_HIGH_ACCURACY: false,
BASE_LAYERS: MainConfig['BASEMAPS'].reduce((acc, baseLayer: Object) => {
const layerConf: any = {
BASE_LAYERS: MainConfig['BASEMAPS'].reduce((acc, baseLayer: BaseLayer) => {
const layerConf: BaseLayer = {
name: baseLayer['name'],
attribution: baseLayer['attribution'],
detectRetina: baseLayer['detectRetina'],
Expand Down Expand Up @@ -166,8 +167,8 @@ export class SiteFormComponent implements AfterViewInit {
L.control['fullscreen']({
position: 'topright',
title: {
false: 'View Fullscreen',
true: 'Exit Fullscreefullscreenn',
false: 'Voir en plein écran',
true: 'Sortir du plein écran',
},
pseudoFullscreen: true,
}).addTo(formMap);
Expand Down
134 changes: 70 additions & 64 deletions frontend/src/conf/map.config.ts.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,76 @@ export const MAP_CONFIG = {
// attribution:
// '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>',
// },
// {
// name: "OpenStreetMapFRHot",
// maxZoom: 19,
// layer: "//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",
// subdomains: "abc",
// attribution:
// '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>'
// },
// {
// name: "OpenStreetMapCH",
// maxZoom: 18,
// layer: "//tile.osm.ch/switzerland/{z}/{x}/{y}.png",
// subdomains: "abc",
// attribution:
// '&copy; <a href="&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
// bounds: [[45, 5], [48, 11]]
// },
// {
// name: "OpenStreetMapDE",
// maxZoom: 18,
// layer: "//{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png",
// subdomains: "abc",
// attribution:
// '&copy; <a href="&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
// },
// {
// name: "OpenStreetMapBZH",
// maxZoom: 18,
// layer: "//tile.openstreetmap.bzh/br/{z}/{x}/{y}.png",
// subdomains: "",
// attribution:
// '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles courtesy of <a href="http://www.openstreetmap.bzh/" target="_blank">Breton OpenStreetMap Team</a>',
// bounds: [[46.2, -5.5], [50, 0.7]]
// },
// {
// name: 'OpenTopoMap',
// maxZoom: 17,
// layer: '//{s}.opentopomap.org/{z}/{x}/{y}.png',
// subdomains: 'abc',
// attribution: '© OpenTopoMap',
// },
// {
// name: 'IGN Vue satellite',
// maxZoom: 19,
// layer: 'https://wxs.ign.fr/decouverte/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&TILEMATRIXSET=PM&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}',
// subdomains: 'abc',
// attribution: '© IGN-F/Geoportail',
// },
// {
// name: 'IGN Cartes',
// maxZoom: 19,
// layer: 'https://wxs.ign.fr/decouverte/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&TILEMATRIXSET=PM&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&FORMAT=image/png&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}',
// subdomains: 'abc',
// attribution: '© IGN-F/Geoportail',
// },
// {
// // ⚠ google's terms&conditions
// // https://github.com/Leaflet/Leaflet/blob/master/FAQ.md#i-want-to-use-google-maps-api-tiles-with-leaflet-can-i-do-that
// name: "GoogleSatellite",
// maxZoom: 20,
// layer: "//mt{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",
// subdomains: "1",
// attribution: "© GoogleMap"
// }
// {
// name: 'OpenStreetMapFRHot',
// maxZoom: 19,
// layer: '//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
// subdomains: 'abc',
// attribution:
// '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>',
// },
// {
// name: 'OpenStreetMapCH',
// maxZoom: 18,
// layer: '//tile.osm.ch/switzerland/{z}/{x}/{y}.png',
// subdomains: 'abc',
// attribution:
// '&copy; <a href="&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
// bounds: [
// [45, 5],
// [48, 11],
// ],
// },
// {
// name: 'OpenStreetMapDE',
// maxZoom: 18,
// layer: '//{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
// subdomains: 'abc',
// attribution:
// '&copy; <a href="&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
// },
// {
// name: 'OpenStreetMapBZH',
// maxZoom: 18,
// layer: '//tile.openstreetmap.bzh/br/{z}/{x}/{y}.png',
// subdomains: '',
// attribution:
// '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles courtesy of <a href="http://www.openstreetmap.bzh/" target="_blank">Breton OpenStreetMap Team</a>',
// bounds: [
// [46.2, -5.5],
// [50, 0.7],
// ],
// },
// {
// name: 'OpenTopoMap',
// maxZoom: 17,
// layer: '//{s}.opentopomap.org/{z}/{x}/{y}.png',
// subdomains: 'abc',
// attribution: '© OpenTopoMap',
// },
// {
// name: 'IGN Vue satellite',
// maxZoom: 19,
// layer: 'https://data.geopf.fr/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/jpeg&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
// subdomains: 'abc',
// attribution: '© IGN-F/Geoportail',
// },
// {
// name: 'IGN Cartes',
// maxZoom: 19,
// layer: 'https://data.geopf.fr/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
// subdomains: 'abc',
// attribution: '© IGN-F/Geoportail',
// },
// {
// // ⚠ google's terms&conditions
// // https://github.com/Leaflet/Leaflet/blob/master/FAQ.md#i-want-to-use-google-maps-api-tiles-with-leaflet-can-i-do-that
// name: 'GoogleSatellite',
// maxZoom: 20,
// layer: '//mt{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',
// subdomains: '1',
// attribution: '© GoogleMap',
// },
// ],
// CENTER: [46.52863469527167, 2.43896484375],
// ZOOM_LEVEL: 6,
Expand Down

0 comments on commit 8fbf926

Please sign in to comment.