File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
jlmap-api/src/main/java/io/github/makbn/jlmap/model/builder Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 22
33import io .github .makbn .jlmap .model .JLBounds ;
44import io .github .makbn .jlmap .model .JLImageOverlay ;
5+ import io .github .makbn .jlmap .model .JLLatLng ;
56import lombok .AccessLevel ;
67import lombok .experimental .FieldDefaults ;
78
@@ -20,6 +21,7 @@ public JLImageOverlayBuilder setImageUrl(String imageUrl) {
2021
2122 /**
2223 * Set bounds using two double arrays: [lat, lng] for southwest and northeast corners.
24+ * First item is southwest and second is northeast.
2325 */
2426 public JLImageOverlayBuilder setBounds (List <double []> bounds ) {
2527 if (bounds == null || bounds .size () != 2 )
@@ -62,10 +64,27 @@ public String buildJsElement() {
6264
6365 @ Override
6466 public JLImageOverlay buildJLObject () {
67+ // first element is southWest [lat, lng]
68+ var southWest = JLLatLng .builder ()
69+ .lat (bounds .get (0 )[0 ])
70+ .lng (bounds .get (0 )[1 ])
71+ .build ();
72+
73+ // second element is northEast [lat, lng]
74+ var northEast = JLLatLng .builder ()
75+ .lat (bounds .get (1 )[0 ])
76+ .lng (bounds .get (1 )[1 ])
77+ .build ();
78+
79+ var jlBounds = JLBounds .builder ()
80+ .northEast (northEast )
81+ .southWest (southWest )
82+ .build ();
83+
6584 return JLImageOverlay .builder ()
6685 .id (uuid )
6786 .imageUrl (imageUrl )
68- .bounds (JLBounds . builder (). build () )
87+ .bounds (jlBounds )
6988 .options (jlOptions )
7089 .transport (transporter )
7190 .build ();
You can’t perform that action at this time.
0 commit comments