@@ -21,29 +21,52 @@ class NeoTestReport extends NeoReport {
2121 this . state . height = - 145 + this . props . height * 100 ;
2222 let colors = [ "#588c7e" , "#f2e394" , "#f2ae72" , "#d96459" , "#5b9aa0" , "#d6d4e0" , "#b8a9c9" , "#622569" , "#ddd5af" , "#d9ad7c" , "#a2836e" , "#674d3c" , "grey" ]
2323
24- if ( width !== this . props . clientWidth - 50 || height !== - 145 + this . props . height * 100 ) {
25- const position = [ 51.4472055 , 4.4601085 ]
26- let position2 = [ 51.4972055 , 4.4801085 ] ;
24+ if ( width !== this . props . clientWidth - 50 || height !== - 145 + this . props . height * 100 ) {
25+ let nodesAndPositions = [
26+ {
27+ pos : [ 51.4972055 , 4.4801085 ] ,
28+ node : {
29+ id : 4
30+ }
31+ } ,
32+ {
33+ pos : [ 51.4472055 , 4.4601085 ] ,
34+ node : {
35+ id : 6
36+ }
37+ } ]
38+ ;
39+ let xPositions = nodesAndPositions . map ( i => i . pos [ 0 ] ) ;
40+ let yPositions = nodesAndPositions . map ( i => i . pos [ 1 ] ) ;
41+ let centerX = xPositions . reduce ( ( a , b ) => a + b , 0 ) / nodesAndPositions . length ;
42+ let centerY = yPositions . reduce ( ( a , b ) => a + b , 0 ) / nodesAndPositions . length ;
43+ // let minX = Math.min.apply(null, xPositions);
44+ let maxX = Math . max . apply ( null , xPositions ) ;
45+ // let minY = Math.min.apply(null, yPositions);
46+ let maxY = Math . max . apply ( null , yPositions ) ;
47+ // Build map objects
48+ let markers = nodesAndPositions . map ( i =>
49+ < Marker position = { i . pos } icon = { < div style = { { color : colors [ 0 ] } } > < Icon className = "close" > place</ Icon > </ div > } >
50+ < Popup > { JSON . stringify ( i . node ) } </ Popup >
51+ </ Marker > )
52+ let lines = [ < Polyline key = { 0 } positions = { [ [ 51.4972055 , 4.4801085 ] , [ 51.4472055 , 4.4601085 ] ] } color = { colors [ 0 ] } /> ] ;
53+
54+ // Set visualization object
2755 this . state . visualization =
28- < MapContainer key = { 0 } style = { { "width" : this . state . width + "px" , "height" : this . state . height + "px" } } center = { position } zoom = { 13 }
56+ < MapContainer key = { 0 } style = { { "width" : this . state . width + "px" , "height" : this . state . height + "px" } }
57+ center = {
58+ [
59+ centerX ,
60+ centerY
61+ ]
62+ } zoom = { 13 }
2963 scrollWheelZoom = { false } >
3064 < TileLayer
3165 attribution = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
3266 url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
3367 />
34- < Marker position = { position } icon = { < div style = { { color : colors [ 0 ] } } > < Icon className = "close" > place</ Icon > </ div > } >
35- < Popup >
36- A pretty CSS3 popup. < br /> Easily customizable. With a lot of text wooooooooooooooooh asdjadnas da sdas
37- </ Popup >
38- </ Marker >
39- < Marker position = { position2 } icon = { < div style = { { color : colors [ 0 ] } } > < Icon className = "close" > place</ Icon > </ div > } >
40- < Popup >
41- A pretty CSS3 popup. < br /> Easily customizable. With a lot of text wooooooooooooooooh asdjadnas da sdas
42- </ Popup >
43- </ Marker >
44- < Polyline key = { 0 } positions = { [
45- position , position2 ,
46- ] } color = { colors [ 0 ] } />
68+ { markers }
69+ { lines }
4770 </ MapContainer > ;
4871 this . forceUpdate ( ) ;
4972 }
0 commit comments