Last active
July 20, 2018 06:02
-
-
Save steelydylan/2e0e3a560744e2dac6c03f3416d801dd to your computer and use it in GitHub Desktop.
Harmoware-VIS 最小サンプル
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
// app.js mapboxを使用する場合のサンプル | |
import React from 'react'; | |
import { | |
Container, connectToHarmowareVis, | |
HarmoVisLayers, MovesLayer, DepotsLayer, | |
MovesInput, DepotsInput, SimulationDateTime, | |
PauseButton, ForwardButton, ReverseButton, AddMinutesButton, | |
ElapsedTimeRange, SpeedRange | |
} from 'harmoware-vis'; | |
const MAPBOX_TOKEN = XXXXXXXXXX; //mapbox.com から取得したAccesstoken | |
class App extends Container { | |
render() { | |
const { viewport, actions, routePaths, lightSettings, | |
animatePause, animateReverse, settime, secperhour, timeBegin, timeLength, | |
movesbase, movedData, clickedObject, depotsData } = this.props; | |
return ( | |
<div> | |
<div className="controller_area"> //コントローラーエリア | |
<ul> | |
<li><MovesInput actions={actions} /></li> | |
<li><DepotsInput actions={actions} /></li> | |
<li>{animatePause ? | |
<PlayButton actions={actions} /> : | |
<PauseButton actions={actions} />}</li> | |
<li>{animateReverse ? | |
<ForwardButton actions={actions} /> : | |
<ReverseButton actions={actions} />}</li> | |
<li><AddMinutesButton addMinutes={-5} actions={actions} /></li> | |
<li><AddMinutesButton addMinutes={5} actions={actions} /></li> | |
<li><SimulationDateTime timeBegin={timeBegin} settime={settime} /></li> | |
<li><ElapsedTimeRange settime={settime} timeLength={timeLength} actions={actions} /></li> | |
<li><SpeedRange secperhour={secperhour} actions={actions} /></li> | |
</ul> | |
</div> | |
<div className="harmovis_area"> //シュミレーションエリア | |
<HarmoVisLayers | |
viewport={viewport} actions={actions} | |
mapboxApiAccessToken={MAPBOX_TOKEN} | |
layers={[ | |
new MovesLayer({ routePaths, movesbase, movedData, clickedObject, actions, }), | |
new DepotsLayer({ depotsData, }), | |
]} | |
/> | |
</div> | |
</div> | |
); | |
} | |
} | |
export default connectToHarmowareVis(App); |
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
import { render } from 'react-dom'; | |
import { reducer } from 'harmoware-vis'; | |
import { createStore } from 'redux'; | |
import { Provider } from 'react-redux'; | |
import React from 'react'; | |
import App from './app'; | |
const store = createStore(reducer); | |
render( | |
<Provider store={store}> | |
<App /> | |
</Provider>, | |
document.getElementById('app') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment