- {(this.map !== null) ? this.renderTiles() : ''}
- {(this.map !== null) ? this.renderMarkers() : ''}
- {(this.map !== null) && isShowingSites ? this.renderSites() : ''}
- {(this.map !== null) ? this.renderEvents() : ''}
- {(this.map !== null) ? this.renderNarratives() : ''}
- {(this.map !== null) ? this.renderSelected() : ''}
+ {innerMap}
);
}
@@ -244,7 +262,8 @@ function mapStateToProps(state) {
locations: selectors.selectLocations(state),
narratives: selectors.selectNarratives(state),
categories: selectors.selectCategories(state),
- sites: selectors.getSites(state)
+ sites: selectors.getSites(state),
+ shapes: selectors.getShapes(state)
},
app: {
views: state.app.filters.views,
diff --git a/src/components/MapShapes.jsx b/src/components/MapShapes.jsx
new file mode 100644
index 0000000..19a842c
--- /dev/null
+++ b/src/components/MapShapes.jsx
@@ -0,0 +1,33 @@
+import React from 'react';
+
+function MapShapes({ map, shapes, mapTransformX, mapTransformY }) {
+ function projectPoint(location) {
+ const latLng = new L.LatLng(location[0], location[1]);
+ return {
+ x: map.latLngToLayerPoint(latLng).x + mapTransformX,
+ y: map.latLngToLayerPoint(latLng).y + mapTransformY
+ };
+ }
+
+ function renderShape(shape) {
+ const coords = shape.points.map(projectPoint)
+ return coords.map(pt => (
+
- {this.props.sites.map(site => { return this.renderSite(site); })}
-
- )
- }
+ return (
+