-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add plotter, add markers, dates. WIP.
- Loading branch information
Showing
10 changed files
with
316 additions
and
27 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,69 @@ | ||
export default class Plotter { | ||
static plotShows(organized) { | ||
return organized; | ||
} | ||
} | ||
|
||
/* | ||
function plotShows(geojson) { | ||
// update function for coordinates infobox | ||
window.onmove = function onmove() { | ||
// Get the map bounds - the top-left and bottom-right locations. | ||
const inBounds = [], | ||
bounds = map.getBounds(); | ||
clusterGroup.eachLayer((marker) => { | ||
// For each marker, consider whether it is currently visible by comparing | ||
// with the current map bounds. | ||
if (bounds.contains(marker.getLatLng()) && selectedDatesList.indexOf(marker.feature.properties.date) !== -1) { | ||
const feature = marker.feature; | ||
const coordsTemplate = L.mapbox.template('{{properties.date}} - {{properties.venue}} |{{#properties.bands}} {{.}} |{{/properties.bands}}{{properties.details}}', feature); | ||
inBounds.push(coordsTemplate); | ||
} | ||
}); | ||
// Display a list of markers. | ||
inBounds.reverse(); | ||
document.getElementById('coordinates').innerHTML = inBounds.join('\n'); | ||
}; | ||
// attach data | ||
const myLayer = L.mapbox.featureLayer(geojson); | ||
// make clustergroup | ||
const clusterGroup = ModifiedClusterGroup(); | ||
// add features | ||
clusterGroup.addLayer(myLayer); | ||
overlays = L.layerGroup().addTo(map); | ||
// add cluster layer | ||
// overlays are multiple layers | ||
// add in showShows() | ||
showShows(); | ||
// for each layer in feature layer | ||
myLayer.eachLayer((e) => { | ||
const marker = e; | ||
const feature = e.feature; | ||
// Create custom popup content | ||
const popupContent = L.mapbox.template('<h1> {{properties.venue}} </h1><br><h3> {{properties.date}} </h3><br><h2> {{#properties.bands}} - {{.}} <br> {{/properties.bands}} </h2><br><h2> {{properties.details}} </h2><br>', feature); | ||
marker.bindPopup(popupContent, { | ||
closeButton: true, | ||
minWidth: 320, | ||
}); | ||
}); | ||
map.on('move', onmove); | ||
// call onmove off the bat so that the list is populated. | ||
// otherwise, there will be no markers listed until the map is moved. | ||
window.onmove(); | ||
} | ||
function ModifiedClusterGroup() { | ||
return new L.MarkerClusterGroup({ | ||
spiderfyOnMaxZoom: true, | ||
maxClusterRadius: 1, | ||
spiderfyDistanceMultiplier: 3, | ||
}); | ||
} | ||
*/ |
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,24 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default class DateSelector extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<input | ||
type="checkbox" | ||
name="filters" | ||
onClick={this.props.showShows} | ||
value={this.props.date} | ||
defaultChecked | ||
/> { this.props.date } | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
DateSelector.propTypes = { | ||
date: PropTypes.string.isRequired, | ||
showShows: PropTypes.func.isRequired, | ||
}; | ||
|
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 React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import DateSelector from './DateSelector'; | ||
|
||
export default class Dates extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.makeDateSelectors = this.makeDateSelectors.bind(this); | ||
this.showShows = this.showShows.bind(this); | ||
} | ||
|
||
// eslint-disable-next-line | ||
showShows(){} | ||
|
||
makeDateSelectors(dates) { | ||
const selectors = []; | ||
for (let d = 0; d < dates.length; d += 1) { | ||
const selector = (<DateSelector | ||
showShows={this.showShows} | ||
date={dates[d]} | ||
key={dates[d]} | ||
/>); | ||
selectors.push(selector); | ||
} | ||
return selectors; | ||
} | ||
render() { return this.makeDateSelectors(this.props.dates); } | ||
} | ||
|
||
Dates.propTypes = { | ||
dates: PropTypes.array.isRequired, | ||
}; |
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
Oops, something went wrong.