|
|
@@ -2,10 +2,21 @@ import React from 'react';
|
|
|
import { Row, Col, Card, CardBody, CardHeader } from 'reactstrap';
|
|
|
import { LMap, MapTypes, MapIcons } from '../../components/LeafletMap';
|
|
|
|
|
|
+function getRandomMarker(limit){
|
|
|
+ var _markers = [];
|
|
|
+ for(var i = 0; i < limit; i++){
|
|
|
+ _markers.push({
|
|
|
+ latlng: [Math.random()*60 + 20, Math.random()*60 - 15],
|
|
|
+ icon: MapIcons[Object.keys(MapIcons)[Math.floor(Math.random()*2)]]
|
|
|
+ });
|
|
|
+ };
|
|
|
+ return _markers;
|
|
|
+}
|
|
|
+
|
|
|
export default class Maps extends React.Component{
|
|
|
componentDidMount(){
|
|
|
this.trackingMap = new LMap('tracking_map', { center: [50.073658, 14.418540], zoom: 6}, MapTypes._TRACKING_);
|
|
|
- this.trackingMap.setTileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
+ this.trackingMap.addLayersControl([ '_OPENSTREET_', '_OPENTOPO_', '_AERIAL_', '_TERRAIN_', '_TRAFFIC_' ],{
|
|
|
detectRetina: true,
|
|
|
maxZoom: 19,
|
|
|
maxNativeZoom: 17,
|
|
|
@@ -21,33 +32,12 @@ export default class Maps extends React.Component{
|
|
|
|
|
|
|
|
|
this.positionMap = new LMap('position_map', { center: [50.073658, 14.418540], zoom: 6}, MapTypes._POSITION_);
|
|
|
- this.positionMap.setTileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
+ this.positionMap.addLayersControl([ '_OPENSTREET_', '_OPENTOPO_', '_AERIAL_', '_TERRAIN_', '_TRAFFIC_' ],{
|
|
|
detectRetina: true,
|
|
|
maxZoom: 19,
|
|
|
maxNativeZoom: 17,
|
|
|
});
|
|
|
- this.positionMap.drawMarker([
|
|
|
- {
|
|
|
- latlng: [50.073658, 14.418540],
|
|
|
- icon: MapIcons._RED_
|
|
|
- },
|
|
|
- {
|
|
|
- latlng: [51, 16],
|
|
|
- icon: MapIcons._BULE_
|
|
|
- },
|
|
|
- {
|
|
|
- latlng: [51.5, 15.8],
|
|
|
- icon: MapIcons._GREEN_
|
|
|
- },
|
|
|
- {
|
|
|
- latlng: [52, 15],
|
|
|
- icon: MapIcons._RED_
|
|
|
- },
|
|
|
- {
|
|
|
- latlng: [52, 13],
|
|
|
- icon: MapIcons._BULE_
|
|
|
- }
|
|
|
- ]);
|
|
|
+ this.positionMap.drawMarker(getRandomMarker(50));
|
|
|
};
|
|
|
|
|
|
render(){
|
|
|
@@ -60,7 +50,7 @@ export default class Maps extends React.Component{
|
|
|
Tracking Map
|
|
|
</CardHeader>
|
|
|
<CardBody>
|
|
|
- <div id="tracking_map" style={{height: '320px'}}></div>
|
|
|
+ <div id="tracking_map" style={{height: '400px'}}></div>
|
|
|
</CardBody>
|
|
|
</Card>
|
|
|
</Col>
|
|
|
@@ -70,7 +60,7 @@ export default class Maps extends React.Component{
|
|
|
Position Map
|
|
|
</CardHeader>
|
|
|
<CardBody>
|
|
|
- <div id="position_map" style={{height: '320px'}}></div>
|
|
|
+ <div id="position_map" style={{height: '400px'}}></div>
|
|
|
</CardBody>
|
|
|
</Card>
|
|
|
</Col>
|