-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add railplus popup, use railplus style
- Loading branch information
Showing
31 changed files
with
219 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import TrafimageMapboxLayer from '../../layers/TrafimageMapboxLayer'; | ||
import MapboxStyleLayer from '../../layers/MapboxStyleLayer'; | ||
|
||
export const netzkarteRailplus = new TrafimageMapboxLayer({ | ||
name: 'ch.railplus.meterspurbahnen.data', | ||
visible: true, | ||
zIndex: -1, | ||
style: 'netzkarte_eisenbahninfrastruktur_v3_ch.railplus', | ||
properties: { | ||
isBaseLayer: true, | ||
}, | ||
mapOptions: { | ||
preserveDrawingBuffer: true, | ||
}, | ||
}); | ||
|
||
export const railplusTVS = new MapboxStyleLayer({ | ||
name: 'ch.railplus.meterspurbahnen', | ||
visible: true, | ||
mapboxLayer: netzkarteRailplus, | ||
styleLayersFilter: ({ metadata }) => | ||
metadata && | ||
metadata['isb.filter'] && | ||
/^(tvs|tvs_flag)$/.test(metadata['isb.filter']), | ||
queryRenderedLayersFilter: ({ metadata }) => | ||
metadata && metadata['isb.filter'] && /^tvs$/.test(metadata['isb.filter']), | ||
properties: { | ||
isQueryable: true, | ||
popupComponent: 'RailplusMeterspurPopup', | ||
}, | ||
}); | ||
|
||
export default [netzkarteRailplus, railplusTVS]; |
35 changes: 35 additions & 0 deletions
35
src/config/ch.railplus.meterspurbahnen/providersMapping.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import aareSeelandLogo from '../../img/railPlusLogos/aare_seeland_mobil.svg'; | ||
import aargauLogo from '../../img/railPlusLogos/aargau_Verkehr.svg'; | ||
import rhaetischeBahnLogo from '../../img/railPlusLogos/rhaetische_bahn.svg'; | ||
import lebLogo from '../../img/railPlusLogos/leb.svg'; | ||
import tmrLogo from '../../img/railPlusLogos/tmr.svg'; | ||
|
||
const providers = [ | ||
{ | ||
name: 'AareSeelandmobil', | ||
logo: aareSeelandLogo, | ||
url: 'https://www.asmobil.ch/', | ||
}, | ||
{ | ||
name: 'Aargau Verkehr', | ||
logo: aargauLogo, | ||
url: 'https://www.aargauverkehr.ch/', | ||
}, | ||
{ | ||
name: 'Rhaetische Bahn', | ||
logo: rhaetischeBahnLogo, | ||
url: 'https://www.rhb.ch/', | ||
}, | ||
{ | ||
name: 'Compagnie du Chemin de fer Lausanne-Echallens-Bercher', | ||
logo: lebLogo, | ||
url: 'https://www.leb.ch/', | ||
}, | ||
{ | ||
name: 'Transports de Martigny et Régions', | ||
logo: tmrLogo, | ||
url: 'https://www.tmrsa.ch/', | ||
}, | ||
]; | ||
|
||
export default providers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
The _Railplus - Meterspurbahnen_ topic provides a topic specifically for iframe use. | ||
|
||
```jsx | ||
import React, { useMemo, useState, useEffect } from 'react'; | ||
import { | ||
TextField, | ||
FormControl, | ||
Select, | ||
InputLabel, | ||
MenuItem, | ||
} from '@material-ui/core'; | ||
import Editor from 'react-styleguidist/lib/client/rsg-components/Editor'; | ||
import Heading from 'react-styleguidist/lib/client/rsg-components/Heading'; | ||
import DocForm from '../../DocForm'; | ||
import getIframeCodeFromUrl from '../getIframeCodeFromUrl'; | ||
import getHtmlPageCode from '../getHtmlPageCode'; | ||
import iframeSearchParams from '../iframeSearchParams'; | ||
// The `apiKey` used here is for demonstration purposes only. | ||
// Please get your own api key at https://developer.geops.io/. | ||
const apiKey = window.apiKey; | ||
const baseUrl = 'https://wkp.stag.trafimage.geops.ch'; | ||
const topic = 'ch.railplus.meterspurbahnen'; | ||
|
||
const App = () => { | ||
const [url, setUrl] = useState(baseUrl + '/' + topic + '?embedded=true'); | ||
|
||
const code = useMemo(() => { | ||
return getHtmlPageCode(getIframeCodeFromUrl(url)); | ||
}, [url]); | ||
|
||
return ( | ||
<> | ||
<div className="container"> | ||
<iframe src={url} /> | ||
</div> | ||
<br /> | ||
<Editor | ||
code={code} | ||
onChange={(code) => null} //setCode(code)} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
<App />; | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.