Skip to content

Commit 83b467a

Browse files
committed
Complex demo: Showcase how a icon url can be loaded
See #549
1 parent b4b5f80 commit 83b467a

File tree

2 files changed

+24
-13
lines changed
  • vaadin-maps-leaflet-flow-demo/src/main

2 files changed

+24
-13
lines changed

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

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ public class ComplexDemo extends AbstractDemo
5656

5757
private static final Logger LOG = LoggerFactory.getLogger(ComplexDemo.class);
5858
private static final String ID = "leaflet-demo-view";
59+
@SuppressWarnings("checkstyle:LineLength")
60+
private static final String INLINED_XDEV_LOGO = """
61+
data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="200" viewBox="0 0 18300 4500" style="background-color:rgba(180,180,180,0.7)">
62+
<defs>
63+
<style>
64+
.fil0{fill:%23d71e23}
65+
</style>
66+
</defs>
67+
<g>
68+
<path class="fil0" d="M9763 10965h-920l-17-6-1503-588-1506 588-11 4-13 2-1562 148-1102 105 1064-369 2311-801-1638-633-683-263h1609l16 6 1515 588 1521-588 10-4 9-1 1388-211 1177-178-1131 441-2177 849 1675 647 682 264zM25514 9520l-1909 1442-22 17h-693l-23-19-1765-1440-285-233h907l22 17 1490 1178 1395-1177 23-19h1171zM20426 10961h-4015V9260h4126l-1 127-1 99v126h-112l-3041-3 2 322 3038 3h110l2 124 1 83 2 128h-3146v352l3035-6h112v346z" transform="translate(-5400 -7700)"/>
69+
<path class="fil0" d="M10994 9275h2026a12150 12150 0 0 1 1368 73c292 35 559 83 798 143h1c290 73 510 158 659 254 165 106 248 229 248 368 0 134-85 254-254 359-151 94-375 180-672 256-292 76-618 132-977 170-359 37-751 56-1174 56h-2102V9275h79zm917 1354h1106c300 0 574-14 822-41 247-27 469-67 665-121h1a2470 2470 0 0 0 277-96c176-79 264-164 264-256 0-60-39-118-117-173-92-66-234-125-425-178-197-55-418-96-665-123-248-27-522-41-822-41h-1106v1029z" transform="translate(-5400 -7700)"/>
70+
</g>
71+
</svg>
72+
""";
5973

6074
private final LDefaultComponentManagementRegistry reg;
6175
private final LMap map;
@@ -130,19 +144,10 @@ public ComplexDemo()
130144

131145
@SuppressWarnings("checkstyle:LineLength")
132146
final LIcon iconXDEV = new LIcon(this.reg, new LIconOptions()
133-
.withIconUrl("""
134-
data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="200" viewBox="0 0 18300 4500" style="background-color:rgba(180,180,180,0.7)">
135-
<defs>
136-
<style>
137-
.fil0{fill:%23d71e23}
138-
</style>
139-
</defs>
140-
<g>
141-
<path class="fil0" d="M9763 10965h-920l-17-6-1503-588-1506 588-11 4-13 2-1562 148-1102 105 1064-369 2311-801-1638-633-683-263h1609l16 6 1515 588 1521-588 10-4 9-1 1388-211 1177-178-1131 441-2177 849 1675 647 682 264zM25514 9520l-1909 1442-22 17h-693l-23-19-1765-1440-285-233h907l22 17 1490 1178 1395-1177 23-19h1171zM20426 10961h-4015V9260h4126l-1 127-1 99v126h-112l-3041-3 2 322 3038 3h110l2 124 1 83 2 128h-3146v352l3035-6h112v346z" transform="translate(-5400 -7700)"/>
142-
<path class="fil0" d="M10994 9275h2026a12150 12150 0 0 1 1368 73c292 35 559 83 798 143h1c290 73 510 158 659 254 165 106 248 229 248 368 0 134-85 254-254 359-151 94-375 180-672 256-292 76-618 132-977 170-359 37-751 56-1174 56h-2102V9275h79zm917 1354h1106c300 0 574-14 822-41 247-27 469-67 665-121h1a2470 2470 0 0 0 277-96c176-79 264-164 264-256 0-60-39-118-117-173-92-66-234-125-425-178-197-55-418-96-665-123-248-27-522-41-822-41h-1106v1029z" transform="translate(-5400 -7700)"/>
143-
</g>
144-
</svg>
145-
""")
147+
.withIconUrl(INLINED_XDEV_LOGO)
148+
// You can also use the URL directly but note you may have to whitelist the resources accordingly
149+
// Comment this out to see the inline version above
150+
.withIconUrl("assets/XDEV_LOGO.svg")
146151
.withIconSize(new LPoint(this.reg, 125, 25)));
147152

148153
final LLatLng locationXDEV = new LLatLng(this.reg, 49.6756, 12.1610);
Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)