2
2
3
3
import java .util .List ;
4
4
5
- import com .vaadin .flow .component .html .Anchor ;
6
5
import com .vaadin .flow .component .orderedlayout .HorizontalLayout ;
7
6
import com .vaadin .flow .component .treegrid .TreeGrid ;
8
7
import com .vaadin .flow .router .Route ;
22
21
public class MultiLayerWithPyramidDemo extends HorizontalLayout
23
22
{
24
23
public static final String NAV = "/multilayer" ;
24
+ private static final String WIKIPEDIA_THUMB = "https://upload.wikimedia.org/wikipedia/commons/thumb/" ;
25
25
26
26
private static final List <BuildingData > DATA = List .of (
27
27
new BuildingComplex (
@@ -30,14 +30,19 @@ public class MultiLayerWithPyramidDemo extends HorizontalLayout
30
30
new Building (
31
31
"Great Pyramid of Giza" ,
32
32
"https://en.wikipedia.org/wiki/Great_Pyramid_of_Giza" ,
33
+ WIKIPEDIA_THUMB + "e/e3/Kheops-Pyramid.jpg/320px-Kheops-Pyramid.jpg" ,
33
34
createRectangleDataPoints (29.980138 , 31.133104 , 29.978121 , 31.135367 )),
34
35
new Building (
35
36
"Pyramid of Khafre" ,
36
37
"https://en.wikipedia.org/wiki/Pyramid_of_Khafre" ,
38
+ WIKIPEDIA_THUMB + "e/e4/Khephren_009.jpg/320px-Khephren_009.jpg" ,
37
39
createRectangleDataPoints (29.976912 , 31.129671 , 29.974964 , 31.1318537 )),
38
40
new Building (
39
41
"Pyramid of Menkaure" ,
40
42
"https://en.wikipedia.org/wiki/Pyramid_of_Menkaure" ,
43
+ WIKIPEDIA_THUMB
44
+ + "3/38/Cairo%2C_Gizeh%2C_Pyramid_of_Menkaure%2C_Egypt%2C_Oct_2005"
45
+ + ".jpg/320px-Cairo%2C_Gizeh%2C_Pyramid_of_Menkaure%2C_Egypt%2C_Oct_2005.jpg" ,
41
46
createRectangleDataPoints (29.972898 , 31.127787 , 29.972039 , 31.1287585 )))
42
47
),
43
48
new BuildingComplex (
@@ -46,6 +51,8 @@ public class MultiLayerWithPyramidDemo extends HorizontalLayout
46
51
new Building (
47
52
"Sphinx 🐈" ,
48
53
"https://en.wikipedia.org/wiki/Great_Sphinx_of_Giza" ,
54
+ WIKIPEDIA_THUMB
55
+ + "f/f6/Great_Sphinx_of_Giza_-_20080716a.jpg/320px-Great_Sphinx_of_Giza_-_20080716a.jpg" ,
49
56
List .of (
50
57
new DataPoint (29.975283598029613 , 31.137253754493454 ),
51
58
new DataPoint (29.97535970910997 , 31.137377101561537 ),
@@ -66,6 +73,7 @@ public class MultiLayerWithPyramidDemo extends HorizontalLayout
66
73
new Building (
67
74
"Tomb of Queen Khentkaus I" ,
68
75
"https://en.wikipedia.org/wiki/Pyramid_of_Khentkaus_I" ,
76
+ "https://upload.wikimedia.org/wikipedia/commons/b/b6/Tomb_of_Khentkaus_I.jpg" ,
69
77
createRectangleDataPoints (29.973586 , 31.135233 , 29.973164 , 31.135737 )
70
78
)
71
79
)
@@ -144,7 +152,11 @@ private void createPolygonAndAddToActiveLayerGroup(final Building building)
144
152
new LPolygon (this .reg , building .dataPoints ().stream ()
145
153
.map (dp -> new LLatLng (this .reg , dp .lat (), dp .lng ()))
146
154
.toList ())
147
- .bindPopup (new Anchor (building .url (), building .name ()).getElement ().getOuterHTML ())
155
+ .bindPopup (
156
+ "<a href='" + building .url () + "' target='_blank'>"
157
+ + "<center><b>" + building .name () + "</b></center><br>"
158
+ + "<img style='width:12em' src='" + building .imageUrl () + "'>"
159
+ + "</a>" )
148
160
.addTo (this .activeLayerGroup );
149
161
}
150
162
@@ -167,6 +179,7 @@ public List<BuildingData> nested()
167
179
record Building (
168
180
String name ,
169
181
String url ,
182
+ String imageUrl ,
170
183
List <DataPoint > dataPoints
171
184
) implements BuildingData
172
185
{
0 commit comments