11package io .github .makbn .jlmap .model ;
22
3+ import io .github .makbn .jlmap .engine .JLTransport ;
34import io .github .makbn .jlmap .engine .JLTransporter ;
45import io .github .makbn .jlmap .listener .OnJLObjectActionListener ;
56import io .github .makbn .jlmap .model .function .JLFunctionBase ;
1718 */
1819@ RequiredArgsConstructor (access = AccessLevel .PROTECTED )
1920@ FieldDefaults (level = AccessLevel .PROTECTED , makeFinal = true )
20- public abstract sealed class JLObject <T extends JLObject <T >> implements JLFunctionBase <T > permits
21- JLCircle , JLCircleMarker , JLGeoJson , JLMarker , JLMultiPolyline , JLPolygon , JLPolyline , JLPopup {
21+ public abstract sealed class JLObject <T extends JLObject <T >> implements JLFunctionBase <T > permits JLCircle , JLCircleMarker , JLGeoJson , JLImageOverlay , JLMarker , JLMultiPolyline , JLPolygon , JLPolyline , JLPopup {
2222
23- @ Getter (AccessLevel .PROTECTED )
23+ @ Getter (AccessLevel .PUBLIC )
2424 JLTransporter <?> transport ;
2525
2626 @ NonFinal
@@ -30,6 +30,19 @@ public abstract sealed class JLObject<T extends JLObject<T>> implements JLFuncti
3030 @ NonFinal
3131 JLPopup popup ;
3232
33+ /**
34+ * By default, marker images zIndex is set automatically based on its latitude.
35+ * Use this option if you want to put the marker on top of all others (or below),
36+ * specifying a high value like 1000 (or high negative value, respectively).
37+ */
38+ @ NonFinal
39+ int zIndexOffset = 0 ;
40+ /**
41+ * The opacity of the marker.
42+ */
43+ @ NonFinal
44+ double opacity = 1.0 ;
45+
3346 public OnJLObjectActionListener <T > getOnActionListener () {
3447 return listener ;
3548 }
@@ -43,4 +56,35 @@ public void setOnActionListener(OnJLObjectActionListener<T> listener) {
4356 public void update (Object ... params ) {
4457
4558 }
59+
60+
61+ /**
62+ * By default, marker images zIndex is set automatically based on its latitude. Use this option if you want
63+ * to put the marker on top of all others (or below), specifying a high value like 1000 (or high
64+ * negative value, respectively).
65+ * Read more <a href="https://leafletjs.com/reference.html#marker-zindexoffset">here</a>!
66+ *
67+ * @param offset new zIndex offset of the marker.
68+ * @return the current instance of JLMarker.
69+ */
70+ public T setZIndexOffset (int offset ) {
71+ getTransport ().execute (new JLTransport (this ,
72+ String .format ("this.%s.setZIndexOffset(%d);" , getId (), offset )));
73+ this .zIndexOffset = offset ;
74+ return self ();
75+ }
76+
77+ /**
78+ * Changes the marker opacity.
79+ * Read more <a href="https://leafletjs.com/reference.html#marker-opacity">here</a>!
80+ *
81+ * @param opacity value between 0.0 and 1.0.
82+ * @return the current instance of JLMarker.
83+ */
84+ public T setOpacity (double opacity ) {
85+ getTransport ().execute (new JLTransport (this ,
86+ String .format ("this.%s.setOpacity(%f);" , getId (), opacity )));
87+ this .opacity = opacity ;
88+ return self ();
89+ }
4690}
0 commit comments