Skip to content

Commit 1d47d22

Browse files
committed
Improve ▲ demo
1 parent 03ac395 commit 1d47d22

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

vaadin-maps-leaflet-flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/MultiLayerWithPyramidDemo.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.List;
44

5-
import com.vaadin.flow.component.html.Anchor;
65
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
76
import com.vaadin.flow.component.treegrid.TreeGrid;
87
import com.vaadin.flow.router.Route;
@@ -22,6 +21,7 @@
2221
public class MultiLayerWithPyramidDemo extends HorizontalLayout
2322
{
2423
public static final String NAV = "/multilayer";
24+
private static final String WIKIPEDIA_THUMB = "https://upload.wikimedia.org/wikipedia/commons/thumb/";
2525

2626
private static final List<BuildingData> DATA = List.of(
2727
new BuildingComplex(
@@ -30,14 +30,19 @@ public class MultiLayerWithPyramidDemo extends HorizontalLayout
3030
new Building(
3131
"Great Pyramid of Giza",
3232
"https://en.wikipedia.org/wiki/Great_Pyramid_of_Giza",
33+
WIKIPEDIA_THUMB + "e/e3/Kheops-Pyramid.jpg/320px-Kheops-Pyramid.jpg",
3334
createRectangleDataPoints(29.980138, 31.133104, 29.978121, 31.135367)),
3435
new Building(
3536
"Pyramid of Khafre",
3637
"https://en.wikipedia.org/wiki/Pyramid_of_Khafre",
38+
WIKIPEDIA_THUMB + "e/e4/Khephren_009.jpg/320px-Khephren_009.jpg",
3739
createRectangleDataPoints(29.976912, 31.129671, 29.974964, 31.1318537)),
3840
new Building(
3941
"Pyramid of Menkaure",
4042
"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",
4146
createRectangleDataPoints(29.972898, 31.127787, 29.972039, 31.1287585)))
4247
),
4348
new BuildingComplex(
@@ -46,6 +51,8 @@ public class MultiLayerWithPyramidDemo extends HorizontalLayout
4651
new Building(
4752
"Sphinx 🐈",
4853
"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",
4956
List.of(
5057
new DataPoint(29.975283598029613, 31.137253754493454),
5158
new DataPoint(29.97535970910997, 31.137377101561537),
@@ -66,6 +73,7 @@ public class MultiLayerWithPyramidDemo extends HorizontalLayout
6673
new Building(
6774
"Tomb of Queen Khentkaus I",
6875
"https://en.wikipedia.org/wiki/Pyramid_of_Khentkaus_I",
76+
"https://upload.wikimedia.org/wikipedia/commons/b/b6/Tomb_of_Khentkaus_I.jpg",
6977
createRectangleDataPoints(29.973586, 31.135233, 29.973164, 31.135737)
7078
)
7179
)
@@ -144,7 +152,11 @@ private void createPolygonAndAddToActiveLayerGroup(final Building building)
144152
new LPolygon(this.reg, building.dataPoints().stream()
145153
.map(dp -> new LLatLng(this.reg, dp.lat(), dp.lng()))
146154
.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>")
148160
.addTo(this.activeLayerGroup);
149161
}
150162

@@ -167,6 +179,7 @@ public List<BuildingData> nested()
167179
record Building(
168180
String name,
169181
String url,
182+
String imageUrl,
170183
List<DataPoint> dataPoints
171184
) implements BuildingData
172185
{

0 commit comments

Comments
 (0)