Improved fire markers
This commit is contained in:
parent
1472987e21
commit
8ecf0a08f3
1 changed files with 11 additions and 8 deletions
|
|
@ -23,11 +23,13 @@ const fireIcon = new Leaflet.Icon({
|
||||||
|
|
||||||
// http://leafletjs.com/reference-1.2.0.html#icon
|
// http://leafletjs.com/reference-1.2.0.html#icon
|
||||||
const MyPopupMarker = ({ children, lat, lon}) => (
|
const MyPopupMarker = ({ children, lat, lon}) => (
|
||||||
<Marker position={[lat, lon]} icon={fireIcon} >
|
<div><Marker position={[lat, lon]} icon={fireIcon} >
|
||||||
{/* <Popup>
|
{/* <Popup>
|
||||||
<span>{children}</span>
|
<span>{children}</span>
|
||||||
</Popup> */}
|
</Popup> */}
|
||||||
</Marker>
|
</Marker>
|
||||||
|
<CircleMarker center={[lat, lon]} color="red" stroke={false} fillOpacity="1" fill={true} radius={1} />
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const FireMark = ({ lat, lon, scan }) => (
|
const FireMark = ({ lat, lon, scan }) => (
|
||||||
|
|
@ -65,7 +67,6 @@ const MyMarkersList = ({ markers }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const FireList = ({ activefires, scale, useMarkers }) => {
|
const FireList = ({ activefires, scale, useMarkers }) => {
|
||||||
// console.log("Scaling? :" + scale);
|
|
||||||
const items = activefires.map(({ _id, ...props }) => (
|
const items = activefires.map(({ _id, ...props }) => (
|
||||||
useMarkers? <MyPopupMarker key={_id} {...props} />:
|
useMarkers? <MyPopupMarker key={_id} {...props} />:
|
||||||
scale? <Fire key={_id} {...props} />:<FireMark key={_id} {...props} />))
|
scale? <Fire key={_id} {...props} />:<FireMark key={_id} {...props} />))
|
||||||
|
|
@ -90,7 +91,7 @@ class FiresMap extends React.Component {
|
||||||
this.state = {
|
this.state = {
|
||||||
viewport: DEFAULT_VIEWPORT,
|
viewport: DEFAULT_VIEWPORT,
|
||||||
modified: false,
|
modified: false,
|
||||||
useMarkers: true
|
useMarkers: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,7 +202,6 @@ class FiresMap extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const geoip = new ReactiveVar('');
|
|
||||||
const zoom = new ReactiveVar(8);
|
const zoom = new ReactiveVar(8);
|
||||||
const lat = new ReactiveVar(DEF_LAT);
|
const lat = new ReactiveVar(DEF_LAT);
|
||||||
const lng = new ReactiveVar(DEF_LNG);
|
const lng = new ReactiveVar(DEF_LNG);
|
||||||
|
|
@ -219,7 +219,8 @@ Meteor.call("geo", function (error, response) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
} else {
|
} else {
|
||||||
geoip.set([response.location.latitude, response.location.longitude] );
|
lat.set(response.location.latitude);
|
||||||
|
lng.set(response.location.longitude);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -229,19 +230,21 @@ export default translate([], { wait: true }) (withTracker(() => {
|
||||||
// Subscribe for the current templateId (only if one is selected). Note this
|
// Subscribe for the current templateId (only if one is selected). Note this
|
||||||
// will automatically clean up any previously subscribed data and it will
|
// will automatically clean up any previously subscribed data and it will
|
||||||
// also stop all subscriptions when this template is destroyed.
|
// also stop all subscriptions when this template is destroyed.
|
||||||
if (zoom.get())
|
if (zoom.get() || lat.get() || lng.get()) {
|
||||||
// TODO select position
|
|
||||||
subscription = Meteor.subscribe('activefiresmyloc', zoom.get(), lat.get(), lng.get(), height.get(), width.get());
|
subscription = Meteor.subscribe('activefiresmyloc', zoom.get(), lat.get(), lng.get(), height.get(), width.get());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.subscribe('activefirestotal');
|
Meteor.subscribe('activefirestotal');
|
||||||
// const subscription = Meteor.subscribe('activefiresmyloc', zoom.get());
|
// const subscription = Meteor.subscribe('activefiresmyloc', zoom.get());
|
||||||
|
console.log(`Active fires ${ActiveFiresCollection.find().fetch().length} of ${Counter.get('countActiveFires')}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: !subscription.ready(),
|
loading: !subscription.ready(),
|
||||||
activefires: ActiveFiresCollection.find().fetch(),
|
activefires: ActiveFiresCollection.find().fetch(),
|
||||||
activefirestotal: Counter.get('countActiveFires'),
|
activefirestotal: Counter.get('countActiveFires'),
|
||||||
viewport: {
|
viewport: {
|
||||||
center: geoip.get(), // a point in the sea
|
center: [lat.get(), lng.get()], // a point in the sea
|
||||||
zoom: zoom.get(),
|
zoom: zoom.get(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue