Some improvements to the MarkerAPI

This commit is contained in:
Blue (Lukas Rieger) 2020-04-19 20:03:59 +02:00
parent 29a99a9295
commit 51ea1fe8d1
6 changed files with 21 additions and 28 deletions

View File

@ -99,8 +99,9 @@ public abstract class BlueMapAPI {
* @param image the image to create
* @param path the path/name of this image, the separator-char is '/'
* @return the relative address of the image in the web-app
* @throws IOException If an {@link IOException} is thrown while writing the image
*/
public abstract String createImage(BufferedImage image, String path);
public abstract String createImage(BufferedImage image, String path) throws IOException;
/**
* Getter for the installed BlueMap version

View File

@ -140,5 +140,10 @@ public interface Marker {
* @param newTab whether the link should be opened in a new tab
*/
void setLink(String link, boolean newTab);
/**
* Removes the link of this {@link Marker}.
*/
void removeLink();
}

View File

@ -66,13 +66,6 @@ public interface MarkerAPI {
* @return a {@link MarkerSet} with the given id
*/
MarkerSet createMarkerSet(String id);
/**
* Adds the given {@link MarkerSet}.<br>
* If a {@link MarkerSet} with the id of the given {@link MarkerSet} already exists it will be replaced!
* @param markerSet the {@link MarkerSet} to be added
*/
void addMarkerSet(MarkerSet markerSet);
/**
* Removes the given {@link MarkerSet}.<br>

View File

@ -139,9 +139,11 @@ public interface MarkerSet {
* @param id the id of the new marker
* @param map the {@link BlueMapMap} of the new marker
* @param position the position of the new marker
* @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @param height the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @return the created {@link ShapeMarker}
*/
ShapeMarker createShapeMarker(String id, BlueMapMap map, Vector3d position, Shape shape);
ShapeMarker createShapeMarker(String id, BlueMapMap map, Vector3d position, Shape shape, float height);
/**
* Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
@ -152,19 +154,14 @@ public interface MarkerSet {
* @param posX the x-position of the new marker
* @param posY the y-position of the new marker
* @param posZ the z-position of the new marker
* @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @param height the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @return the created {@link ShapeMarker}
*/
default ShapeMarker createShapeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape) {
return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape);
default ShapeMarker createShapeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape, float height) {
return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape, height);
}
/**
* Adds the given {@link Marker} to this {@link MarkerSet}.<br>
* If a {@link Marker} with the id of the given {@link Marker} already exists it will be replaced!
* @param marker the {@link Marker} to be added
*/
void addMarker(Marker marker);
/**
* Removes the given Marker from this {@link MarkerSet}.<br>
* This is equivalent to calling <code>removeMarker(marker.getId())</code>.

View File

@ -48,7 +48,9 @@ public interface POIMarker {
* @param anchorX the x-position of the position (in pixels) where the icon is anchored to the map
* @param anchorY the y-position of the position (in pixels) where the icon is anchored to the map
*/
void setIcon(String iconAddress, int anchorX, int anchorY);
default void setIcon(String iconAddress, int anchorX, int anchorY) {
setIcon(iconAddress, new Vector2i(anchorX, anchorY));
}
/**
* Sets the icon for this {@link POIMarker}.

View File

@ -35,13 +35,6 @@ public interface ShapeMarker {
*/
Shape getShape();
/**
* Sets the {@link Shape} of this {@link ShapeMarker}.
* <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>
* @param shape the new {@link Shape}
*/
void setShape(Shape shape);
/**
* Getter for the height (y-coordinate) of where the shape is displayed on the map.
* @return the height of the shape on the map
@ -49,10 +42,12 @@ public interface ShapeMarker {
float getHeight();
/**
* Sets the height (y-coordinate) of where the shape is displayed on the map.
* Sets the {@link Shape} of this {@link ShapeMarker}.
* <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>
* @param shape the new {@link Shape}
* @param height the new height of the shape on the map
*/
void setHeight(float height);
void setShape(Shape shape, float height);
/**
* Getter for the {@link Color} of the border of the shape.