-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [WIP] heatmap-halogen-example * [WIP] FFI + types + implementation of creating heatmap layer, adding data (GeoJson) to it, updating data - all still WIP! * [WIP] Load + render earthqake data as heatmap Note: There are some issues to render heatmap data properly I could not fix today, that's why this stuff is still WIP... * Make heatmap work * type safety creation of a layer (no FFI) - remove FFI to create a `Layer` with all needed props (all defined in `Heatmap.purs` - which has been deleted, too) - extract `mapbox-gl-js` related stuff into an own `Mapbox` module - remove GeoJSON definitions - Use `WriteForeign` instances to push `Layer` data over the bounderies to the funky JS world of `mapbox-gl-js` - Remove unneded stuff from `Main` + `MapComponent` of `heatmap-halogen` example * Fix CI build * Bring `GeoJson` module back to live to be more expressive on data structures. As a result after embedding heatmap stuff into tcr map today... * Update constraints/types and fix `onViewportChange` handling to modify state (which is needed to move/zoom map around) * Final clean up: Remove `mapRef` from `Props` of `MapComponent` Aaaah - and add missing newlines... * Add `setLayerVisibilty` func. to show/hide a layer * Example of toggeling `heatmap layer` * Fix README
- Loading branch information
Showing
20 changed files
with
786 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ | |
/.psc* | ||
/.purs* | ||
/.psa* | ||
.psc-ide-port | ||
.vscode/ | ||
package-lock.json |
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
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,5 @@ | ||
/dist/example.js | ||
/output/ | ||
/bower_components/ | ||
/node_modules/ | ||
package-lock.json |
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,11 @@ | ||
## Build Instructions | ||
|
||
You can build this from the root directory | ||
|
||
```bash | ||
> npm i | ||
> npm run build | ||
> npm run example-heatmap-halogen | ||
``` | ||
|
||
And serve `./dist/` using a webserver. |
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,20 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css' rel='stylesheet' /> | ||
<title>react-map-gl example - heatmap halogen</title> | ||
<style> | ||
body {margin: 0;} | ||
.map-wrapper{position: relative;} | ||
.btn-toggle { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="example.js"></script> | ||
</body> | ||
</html> |
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,51 @@ | ||
module Main where | ||
|
||
import Prelude | ||
|
||
import Effect (Effect) | ||
import Effect.Aff.Class (class MonadAff) | ||
import Effect.Console (log) | ||
import Data.Maybe (Maybe(..)) | ||
import Halogen as H | ||
import Halogen.Aff as HA | ||
import Halogen.HTML as HH | ||
import Halogen.VDom.Driver (runUI) | ||
import MapComponent (MapMessages(..), MapQuery, mapComponent) | ||
|
||
type State = {} | ||
|
||
data Query a | ||
= HandleMapUpdate MapMessages a | ||
|
||
data MapSlot = MapSlot | ||
derive instance eqMapSlot :: Eq MapSlot | ||
derive instance ordMapSlot :: Ord MapSlot | ||
|
||
ui | ||
:: forall m | ||
. MonadAff m | ||
=> H.Component HH.HTML Query Unit Void m | ||
ui = | ||
H.parentComponent | ||
{ initialState: const {} | ||
, render | ||
, eval | ||
, receiver: const Nothing | ||
} | ||
where | ||
render :: State -> H.ParentHTML Query MapQuery MapSlot m | ||
render _ = | ||
HH.div_ | ||
[ HH.slot MapSlot mapComponent unit $ Just <<< H.action <<< HandleMapUpdate | ||
] | ||
|
||
eval :: Query ~> H.ParentDSL State Query MapQuery MapSlot Void m | ||
eval (HandleMapUpdate msg next) = do | ||
case msg of | ||
OnClick info -> H.liftEffect $ log $ show info.lngLat | ||
pure next | ||
|
||
main :: Effect Unit | ||
main = HA.runHalogenAff do | ||
body <- HA.awaitBody | ||
runUI ui unit body |
Oops, something went wrong.