Skip to content

Commit 3406120

Browse files
author
“Malcolm
committed
Added example plugin
1 parent f408282 commit 3406120

1 file changed

Lines changed: 55 additions & 5 deletions

File tree

  • platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/plugin

platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/plugin/PluginProtocolExample.kt

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ import java.net.URI
77

88

99
class PluginProtocolExample : PluginProtocolHandler() {
10+
var styleLoaded: Boolean = false;
1011

1112
override fun canRequestResource(resource: PluginProtocolHandlerResource?): Boolean {
12-
13-
return true;
13+
if (!styleLoaded) {
14+
styleLoaded = true;
15+
return true;
16+
}
17+
return false;
1418

1519
}
1620

@@ -43,9 +47,55 @@ class PluginProtocolExample : PluginProtocolHandler() {
4347
" \"visibility\": \"visible\"\n" +
4448
" },\n" +
4549
" \"maxzoom\": 24\n" +
46-
" }\n"
47-
" ]\n"
48-
" } \n"
50+
" },\n"+
51+
" {\n" +
52+
" \"id\": \"coastline\",\n" +
53+
" \"type\": \"line\",\n" +
54+
" \"paint\": {\n" +
55+
" \"line-blur\": 0.5,\n" +
56+
" \"line-color\": \"#198EC8\",\n" +
57+
" \"line-width\": {\n" +
58+
" \"stops\": [\n" +
59+
" [\n" +
60+
" 0,\n" +
61+
" 2\n" +
62+
" ],\n" +
63+
" [\n" +
64+
" 6,\n" +
65+
" 6\n" +
66+
" ],\n" +
67+
" [\n" +
68+
" 14,\n" +
69+
" 9\n" +
70+
" ],\n" +
71+
" [\n" +
72+
" 22,\n" +
73+
" 18\n" +
74+
" ]\n" +
75+
" ]\n" +
76+
" }\n" +
77+
" },\n" +
78+
" \"filter\": [\n" +
79+
" \"all\"\n" +
80+
" ],\n" +
81+
" \"layout\": {\n" +
82+
" \"line-cap\": \"round\",\n" +
83+
" \"line-join\": \"round\",\n" +
84+
" \"visibility\": \"visible\"\n" +
85+
" },\n" +
86+
" \"source\": \"maplibre\",\n" +
87+
" \"maxzoom\": 24,\n" +
88+
" \"minzoom\": 0,\n" +
89+
" \"source-layer\": \"countries\"\n" +
90+
" }"+
91+
" ],\n"+
92+
" \"sources\": {\n" +
93+
" \"maplibre\": {\n" +
94+
" \"url\": \"https://demotiles.maplibre.org/tiles/tiles.json\",\n" +
95+
" \"type\": \"vector\"\n" +
96+
" },"+
97+
" \"version\": 8\n"+
98+
" } }\n";
4999

50100
tempResult.generateBuffer(tempStyle);
51101
return tempResult;

0 commit comments

Comments
 (0)