Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #39 from stellasia/service
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
stellasia authored Nov 19, 2019
2 parents 6dffaf8 + 28d6da9 commit c90b22d
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 108 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neomap",
"version": "0.3.0",
"version": "0.3.1",
"author": "Estelle Scifo",
"private": false,
"neo4jDesktop": {
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"start_url": ".",
"display": "standalone",
"homepage": "http://github.com/stellasia/neomap",
"apiVersion": "^1.2.1"
"apiVersion": "^1.2"
}
20 changes: 20 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# neo-map release notes

## 0.3.1 (2019-11-19)

- Remove warning popup when changing the limit (#36);
- Fix the tooltip input display (#34);
- Improve map centering/zooming (now fit bounds);
- Lat/lon/tooltip labels now selectable from list of available labels;


## 0.3.0 (2019-11-17)

- Better error and warning handling:
- Inform the user when query returns no result
- Warning when switching from advanced to simple query
- Warning before deleting a layer (definitive action)
- Possibility to switch from simple to advanced layer with prefilled query
- Possibility to show the generated query for simple mode layer
- Display the selected marker color in the layer header (left side bar)
- Maximum number of points shown on the map is customizable (marker layer)
46 changes: 21 additions & 25 deletions src/components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import L from 'leaflet';

class Map extends Component {


constructor(props) {
super(props);

this.renderMarkerLayer = this.renderMarkerLayer.bind(this);
this.renderHeatmapLayer = this.renderHeatmapLayer.bind(this);
this.renderClusterLayer = this.renderClusterLayer.bind(this);
this.onFeatureGroupAdd = this.onFeatureGroupAdd.bind(this);
};


renderMarker(d, j, icon) {
/*Render maker with optional tooltip
*/
*/
if (d.tooltip) {
return (
<Marker key={j} position={d.pos} icon={icon} >
Expand All @@ -35,34 +35,35 @@ class Map extends Component {

renderMarkerLayer(layer) {
/*Will show one marker per items in `layer.data`
*/
*/
var data = layer.data;
var color = layer.color;
var color = layer.color.value;
var url = `https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-${color}.png`;
var icon = new L.Icon({
iconUrl: url
});
return (
<LayersControl.Overlay key={layer.ukey} name={layer.name} checked>
<FeatureGroup>
<FeatureGroup onAdd={this.onFeatureGroupAdd}>
{
data.map( (d, j) => {
return this.renderMarker(d, j, icon);
})
}
</FeatureGroup>
</FeatureGroup>
</LayersControl.Overlay>
);
};


renderHeatmapLayer(layer) {
/* Create heatmap based on items in `layer.data`, each with weight 1.
*/
*/
var data = layer.data;
return (
<LayersControl.Overlay key={layer.ukey} name={layer.name} checked>
<LayersControl.Overlay key={layer.ukey} name={layer.name} checked >
<HeatmapLayer
fitBoundsOnLoad
points={data}
latitudeExtractor={m => m.pos[0]}
longitudeExtractor={m => m.pos[1]}
Expand All @@ -78,34 +79,29 @@ class Map extends Component {

renderClusterLayer(layer) {
/*TODO: cluster layer
*/
*/
return "Cluster layer not supported for now";
};


onFeatureGroupAdd(e) {
if (e.target.getBounds()._northEast !== undefined)
this.refs.map.leafletElement.fitBounds(e.target.getBounds());
};


render() {
var layers = Object.entries(this.props.layers);

/*Map center will be the one of the last layer...
TODO: compute zoom or use leaflet tools to set it automatically?
*/
var center ;
var zoom ;
if (layers.length > 0) {
// TODO: no need to loop on ALL layers here
layers.map( ([key, layer]) => {
if (layer.ukey !== undefined)
center = layer.position;
return null
});
zoom = 11;
} else {
center = [47, 3];
zoom = 4;
}
*/

var center = [47, 3];
var zoom = 4;

return (
<LeafletMap center={center} zoom={zoom}>
<LeafletMap center={center} zoom={zoom} ref="map">
<LayersControl>
<LayersControl.BaseLayer name="Base" checked>
<TileLayer
Expand Down
Loading

0 comments on commit c90b22d

Please sign in to comment.