Skip to content

Commit 51ea1fe

Browse files
committed
Some improvements to the MarkerAPI
1 parent 29a99a9 commit 51ea1fe

File tree

6 files changed

+21
-28
lines changed

6 files changed

+21
-28
lines changed

src/main/java/de/bluecolored/bluemap/api/BlueMapAPI.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ public abstract class BlueMapAPI {
9999
* @param image the image to create
100100
* @param path the path/name of this image, the separator-char is '/'
101101
* @return the relative address of the image in the web-app
102+
* @throws IOException If an {@link IOException} is thrown while writing the image
102103
*/
103-
public abstract String createImage(BufferedImage image, String path);
104+
public abstract String createImage(BufferedImage image, String path) throws IOException;
104105

105106
/**
106107
* Getter for the installed BlueMap version

src/main/java/de/bluecolored/bluemap/api/marker/Marker.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,10 @@ public interface Marker {
140140
* @param newTab whether the link should be opened in a new tab
141141
*/
142142
void setLink(String link, boolean newTab);
143+
144+
/**
145+
* Removes the link of this {@link Marker}.
146+
*/
147+
void removeLink();
143148

144149
}

src/main/java/de/bluecolored/bluemap/api/marker/MarkerAPI.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ public interface MarkerAPI {
6666
* @return a {@link MarkerSet} with the given id
6767
*/
6868
MarkerSet createMarkerSet(String id);
69-
70-
/**
71-
* Adds the given {@link MarkerSet}.<br>
72-
* If a {@link MarkerSet} with the id of the given {@link MarkerSet} already exists it will be replaced!
73-
* @param markerSet the {@link MarkerSet} to be added
74-
*/
75-
void addMarkerSet(MarkerSet markerSet);
7669

7770
/**
7871
* Removes the given {@link MarkerSet}.<br>

src/main/java/de/bluecolored/bluemap/api/marker/MarkerSet.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ default POIMarker createPOIMarker(String id, BlueMapMap map, double posX, double
139139
* @param id the id of the new marker
140140
* @param map the {@link BlueMapMap} of the new marker
141141
* @param position the position of the new marker
142+
* @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
143+
* @param height the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
142144
* @return the created {@link ShapeMarker}
143145
*/
144-
ShapeMarker createShapeMarker(String id, BlueMapMap map, Vector3d position, Shape shape);
146+
ShapeMarker createShapeMarker(String id, BlueMapMap map, Vector3d position, Shape shape, float height);
145147

146148
/**
147149
* Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
@@ -152,19 +154,14 @@ default POIMarker createPOIMarker(String id, BlueMapMap map, double posX, double
152154
* @param posX the x-position of the new marker
153155
* @param posY the y-position of the new marker
154156
* @param posZ the z-position of the new marker
157+
* @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
158+
* @param height the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
155159
* @return the created {@link ShapeMarker}
156160
*/
157-
default ShapeMarker createShapeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape) {
158-
return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape);
161+
default ShapeMarker createShapeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape, float height) {
162+
return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape, height);
159163
}
160164

161-
/**
162-
* Adds the given {@link Marker} to this {@link MarkerSet}.<br>
163-
* If a {@link Marker} with the id of the given {@link Marker} already exists it will be replaced!
164-
* @param marker the {@link Marker} to be added
165-
*/
166-
void addMarker(Marker marker);
167-
168165
/**
169166
* Removes the given Marker from this {@link MarkerSet}.<br>
170167
* This is equivalent to calling <code>removeMarker(marker.getId())</code>.

src/main/java/de/bluecolored/bluemap/api/marker/POIMarker.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public interface POIMarker {
4848
* @param anchorX the x-position of the position (in pixels) where the icon is anchored to the map
4949
* @param anchorY the y-position of the position (in pixels) where the icon is anchored to the map
5050
*/
51-
void setIcon(String iconAddress, int anchorX, int anchorY);
51+
default void setIcon(String iconAddress, int anchorX, int anchorY) {
52+
setIcon(iconAddress, new Vector2i(anchorX, anchorY));
53+
}
5254

5355
/**
5456
* Sets the icon for this {@link POIMarker}.

src/main/java/de/bluecolored/bluemap/api/marker/ShapeMarker.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,19 @@ public interface ShapeMarker {
3535
*/
3636
Shape getShape();
3737

38-
/**
39-
* Sets the {@link Shape} of this {@link ShapeMarker}.
40-
* <p>The shape is placed on the xz-plane of the map, so the y-coordinates of the {@link Shape}'s points will be the z-coordinates in the map.</p>
41-
* @param shape the new {@link Shape}
42-
*/
43-
void setShape(Shape shape);
44-
4538
/**
4639
* Getter for the height (y-coordinate) of where the shape is displayed on the map.
4740
* @return the height of the shape on the map
4841
*/
4942
float getHeight();
5043

5144
/**
52-
* Sets the height (y-coordinate) of where the shape is displayed on the map.
45+
* Sets the {@link Shape} of this {@link ShapeMarker}.
46+
* <p>The shape is placed on the xz-plane of the map, so the y-coordinates of the {@link Shape}'s points will be the z-coordinates in the map.</p>
47+
* @param shape the new {@link Shape}
5348
* @param height the new height of the shape on the map
5449
*/
55-
void setHeight(float height);
50+
void setShape(Shape shape, float height);
5651

5752
/**
5853
* Getter for the {@link Color} of the border of the shape.

0 commit comments

Comments
 (0)