Skip to content

Commit

Permalink
Add OACI maps for France
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Oct 17, 2024
1 parent 4c41f2c commit 2d78299
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
3 changes: 3 additions & 0 deletions apps/fxc-front/src/app/components/2d/map-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export class MapElement extends connect(store)(LitElement) {
TopoOtm.mapTypeId,
TopoFrance.mapTypeId,
TopoFrance.mapTypeIdScan,
TopoFrance.mapTypeIdScanOACI,
TopoSpain.mapTypeId,
],
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
Expand Down Expand Up @@ -200,6 +201,8 @@ export class MapElement extends connect(store)(LitElement) {
}
});

this.map.addListener('zoom_changed', () => console.log(this.map?.getZoom()));

this.subscriptions.push(
msg.centerMap.subscribe(({ lat, lon }) => this.center(lat, lon)),
msg.centerZoomMap.subscribe(({ lat, lon }, delta) => {
Expand Down
38 changes: 29 additions & 9 deletions apps/fxc-front/src/app/components/2d/topo-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ export class TopoSpain extends WMTSMapTypeElement {

const IGNFR_PLAN = 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2';
const IGNFR_SCAN = 'GEOGRAPHICALGRIDSYSTEMS.MAPS';
const IGNFR_SCAN_OACI = 'GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-OACI';

@customElement('topo-france')
export class TopoFrance extends WMTSMapTypeElement {
static mapTypeId = 'topo.france.classique';
static mapTypeIdScan = 'topo.france.scan';
static mapTypeIdScanOACI = 'topo.france.scan-oaci';

mapName = 'France';
copyright = {
html: `<img src="/static/img/topo.fr.png" />`,
Expand Down Expand Up @@ -65,25 +68,42 @@ export class TopoFrance extends WMTSMapTypeElement {
minZoom: 6,
maxZoom: 17,
name: 'France (scan)',
alt: 'France (scan)',
alt: 'France',
});
}

protected getScanOACIMapType(): google.maps.ImageMapType {
return new google.maps.ImageMapType({
getTileUrl: (...args): string => this.getTileUrl(...args),
tileSize: new google.maps.Size(256, 256),
minZoom: 6,
maxZoom: 11,
name: 'OACI (France)',
alt: 'OACI ',
});
}

protected init(map: google.maps.Map): void {
super.init(map);
this.registerMapType(TopoFrance.mapTypeIdScan, this.getScanMapType());
this.registerMapType(TopoFrance.mapTypeIdScanOACI, this.getScanOACIMapType());
}

protected visibilityHandler(mapTypeId: string): void {
if (this.copyrightEl) {
if (mapTypeId === TopoFrance.mapTypeId) {
this.layerName = IGNFR_PLAN;
this.copyrightEl.hidden = false;
} else if (mapTypeId === TopoFrance.mapTypeIdScan) {
this.layerName = IGNFR_SCAN;
this.copyrightEl.hidden = false;
} else {
this.copyrightEl.hidden = true;
this.copyrightEl.hidden = false;
switch (mapTypeId) {
case TopoFrance.mapTypeIdScanOACI:
this.layerName = IGNFR_SCAN_OACI;
break;
case TopoFrance.mapTypeIdScan:
this.layerName = IGNFR_SCAN;
break;
case TopoFrance.mapTypeId:
this.layerName = IGNFR_PLAN;
break;
default:
this.copyrightEl.hidden = true;
}
}
super.visibilityHandler(mapTypeId);
Expand Down

0 comments on commit 2d78299

Please sign in to comment.