Skip to content

Commit be674b7

Browse files
committed
added image overlay and add function
Signed-off-by: makbn <mehdi74akbarian@gmail.com>
1 parent 493a63d commit be674b7

File tree

2 files changed

+64
-4
lines changed

2 files changed

+64
-4
lines changed

jlmap-api/src/main/java/io/github/makbn/jlmap/layer/leaflet/LeafletUILayerInt.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package io.github.makbn.jlmap.layer.leaflet;
22

3-
import io.github.makbn.jlmap.model.JLLatLng;
4-
import io.github.makbn.jlmap.model.JLMarker;
5-
import io.github.makbn.jlmap.model.JLOptions;
6-
import io.github.makbn.jlmap.model.JLPopup;
3+
import io.github.makbn.jlmap.model.*;
74

85
/**
96
* The {@code LeafletUILayerInt} interface defines methods for adding and
@@ -71,5 +68,16 @@ public interface LeafletUILayerInt extends LeafletLayer {
7168
* was not found.
7269
*/
7370
boolean removePopup(String id);
71+
72+
/**
73+
* Instantiates an image overlay object given the URL of the image and the geographical bounds it is tied to.
74+
* Read more about it on <a href="https://leafletjs.com/reference.html#videooverlay">Leaflet ImageOverlay</a>
75+
*
76+
* @param bounds the geographical bounds the image is tied to.
77+
* @param imageUrl URL of the image to be used as an overlay. (can be local or remote URL)
78+
* @param options theming options for JLImageOverlay. all options are not available!
79+
* @return The {@link JLImageOverlay} representing the added image overlay on the map.
80+
*/
81+
JLImageOverlay addImage(JLBounds bounds, String imageUrl, JLOptions options);
7482
}
7583

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package io.github.makbn.jlmap.model;
2+
3+
import io.github.makbn.jlmap.engine.JLTransporter;
4+
import lombok.AccessLevel;
5+
import lombok.Builder;
6+
import lombok.Getter;
7+
import lombok.ToString;
8+
import lombok.experimental.FieldDefaults;
9+
10+
/**
11+
* An image overlay object given the URL of the image and the geographical bounds it is tied to.
12+
* * @author Matt Akbarian (@makbn)`
13+
*/
14+
@Getter
15+
@ToString
16+
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
17+
public final class JLImageOverlay extends JLObject<JLImageOverlay> {
18+
19+
/**
20+
* id of object! this is an internal id for JLMap Application and not
21+
* related to Leaflet!
22+
*/
23+
String id;
24+
25+
/**
26+
* URL of the image to be used as an overlay. (can be local or remote URL)
27+
*/
28+
String imageUrl;
29+
/**
30+
* Coordinates of the JLMarker on the map
31+
*/
32+
JLBounds bounds;
33+
/**
34+
* theming options for JLImageOverlay. all options are not available!
35+
*/
36+
JLOptions options;
37+
38+
@Builder(toBuilder = true)
39+
private JLImageOverlay(String id, String imageUrl, JLBounds bounds, JLOptions options, JLTransporter<?> transport) {
40+
super(transport);
41+
this.id = id;
42+
this.imageUrl = imageUrl;
43+
this.bounds = bounds;
44+
this.options = options;
45+
}
46+
47+
48+
@Override
49+
public JLImageOverlay self() {
50+
return this;
51+
}
52+
}

0 commit comments

Comments
 (0)