From 3bed723f27bde9663daf142f4dc5f58ba4f2010a Mon Sep 17 00:00:00 2001
From: "Lukas Rieger (Blue)" This API is thread-save, so you can use it async, off the main-server-thread, to save performance! This API is thread-save, so you can use it async, off the main-server-thread, to save performance! See the documentation of {@link BlueMapWorld#getUuid()} for more information about the nature of the worlds {@link UUID}s! The given If the image file with the given path already exists, it will be replaced. The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded! (Note: The consumer will likely be called asynchronously, not on the server-thread!) Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}. The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded! (Note: The consumer will likely be called asynchronously, not on the server-thread!) Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}. See the documentation of {@link BlueMapWorld#getUuid()} for more information about the nature of the worlds {@link UUID}s! The given If the image file with the given path already exists, it will be replaced. The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded! (Note: The consumer will likely be called asynchronously, not on the server-thread!) Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}. The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded! (Note: The consumer will likely be called asynchronously, not on the server-thread!) Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}. (Note: This method will likely be called asynchronously, not on the server-thread! (Note: This method will likely be called asynchronously, not on the server-thread! (Note: This method will likely be called asynchronously, not on the server-thread! (Note: This method will likely be called asynchronously, not on the server-thread! Sets a filter that determines if a specific (hires) tile of this map should be updated or not.
- * If this filter returns false for a tile, the "render"-process of this tile will be cancelled and the tile will be left untouched. Warning: Using this method will harm the integrity of the map! Since BlueMap will still assume that the tile got updated properly. Any previously set filters will get overwritten with the new one. You can get the current filter using {@link #getTileFilter()} and combine them if you wish. Sets a filter that determines if a specific (hires) tile of this map should be updated or not.
+ * If this filter returns false for a tile, the "render"-process of this tile will be cancelled and the tile will be left untouched. Warning: Using this method will harm the integrity of the map! Since BlueMap will still assume that the tile got updated properly. Any previously set filters will get overwritten with the new one. You can get the current filter using {@link #getTileFilter()} and combine them if you wish. Getter for the {@link UUID} of the world.
- * The {@link UUID}s of this worlds are not guaranteed to be consistent across reloads/restarts!
- *
- * Implementation notes: Getter for the {@link UUID} of the world.
+ * The {@link UUID}s of this worlds are not guaranteed to be consistent across reloads/restarts!
+ *
+ * Implementation notes: The shape is placed on the xz-plane of the map, so the y-coordinates of the {@link Shape}'s points are the z-coordinates in the map. The shape is placed on the xz-plane of the map, so the y-coordinates of the {@link Shape}'s points are the z-coordinates in the map. 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. 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.
+ * Important:
- * Important: Each marker has an id that is unique in the {@link MarkerSet} that it is in. Each marker has an id that is unique in the {@link MarkerSet} that it is in. The id is unique in the {@link MarkerSet} that this marker is in.
- * Using html-tags in the label is possible but deprecated!
- *
- * Important: The id is unique in the {@link MarkerSet} that this marker is in.
+ * Using html-tags in the label is possible but deprecated!
+ *
+ * Important:
- * Calling this gives you a fresh loaded {@link MarkerAPI}, so you don't have to call {@link MarkerAPI#load()} right away!
- * @return the {@link MarkerAPI}
- * @throws IOException if there was an IOException loading the marker.json
- */
- public abstract MarkerAPI getMarkerAPI() throws IOException;
-
- /**
- * Getter for all {@link BlueMapMap}s loaded by BlueMap.
- * @return an unmodifiable collection of all loaded {@link BlueMapMap}s
- */
- public abstract Collectionpath
is used as file-name and (separated with '/') optional folders to organize the image-files. Do NOT include the file-ending! (e.g. "someFolder/somePOIIcon"
will result in a file "somePOIIcon.png" in a folder "someFolder").
- *
- * @throws IOException If an {@link IOException} is thrown while reading the images
- */
- public abstract Map
+ * Calling this gives you a fresh loaded {@link MarkerAPI}, so you don't have to call {@link MarkerAPI#load()} right away!
+ * @return the {@link MarkerAPI}
+ * @throws IOException if there was an IOException loading the marker.json
+ */
+ public abstract MarkerAPI getMarkerAPI() throws IOException;
- /**
- * Getter for the installed BlueMap version
- * @return the version-string
- */
- public abstract String getBlueMapVersion();
-
- /**
- * Register a listener that will be called when the API enables/disables
- * @param listener the {@link BlueMapAPIListener}
- *
- * @deprecated Implementing {@link BlueMapAPIListener} can cause a ClassNotFoundException when you soft-depend on BlueMap and your plugin/mod gets used without BlueMap.
- * Use {@link BlueMapAPI#onEnable(Consumer)} and {@link BlueMapAPI#onDisable(Consumer)} instead.
- */
- @Deprecated
- public static synchronized void registerListener(BlueMapAPIListener listener) {
- BlueMapAPI.listener.add(listener);
- if (BlueMapAPI.instance != null) listener.onEnable(BlueMapAPI.instance);
- }
-
- /**
- * Removes/Unregisters a previously registered listener
- * @param listener the {@link BlueMapAPIListener} instance that has been registered previously
- *
- * @return true
if a listener was removed as a result of this call
- *
- * @deprecated Implementing {@link BlueMapAPIListener} can cause a ClassNotFoundException when you soft-depend on BlueMap and your plugin/mod gets used without BlueMap.
- * Use {@link BlueMapAPI#onEnable(Consumer)} and {@link BlueMapAPI#onDisable(Consumer)} instead.
- */
- @Deprecated
- public static synchronized boolean unregisterListener(BlueMapAPIListener listener) {
- return BlueMapAPI.listener.remove(listener);
- }
-
- /**
- * Returns an instance of {@link BlueMapAPI} if it is currently enabled, else an empty {@link Optional} is returned.
- * @return an {@link Optional}<{@link BlueMapAPI}>
- */
- public static synchronized Optional
- * If {@link BlueMapAPI} is already enabled when this listener is registered the consumer will be called immediately (once, on the same thread)!
- *
- * Unlike with {@link BlueMapAPI#onEnable(Consumer)}, if {@link BlueMapAPI} is not enabled when this listener is registered the consumer will not be called.
- * true
if a listener was removed as a result of this call
- */
- public static synchronized boolean unregisterListener(Consumertrue
if the instance has been registered, false
if there already was an instance registered
- * @throws ExecutionException if a {@link BlueMapAPIListener} threw an exception during the registration
- */
- @SuppressWarnings("deprecation")
- protected static synchronized boolean registerInstance(BlueMapAPI instance) throws ExecutionException {
- if (BlueMapAPI.instance != null) return false;
-
- BlueMapAPI.instance = instance;
+ /**
+ * Getter for a {@link BlueMapMap} loaded by BlueMap with the given id.
+ * @param id the map id (equivalent to the id configured in BlueMap's config
+ * @return an {@link Optional} with the {@link BlueMapMap} if it exists
+ */
+ public abstract Optionalpath
is used as file-name and (separated with '/') optional folders to organize the image-files. Do NOT include the file-ending! (e.g. "someFolder/somePOIIcon"
will result in a file "somePOIIcon.png" in a folder "someFolder").true
if the instance was unregistered, false
if there was no or an other instance registered
- * @throws ExecutionException if a {@link BlueMapAPIListener} threw an exception during the un-registration
- */
- @SuppressWarnings("deprecation")
- protected static synchronized boolean unregisterInstance(BlueMapAPI instance) throws ExecutionException {
- if (BlueMapAPI.instance != instance) return false;
+ /**
+ * Lists all images that are available. This includes all images previously created with the {@link #createImage(BufferedImage, String)}
+ * function, but might include more.
+ * @return A map of available images where:
+ *
+ *
+ * @throws IOException If an {@link IOException} is thrown while reading the images
+ */
+ public abstract Maptrue
if a listener was removed as a result of this call
+ *
+ * @deprecated Implementing {@link BlueMapAPIListener} can cause a ClassNotFoundException when you soft-depend on BlueMap and your plugin/mod gets used without BlueMap.
+ * Use {@link BlueMapAPI#onEnable(Consumer)} and {@link BlueMapAPI#onDisable(Consumer)} instead.
+ */
+ @Deprecated
+ public static synchronized boolean unregisterListener(BlueMapAPIListener listener) {
+ return BlueMapAPI.listener.remove(listener);
+ }
+
+ /**
+ * Returns an instance of {@link BlueMapAPI} if it is currently enabled, else an empty {@link Optional} is returned.
+ * @return an {@link Optional}<{@link BlueMapAPI}>
+ */
+ public static synchronized Optional
+ * If {@link BlueMapAPI} is already enabled when this listener is registered the consumer will be called immediately (once, on the same thread)!
+ *
+ * Unlike with {@link BlueMapAPI#onEnable(Consumer)}, if {@link BlueMapAPI} is not enabled when this listener is registered the consumer will not be called.
+ * true
if a listener was removed as a result of this call
+ */
+ public static synchronized boolean unregisterListener(Consumertrue
if the instance has been registered, false
if there already was an instance registered
+ * @throws ExecutionException if a {@link BlueMapAPIListener} threw an exception during the registration
+ */
+ @SuppressWarnings("deprecation")
+ protected static synchronized boolean registerInstance(BlueMapAPI instance) throws ExecutionException {
+ if (BlueMapAPI.instance != null) return false;
+
+ BlueMapAPI.instance = instance;
+
+ Listtrue
if the instance was unregistered, false
if there was no or an other instance registered
+ * @throws ExecutionException if a {@link BlueMapAPIListener} threw an exception during the un-registration
+ */
+ @SuppressWarnings("deprecation")
+ protected static synchronized boolean unregisterInstance(BlueMapAPI instance) throws ExecutionException {
+ if (BlueMapAPI.instance != instance) return false;
+
+ List
- * If {@link BlueMapAPI} is already enabled when this listener is registered this method will be called immediately (on the same thread)!
- *
- * Unlike {@link BlueMapAPIListener#onEnable(BlueMapAPI)}, if {@link BlueMapAPI} is not enabled when this listener is registered this method will not be called immediately.
- *
+ * If {@link BlueMapAPI} is already enabled when this listener is registered this method will be called immediately (on the same thread)!
+ *
+ * Unlike {@link BlueMapAPIListener#onEnable(BlueMapAPI)}, if {@link BlueMapAPI} is not enabled when this listener is registered this method will not be called immediately.
+ *
- * E.g. an offset of (2|-1) would mean that the tile (0|0) has block (2|0|-1) at it's min-corner.
- * @return the tile-offset in blocks
- */
- Vector2i getTileOffset();
+ /**
+ * Getter for the {@link BlueMapWorld} of this map.
+ * @return the {@link BlueMapWorld} of this map
+ */
+ BlueMapWorld getWorld();
- /**
- *
+ * E.g. an offset of (2|-1) would mean that the tile (0|0) has block (2|0|-1) at it's min-corner.
+ * @return the tile-offset in blocks
+ */
+ Vector2i getTileOffset();
- /**
- * Checks if the map is currently frozen
- * @return true if the map is frozen, false otherwise
- */
- boolean isFrozen();
+ /**
+ * t -> true
.
- */
- Predicatet -> true
.
+ */
+ Predicate
- * The used UUID highly depends on the implementation
- *
- *
- *
- * @return the {@link UUID} of the world
- */
- UUID getUuid();
-
- /**
- * Getter for the {@link Path} of this world's save-files (folder). This matches the folder configured in bluemap's config for this map (
- * Sponge The UUID is equal to the returned UUID by world-instances of the Sponge-API, so you can just use spongeWorld.getUniqueId()
- * Bukkit The UUID is equal to the returned UUID by world-instances of the Bukkit-API, so you can just use bukkitWorld.getUID()
- * Forge The UUID is randomly generated, and changes on each reload/restart
- * CLI The UUID is randomly generated, and changes on each reload/restart world:
).
- * @return the save-folder of this world.
- */
- Path getSaveFolder();
-
- /**
- * Getter for all {@link BlueMapMap}s for this world
- * @return an unmodifiable {@link Collection} of all {@link BlueMapMap}s for this world
- */
- Collection
+ * The used UUID highly depends on the implementation
+ *
+ *
+ *
+ * @return the {@link UUID} of the world
+ */
+ UUID getUuid();
+
+ /**
+ * Getter for the {@link Path} of this world's save-files (folder). This matches the folder configured in bluemap's config for this map (
+ * Sponge The UUID is equal to the returned UUID by world-instances of the Sponge-API, so you can just use spongeWorld.getUniqueId()
+ * Bukkit The UUID is equal to the returned UUID by world-instances of the Bukkit-API, so you can just use bukkitWorld.getUID()
+ * Forge The UUID is randomly generated, and changes on each reload/restart
+ * CLI The UUID is randomly generated, and changes on each reload/restart world:
).
+ * @return the save-folder of this world.
+ */
+ Path getSaveFolder();
+
+ /**
+ * Getter for all {@link BlueMapMap}s for this world
+ * @return an unmodifiable {@link Collection} of all {@link BlueMapMap}s for this world
+ */
+ Collection
- * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
- *
- * @return the minimum distance for this {@link Marker} to be displayed
- */
- double getMinDistance();
+ /**
+ * Getter for the minimum distance of the camera to the position for this {@link Marker} to be displayed.
+ * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @return the minimum distance for this {@link Marker} to be displayed
+ */
+ double getMinDistance();
- /**
- * Sets the minimum distance of the camera to the position of the {@link Marker} for it to be displayed.
- * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
- *
- * @param minDistance the new minimum distance
- */
- void setMinDistance(double minDistance);
+ /**
+ * Sets the minimum distance of the camera to the position of the {@link Marker} for it to be displayed.
+ * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @param minDistance the new minimum distance
+ */
+ void setMinDistance(double minDistance);
- /**
- * Getter for the maximum distance of the camera to the position of the {@link Marker} for it to be displayed.
- * If the camera is further to this {@link Marker} than this distance, it will be hidden!
- *
- * @return the maximum distance for this {@link Marker} to be displayed
- */
- double getMaxDistance();
+ /**
+ * Getter for the maximum distance of the camera to the position of the {@link Marker} for it to be displayed.
+ * If the camera is further to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @return the maximum distance for this {@link Marker} to be displayed
+ */
+ double getMaxDistance();
- /**
- * Sets the maximum distance of the camera to the position of the {@link Marker} for it to be displayed.
- * If the camera is further to this {@link Marker} than this distance, it will be hidden!
- *
- * @param maxDistance the new maximum distance
- */
- void setMaxDistance(double maxDistance);
+ /**
+ * Sets the maximum distance of the camera to the position of the {@link Marker} for it to be displayed.
+ * If the camera is further to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @param maxDistance the new maximum distance
+ */
+ void setMaxDistance(double maxDistance);
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/ExtrudeMarker.java b/src/main/java/de/bluecolored/bluemap/api/marker/ExtrudeMarker.java
index 549fefb..549e5f6 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/ExtrudeMarker.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/ExtrudeMarker.java
@@ -28,95 +28,95 @@
public interface ExtrudeMarker extends ObjectMarker, DistanceRangedMarker {
- /**
- * Getter for {@link Shape} of this {@link ExtrudeMarker}.
- *
- * (The shape will be extruded from this value to {@link #getShapeMaxY()} on the map)
- * @return the min-height of the shape on the map
- */
- float getShapeMinY();
+ /**
+ * Getter for the minimum height (y-coordinate) of where the shape is displayed on the map.
+ * (The shape will be extruded from this value to {@link #getShapeMaxY()} on the map)
+ * @return the min-height of the shape on the map
+ */
+ float getShapeMinY();
- /**
- * Getter for the maximum height (y-coordinate) of where the shape is displayed on the map.
- * (The shape will be extruded from {@link #getShapeMinY()} to this value on the map)
- * @return the max-height of the shape on the map
- */
- float getShapeMaxY();
-
- /**
- * Sets the {@link Shape} of this {@link ExtrudeMarker}.
- * true
if the depthTest is enabled
- */
- boolean isDepthTestEnabled();
-
- /**
- * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
- * @param enabled if the depth-test should be enabled for this {@link ExtrudeMarker}
- */
- void setDepthTestEnabled(boolean enabled);
+ /**
+ * Sets the {@link Shape} of this {@link ExtrudeMarker}.
+ * true
if the depthTest is enabled
+ */
+ boolean isDepthTestEnabled();
- /**
- * Sets the width of the lines for this {@link ExtrudeMarker}.
- * @param width the new width in pixels
- */
- void setLineWidth(int width);
+ /**
+ * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
+ * @param enabled if the depth-test should be enabled for this {@link ExtrudeMarker}
+ */
+ void setDepthTestEnabled(boolean enabled);
- /**
- * Getter for the {@link Color} of the border-line of the shape.
- * @return the line-color
- */
- Color getLineColor();
+ /**
+ * Getter for the width of the lines of this {@link ExtrudeMarker}.
+ * @return the width of the lines in pixels
+ */
+ int getLineWidth();
- /**
- * Sets the {@link Color} of the border-line of the shape.
- * @param color the new line-color
- */
- void setLineColor(Color color);
+ /**
+ * Sets the width of the lines for this {@link ExtrudeMarker}.
+ * @param width the new width in pixels
+ */
+ void setLineWidth(int width);
+
+ /**
+ * Getter for the {@link Color} of the border-line of the shape.
+ * @return the line-color
+ */
+ Color getLineColor();
+
+ /**
+ * Sets the {@link Color} of the border-line of the shape.
+ * @param color the new line-color
+ */
+ void setLineColor(Color color);
+
+ /**
+ * Getter for the fill-{@link Color} of the shape.
+ * @return the fill-color
+ */
+ Color getFillColor();
+
+ /**
+ * Sets the fill-{@link Color} of the shape.
+ * @param color the new fill-color
+ */
+ void setFillColor(Color color);
+
+ /**
+ * Sets the border- and fill- color.
+ * @param lineColor the new border-color
+ * @param fillColor the new fill-color
+ * @see #setLineColor(Color)
+ * @see #setFillColor(Color)
+ */
+ default void setColors(Color lineColor, Color fillColor) {
+ setLineColor(lineColor);
+ setFillColor(fillColor);
+ }
- /**
- * Getter for the fill-{@link Color} of the shape.
- * @return the fill-color
- */
- Color getFillColor();
-
- /**
- * Sets the fill-{@link Color} of the shape.
- * @param color the new fill-color
- */
- void setFillColor(Color color);
-
- /**
- * Sets the border- and fill- color.
- * @param lineColor the new border-color
- * @param fillColor the new fill-color
- * @see #setLineColor(Color)
- * @see #setFillColor(Color)
- */
- default void setColors(Color lineColor, Color fillColor) {
- setLineColor(lineColor);
- setFillColor(fillColor);
- }
-
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/HtmlMarker.java b/src/main/java/de/bluecolored/bluemap/api/marker/HtmlMarker.java
index 11b7042..fb111d1 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/HtmlMarker.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/HtmlMarker.java
@@ -29,43 +29,43 @@
public interface HtmlMarker extends Marker, DistanceRangedMarker {
- /**
- * Getter for the position (in pixels) where the html-element is anchored to the map.
- * @return the anchor-position in pixels
- */
- Vector2i getAnchor();
+ /**
+ * Getter for the position (in pixels) where the html-element is anchored to the map.
+ * @return the anchor-position in pixels
+ */
+ Vector2i getAnchor();
- /**
- * Sets the position (in pixels) where the html-element is anchored to the map.
- * @param anchor the anchor-position in pixels
- */
- void setAnchor(Vector2i anchor);
+ /**
+ * Sets the position (in pixels) where the html-element is anchored to the map.
+ * @param anchor the anchor-position in pixels
+ */
+ void setAnchor(Vector2i anchor);
- /**
- * Sets the position (in pixels) where the html-element is anchored to the map.
- * @param x the anchor-x-position in pixels
- * @param y the anchor-y-position in pixels
- */
- default void setAnchor(int x, int y) {
- setAnchor(new Vector2i(x, y));
- }
+ /**
+ * Sets the position (in pixels) where the html-element is anchored to the map.
+ * @param x the anchor-x-position in pixels
+ * @param y the anchor-y-position in pixels
+ */
+ default void setAnchor(int x, int y) {
+ setAnchor(new Vector2i(x, y));
+ }
- /**
- * Getter for the html-code of this HTML marker
- * @return the html-code
- */
- String getHtml();
+ /**
+ * Getter for the html-code of this HTML marker
+ * @return the html-code
+ */
+ String getHtml();
+
+ /**
+ * Sets the html for this {@link HtmlMarker}.
+ *
+ *
+ * Make sure you escape all html-tags from possible user inputs to prevent possible XSS-Attacks on the web-client!
+ *
- * Make sure you escape all html-tags from possible user inputs to prevent possible XSS-Attacks on the web-client!
- *
+ * (A line is immutable once created)
+ * @return the points of this line
+ */
+ public Vector3d[] getPoints() {
+ return Arrays.copyOf(points, points.length);
+ }
+
+ /**
+ * Calculates and returns the minimum corner of the axis-aligned-bounding-box of this line.
+ * @return the min of the AABB of this line
+ */
+ public Vector3d getMin() {
+ if (this.min == null) {
+ Vector3d min = points[0];
+ for (int i = 1; i < points.length; i++) {
+ min = min.min(points[i]);
+ }
+ this.min = min;
+ }
+ return this.min;
+ }
+
+ /**
+ * Calculates and returns the maximum corner of the axis-aligned-bounding-box of this line.
+ * @return the max of the AABB of this line
+ */
+ public Vector3d getMax() {
+ if (this.max == null) {
+ Vector3d max = points[0];
+ for (int i = 1; i < points.length; i++) {
+ max = max.max(points[i]);
+ }
+ this.max = max;
+ }
+ return this.max;
+ }
- public Line(Vector3d... points) {
- if (points.length < 2) throw new IllegalArgumentException("A line has to have at least 2 points!");
- this.points = points;
- }
-
- /**
- * Getter for the amount of points in this line.
- * @return the amount of points
- */
- public int getPointCount() {
- return points.length;
- }
-
- public Vector3d getPoint(int i) {
- return points[i];
- }
-
- /**
- * Getter for a copy of the points array.
- * (A line is immutable once created)
- * @return the points of this line
- */
- public Vector3d[] getPoints() {
- return Arrays.copyOf(points, points.length);
- }
-
- /**
- * Calculates and returns the minimum corner of the axis-aligned-bounding-box of this line.
- * @return the min of the AABB of this line
- */
- public Vector3d getMin() {
- if (this.min == null) {
- Vector3d min = points[0];
- for (int i = 1; i < points.length; i++) {
- min = min.min(points[i]);
- }
- this.min = min;
- }
- return this.min;
- }
-
- /**
- * Calculates and returns the maximum corner of the axis-aligned-bounding-box of this line.
- * @return the max of the AABB of this line
- */
- public Vector3d getMax() {
- if (this.max == null) {
- Vector3d max = points[0];
- for (int i = 1; i < points.length; i++) {
- max = max.max(points[i]);
- }
- this.max = max;
- }
- return this.max;
- }
-
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/LineMarker.java b/src/main/java/de/bluecolored/bluemap/api/marker/LineMarker.java
index d25861d..e3a5cf3 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/LineMarker.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/LineMarker.java
@@ -28,52 +28,52 @@
public interface LineMarker extends ObjectMarker, DistanceRangedMarker {
- /**
- * Getter for {@link Line} of this {@link LineMarker}.
- * @return the {@link Line}
- */
- Line getLine();
-
- /**
- * Sets the {@link Line} of this {@link LineMarker}.
- * @param line the new {@link Line}
- */
- void setLine(Line line);
+ /**
+ * Getter for {@link Line} of this {@link LineMarker}.
+ * @return the {@link Line}
+ */
+ Line getLine();
- /**
- * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
- * @return true
if the depthTest is enabled
- */
- boolean isDepthTestEnabled();
-
- /**
- * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
- * @param enabled if the depth-test should be enabled for this {@link LineMarker}
- */
- void setDepthTestEnabled(boolean enabled);
+ /**
+ * Sets the {@link Line} of this {@link LineMarker}.
+ * @param line the new {@link Line}
+ */
+ void setLine(Line line);
- /**
- * Getter for the width of the lines of this {@link LineMarker}.
- * @return the width of the lines in pixels
- */
- int getLineWidth();
+ /**
+ * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
+ * @return true
if the depthTest is enabled
+ */
+ boolean isDepthTestEnabled();
- /**
- * Sets the width of the lines for this {@link LineMarker}.
- * @param width the new width in pixels
- */
- void setLineWidth(int width);
+ /**
+ * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
+ * @param enabled if the depth-test should be enabled for this {@link LineMarker}
+ */
+ void setDepthTestEnabled(boolean enabled);
- /**
- * Getter for the {@link Color} of the border-line of the shape.
- * @return the line-color
- */
- Color getLineColor();
+ /**
+ * Getter for the width of the lines of this {@link LineMarker}.
+ * @return the width of the lines in pixels
+ */
+ int getLineWidth();
+
+ /**
+ * Sets the width of the lines for this {@link LineMarker}.
+ * @param width the new width in pixels
+ */
+ void setLineWidth(int width);
+
+ /**
+ * Getter for the {@link Color} of the border-line of the shape.
+ * @return the line-color
+ */
+ Color getLineColor();
+
+ /**
+ * Sets the {@link Color} of the border-line of the shape.
+ * @param color the new line-color
+ */
+ void setLineColor(Color color);
- /**
- * Sets the {@link Color} of the border-line of the shape.
- * @param color the new line-color
- */
- void setLineColor(Color color);
-
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/LinkMarker.java b/src/main/java/de/bluecolored/bluemap/api/marker/LinkMarker.java
index eb8f653..9a6604e 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/LinkMarker.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/LinkMarker.java
@@ -28,33 +28,33 @@
public interface LinkMarker extends Marker {
- /**
- * Gets the link-address of this {@link Marker}.
- * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
- *
- * @return the {@link Optional} link
- */
- Optional
+ * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
+ *
+ * @return the {@link Optional} link
+ */
+ Optionaltrue
the link ({@link #getLink()}) will be opened in a new tab.
- * @return whether the link will be opened in a new tab
- * @see #getLink()
- */
- boolean isNewTab();
+ /**
+ * If this is true
the link ({@link #getLink()}) will be opened in a new tab.
+ * @return whether the link will be opened in a new tab
+ * @see #getLink()
+ */
+ boolean isNewTab();
- /**
- * Sets the link-address of this {@link Marker}.
- * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
- *
- * @param link the link, or null
to disable the link
- * @param newTab whether the link should be opened in a new tab
- */
- void setLink(String link, boolean newTab);
+ /**
+ * Sets the link-address of this {@link Marker}.
+ * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
+ *
+ * @param link the link, or null
to disable the link
+ * @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();
+ /**
+ * Removes the link of this {@link Marker}.
+ */
+ void removeLink();
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/Marker.java b/src/main/java/de/bluecolored/bluemap/api/marker/Marker.java
index 04fa0dd..6fb21a6 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/Marker.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/Marker.java
@@ -31,129 +31,129 @@
/**
* A marker that is displayed on one of the maps in the web-app.
- *
- * Html-tags in the label will not be escaped, so you can use them to style the {@link Marker}-labels.
- * Make sure you escape all html-tags from possible user inputs to prevent possible XSS-Attacks on the web-client!
- *
- * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
- *
- * @return the minimum distance for this {@link Marker} to be displayed
- * @deprecated Not all marker-types support this
- */
- double getMinDistance();
+ /**
+ * Getter for the {@link BlueMapMap} this {@link Marker} lives in.
+ * @return the {@link BlueMapMap} this {@link Marker} lives in
+ */
+ BlueMapMap getMap();
- /**
- * Sets the minimum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.
- * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
- *
- * @param minDistance the new minimum distance
- * @deprecated Not all marker-types support this
- */
- void setMinDistance(double minDistance);
+ /**
+ * Sets the {@link BlueMapMap} this {@link Marker} lives in
+ * @param map the new {@link BlueMapMap}
+ */
+ void setMap(BlueMapMap map);
- /**
- * Getter for the maximum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.
- * If the camera is further to this {@link Marker} than this distance, it will be hidden!
- *
- * @return the maximum distance for this {@link Marker} to be displayed
- * @deprecated Not all marker-types support this
- */
- double getMaxDistance();
+ /**
+ * Getter for the position of where this {@link Marker} lives on the map.
+ * @return the position of this {@link Marker}
+ */
+ Vector3d getPosition();
- /**
- * Sets the maximum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.
- * If the camera is further to this {@link Marker} than this distance, it will be hidden!
- *
- * @param maxDistance the new maximum distance
- * @deprecated Not all marker-types support this
- */
- void setMaxDistance(double maxDistance);
+ /**
+ * Sets the position of where this {@link Marker} lives on the map.
+ * @param position the new position
+ */
+ void setPosition(Vector3d position);
- /**
- * Gets the link-address of this {@link Marker}.
- * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
- *
- * @return the {@link Optional} link
- * @deprecated Not all marker-types support this
- */
- Optionaltrue
the link ({@link #getLink()}) will be opened in a new tab.
- * @return whether the link will be opened in a new tab
- * @see #getLink()
- * @deprecated Not all marker-types support this
- */
- boolean isNewTab();
-
- /**
- * Sets the link-address of this {@link Marker}.
- * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
- *
- * @param link the link, or null
to disable the link
- * @param newTab whether the link should be opened in a new tab
- * @deprecated Not all marker-types support this
- */
- void setLink(String link, boolean newTab);
+ /**
+ * Sets the label of this {@link Marker}.
+ *
+ * Html-tags in the label will not be escaped, so you can use them to style the {@link Marker}-labels.
+ * Make sure you escape all html-tags from possible user inputs to prevent possible XSS-Attacks on the web-client!
+ *
+ * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @return the minimum distance for this {@link Marker} to be displayed
+ * @deprecated Not all marker-types support this
+ */
+ double getMinDistance();
+
+ /**
+ * Sets the minimum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.
+ * If the camera is closer to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @param minDistance the new minimum distance
+ * @deprecated Not all marker-types support this
+ */
+ void setMinDistance(double minDistance);
+
+ /**
+ * Getter for the maximum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.
+ * If the camera is further to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @return the maximum distance for this {@link Marker} to be displayed
+ * @deprecated Not all marker-types support this
+ */
+ double getMaxDistance();
+
+ /**
+ * Sets the maximum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.
+ * If the camera is further to this {@link Marker} than this distance, it will be hidden!
+ *
+ * @param maxDistance the new maximum distance
+ * @deprecated Not all marker-types support this
+ */
+ void setMaxDistance(double maxDistance);
+
+ /**
+ * Gets the link-address of this {@link Marker}.
+ * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
+ *
+ * @return the {@link Optional} link
+ * @deprecated Not all marker-types support this
+ */
+ Optionaltrue
the link ({@link #getLink()}) will be opened in a new tab.
+ * @return whether the link will be opened in a new tab
+ * @see #getLink()
+ * @deprecated Not all marker-types support this
+ */
+ boolean isNewTab();
+
+ /**
+ * Sets the link-address of this {@link Marker}.
+ * If a link is present, this link will be followed when the user clicks on the marker in the web-app.
+ *
+ * @param link the link, or null
to disable the link
+ * @param newTab whether the link should be opened in a new tab
+ * @deprecated Not all marker-types support this
+ */
+ void setLink(String link, boolean newTab);
+
+ /**
+ * Removes the link of this {@link Marker}.
+ * @deprecated Not all marker-types support this
+ */
+ void removeLink();
- /**
- * Removes the link of this {@link Marker}.
- * @deprecated Not all marker-types support this
- */
- void removeLink();
-
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/MarkerAPI.java b/src/main/java/de/bluecolored/bluemap/api/marker/MarkerAPI.java
index 2119830..aef1f44 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/MarkerAPI.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/MarkerAPI.java
@@ -36,69 +36,69 @@
* Important:
* If you made changes to any {@link MarkerSet} or {@link Marker} including creations and deletions, you need to finally save your changes by calling {@link #save()}!
*
To avoid any concurrent modifications to the markers.json
, make sure your {@link MarkerAPI} is always loaded before making any changes, and saved right after the changes.
To avoid any concurrent modifications to the markers.json
, make sure your {@link MarkerAPI} is always loaded before making any changes, and saved right after the changes.
removeMarkerSet(markerSet.getId())
.
- *
- * @param markerSet the {@link MarkerSet} to be removed
- * @return true
if the {@link MarkerSet} was removed, false
if that {@link MarkerSet} didn't exist
- */
- default boolean removeMarkerSet(MarkerSet markerSet) {
- return removeMarkerSet(markerSet.getId());
- }
-
- /**
- * Removes the {@link MarkerSet} with the given id.
- *
- * @param id the id of the {@link MarkerSet} to be removed
- * @return true
if the {@link MarkerSet} was removed, false
if there was no {@link MarkerSet} with that id
- */
- boolean removeMarkerSet(String id);
-
- /**
- * Loads changes made by others, changes could be from other plugin's using the API or external changes to the markers.json
.markers.json
- */
- void load() throws IOException;
-
- /**
- * Saves all changes made with this instance to the markers.json
.markers.json
- */
- void save() throws IOException;
-
+ /**
+ * Getter for an unmodifiable {@link Collection} containing all {@link MarkerSet}s that are currently loaded with BlueMap.
+ *
+ * @return a {@link Collection} with all loaded {@link MarkerSet}s
+ */
+ CollectionremoveMarkerSet(markerSet.getId())
.
+ *
+ * @param markerSet the {@link MarkerSet} to be removed
+ * @return true
if the {@link MarkerSet} was removed, false
if that {@link MarkerSet} didn't exist
+ */
+ default boolean removeMarkerSet(MarkerSet markerSet) {
+ return removeMarkerSet(markerSet.getId());
+ }
+
+ /**
+ * Removes the {@link MarkerSet} with the given id.
+ *
+ * @param id the id of the {@link MarkerSet} to be removed
+ * @return true
if the {@link MarkerSet} was removed, false
if there was no {@link MarkerSet} with that id
+ */
+ boolean removeMarkerSet(String id);
+
+ /**
+ * Loads changes made by others, changes could be from other plugin's using the API or external changes to the markers.json
.markers.json
+ */
+ void load() throws IOException;
+
+ /**
+ * Saves all changes made with this instance to the markers.json
.markers.json
+ */
+ void save() throws IOException;
+
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/MarkerSet.java b/src/main/java/de/bluecolored/bluemap/api/marker/MarkerSet.java
index 5e08730..d20cfee 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/MarkerSet.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/MarkerSet.java
@@ -33,313 +33,313 @@
/**
* A set of {@link Marker}s that are displayed on the maps in the web-app.
- *
- * Each {@link MarkerSet} has an unique id.
+ * + *Each {@link MarkerSet} has an unique id.
*/ public interface MarkerSet { - /** - * Getter for the id of this {@link MarkerSet}. - * @return the id of this {@link MarkerSet} - */ - String getId(); - - /** - * Getter for the label of this {@link MarkerSet}. - *The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})
- * @return the label of this {@link MarkerSet} - */ - String getLabel(); - - /** - * Sets the label of this {@link MarkerSet}. - *The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})
- * @param label the new label - */ - void setLabel(String label); - - /** - * Checks if the {@link MarkerSet} is toggleable. - *If this is true
, the web-app will display a toggle-button for this {@link MarkerSet} so the user can choose to enable/disable all markers of this set.
If this is true
, the web-app will display a toggle-button for this {@link MarkerSet} so the user can choose to enable/disable all markers of this set.
The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})
+ * @return the label of this {@link MarkerSet} + */ + String getLabel(); - /** - * Checks if this {@link MarkerSet} is hidden by default. - *This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is true
the markers of this marker set will initially be hidden and can be displayed using the toggle-button.
This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is true
the markers of this marker set will initially be hidden and can be displayed using the toggle-button.
The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})
+ * @param label the new label + */ + void setLabel(String label); - /** - * Creates a {@link POIMarker} with the given id and adds it to this {@link MarkerSet}.If this is true
, the web-app will display a toggle-button for this {@link MarkerSet} so the user can choose to enable/disable all markers of this set.
If this is true
, the web-app will display a toggle-button for this {@link MarkerSet} so the user can choose to enable/disable all markers of this set.
This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is true
the markers of this marker set will initially be hidden and can be displayed using the toggle-button.
This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is true
the markers of this marker set will initially be hidden and can be displayed using the toggle-button.
(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
- * - * @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 y the height (y-position on the map) 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, float y); - - /** - * Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
- * - * @param id the id of the new marker - * @param map the {@link BlueMapMap} of the new marker - * @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 y the height (y-position on the map) 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, float y) { - return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape, y); - } - - /** - * Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.(The position of the marker will be the center of the shape (it's bounding box))
- * - * @param id the id of the new marker - * @param map the {@link BlueMapMap} of the new marker - * @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)}) - * @param y 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, Shape shape, float y) { - Vector2d center = shape.getMin().add(shape.getMax()).div(2); - return createShapeMarker(id, map, new Vector3d(center.getX(), y, center.getY()), shape, y); - } + /** + * Creates a {@link HtmlMarker} with the given id and adds it to this {@link MarkerSet}.(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
- * - * @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 {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @param minY the min-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @param maxY the max-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @return the created {@link ExtrudeMarker} - */ - ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, Vector3d position, Shape shape, float minY, float maxY); + /** + * Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
+ * + * @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 y the height (y-position on the map) 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, float y); - /** - * Creates a {@link ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
- * - * @param id the id of the new marker - * @param map the {@link BlueMapMap} of the new marker - * @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 {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @param minY the min-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @param maxY the max-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @return the created {@link ExtrudeMarker} - */ - default ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape, float minY, float maxY) { - return createExtrudeMarker(id, map, new Vector3d(posX, posY, posZ), shape, minY, maxY); - } + /** + * Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
+ * + * @param id the id of the new marker + * @param map the {@link BlueMapMap} of the new marker + * @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 y the height (y-position on the map) 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, float y) { + return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape, y); + } - /** - * Creates a {@link ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.(The position of the marker will be the center of the shape (it's bounding box))
- * - * @param id the id of the new marker - * @param map the {@link BlueMapMap} of the new marker - * @param shape the {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @param minY the min-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @param maxY the max-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) - * @return the created {@link ExtrudeMarker} - */ - default ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, Shape shape, float minY, float maxY) { - Vector2d center = shape.getMin().add(shape.getMax()).div(2f); - float y = (minY + maxY)/2f; - return createExtrudeMarker(id, map, new Vector3d(center.getX(), y, center.getY()), shape, minY, maxY); - } + /** + * Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.(The position of the marker will be the center of the shape (it's bounding box))
+ * + * @param id the id of the new marker + * @param map the {@link BlueMapMap} of the new marker + * @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)}) + * @param y 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, Shape shape, float y) { + Vector2d center = shape.getMin().add(shape.getMax()).div(2); + return createShapeMarker(id, map, new Vector3d(center.getX(), y, center.getY()), shape, y); + } - /** - * Creates a {@link LineMarker} with the given id and adds it to this {@link MarkerSet}.(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)
- * - * @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 line the {@link Line} of the marker (See: {@link LineMarker#setLine(Line)}) - * @return the created {@link LineMarker} - */ - LineMarker createLineMarker(String id, BlueMapMap map, Vector3d position, Line line); + /** + * Creates a {@link ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
+ * + * @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 {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @param minY the min-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @param maxY the max-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @return the created {@link ExtrudeMarker} + */ + ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, Vector3d position, Shape shape, float minY, float maxY); - /** - * Creates a {@link LineMarker} with the given id and adds it to this {@link MarkerSet}.(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)
- * - * @param id the id of the new marker - * @param map the {@link BlueMapMap} of the new marker - * @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 line the {@link Line} of the marker (See: {@link LineMarker#setLine(Line)}) - * @return the created {@link LineMarker} - */ - default LineMarker createLineMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Line line) { - return createLineMarker(id, map, new Vector3d(posX, posY, posZ), line); - } + /** + * Creates a {@link ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)
+ * + * @param id the id of the new marker + * @param map the {@link BlueMapMap} of the new marker + * @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 {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @param minY the min-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @param maxY the max-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @return the created {@link ExtrudeMarker} + */ + default ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape, float minY, float maxY) { + return createExtrudeMarker(id, map, new Vector3d(posX, posY, posZ), shape, minY, maxY); + } + + /** + * Creates a {@link ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.(The position of the marker will be the center of the shape (it's bounding box))
+ * + * @param id the id of the new marker + * @param map the {@link BlueMapMap} of the new marker + * @param shape the {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @param minY the min-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @param maxY the max-height (y-position on the map) of the shape of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)}) + * @return the created {@link ExtrudeMarker} + */ + default ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, Shape shape, float minY, float maxY) { + Vector2d center = shape.getMin().add(shape.getMax()).div(2f); + float y = (minY + maxY)/2f; + return createExtrudeMarker(id, map, new Vector3d(center.getX(), y, center.getY()), shape, minY, maxY); + } + + /** + * Creates a {@link LineMarker} with the given id and adds it to this {@link MarkerSet}.(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)
+ * + * @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 line the {@link Line} of the marker (See: {@link LineMarker#setLine(Line)}) + * @return the created {@link LineMarker} + */ + LineMarker createLineMarker(String id, BlueMapMap map, Vector3d position, Line line); + + /** + * Creates a {@link LineMarker} with the given id and adds it to this {@link MarkerSet}.(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)
+ * + * @param id the id of the new marker + * @param map the {@link BlueMapMap} of the new marker + * @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 line the {@link Line} of the marker (See: {@link LineMarker#setLine(Line)}) + * @return the created {@link LineMarker} + */ + default LineMarker createLineMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Line line) { + return createLineMarker(id, map, new Vector3d(posX, posY, posZ), line); + } + + /** + * Creates a {@link LineMarker} with the given id and adds it to this {@link MarkerSet}.(The position of the marker will be the center of the line (it's bounding box))
+ * + * @param id the id of the new marker + * @param map the {@link BlueMapMap} of the new marker + * @param line the {@link Line} of the marker (See: {@link LineMarker#setLine(Line)}) + * @return the created {@link LineMarker} + */ + default LineMarker createLineMarker(String id, BlueMapMap map, Line line) { + Vector3d center = line.getMin().add(line.getMax()).div(2f); + return createLineMarker(id, map, center, line); + } + + /** + * Removes the given Marker from this {@link MarkerSet}.removeMarker(marker.getId())
.
+ *
+ * @param marker the {@link Marker} to be removed
+ * @return true
if the {@link Marker} was removed, false
if that {@link Marker} didn't exist
+ */
+ default boolean removeMarker(Marker marker) {
+ return removeMarker(marker.getId());
+ }
+
+ /**
+ * Removes the {@link Marker} with the given id.
+ *
+ * @param id the id of the {@link Marker} to be removed
+ * @return true
if the {@link Marker} was removed, false
if there was no {@link Marker} with that id
+ */
+ boolean removeMarker(String id);
- /**
- * Creates a {@link LineMarker} with the given id and adds it to this {@link MarkerSet}.(The position of the marker will be the center of the line (it's bounding box))
- * - * @param id the id of the new marker - * @param map the {@link BlueMapMap} of the new marker - * @param line the {@link Line} of the marker (See: {@link LineMarker#setLine(Line)}) - * @return the created {@link LineMarker} - */ - default LineMarker createLineMarker(String id, BlueMapMap map, Line line) { - Vector3d center = line.getMin().add(line.getMax()).div(2f); - return createLineMarker(id, map, center, line); - } - - /** - * Removes the given Marker from this {@link MarkerSet}.removeMarker(marker.getId())
.
- *
- * @param marker the {@link Marker} to be removed
- * @return true
if the {@link Marker} was removed, false
if that {@link Marker} didn't exist
- */
- default boolean removeMarker(Marker marker) {
- return removeMarker(marker.getId());
- }
-
- /**
- * Removes the {@link Marker} with the given id.
- *
- * @param id the id of the {@link Marker} to be removed
- * @return true
if the {@link Marker} was removed, false
if there was no {@link Marker} with that id
- */
- boolean removeMarker(String id);
-
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/marker/ObjectMarker.java b/src/main/java/de/bluecolored/bluemap/api/marker/ObjectMarker.java
index c2da249..c58cba3 100644
--- a/src/main/java/de/bluecolored/bluemap/api/marker/ObjectMarker.java
+++ b/src/main/java/de/bluecolored/bluemap/api/marker/ObjectMarker.java
@@ -26,23 +26,23 @@
public interface ObjectMarker extends Marker, LinkMarker {
- /**
- * Getter for the detail of this marker. The label can include html-tags.
- * @return the detail of this {@link ObjectMarker}
- */
- String getDetail();
+ /**
+ * Getter for the detail of this marker. The label can include html-tags.
+ * @return the detail of this {@link ObjectMarker}
+ */
+ String getDetail();
- /**
- * Sets the detail of this {@link ObjectMarker}. The detail can include html-tags.
- * Important:
- * Html-tags in the label will not be escaped, so you can use them to style the {@link ObjectMarker}-detail.
- * Make sure you escape all html-tags from possible user inputs to prevent possible XSS-Attacks on the web-client!
- *
+ * Important:
+ * Html-tags in the label will not be escaped, so you can use them to style the {@link ObjectMarker}-detail.
+ * Make sure you escape all html-tags from possible user inputs to prevent possible XSS-Attacks on the web-client!
+ *
The shape is placed on the xz-plane of the map, so the y-coordinates of the {@link Shape}'s points are the z-coordinates in the map.
- * @return the {@link Shape} - */ - Shape getShape(); - - /** - * Getter for the height (y-coordinate) of where the shape is displayed on the map. - * @return the height of the shape on the map - * @deprecated Use {@link #getShapeY()} instead - */ - default float getHeight() { - return getShapeY(); - } + /** + * Getter for {@link Shape} of this {@link ShapeMarker}. + *The shape is placed on the xz-plane of the map, so the y-coordinates of the {@link Shape}'s points are the z-coordinates in the map.
+ * @return the {@link Shape} + */ + Shape getShape(); - /** - * Getter for the height (y-coordinate) of where the shape is displayed on the map. - * @return the height of the shape on the map - */ - float getShapeY(); - - /** - * Sets the {@link Shape} of this {@link ShapeMarker}. - *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.
- * @param shape the new {@link Shape} - * @param y the new height (y-coordinate) of the shape on the map - */ - void setShape(Shape shape, float y); + /** + * Getter for the height (y-coordinate) of where the shape is displayed on the map. + * @return the height of the shape on the map + * @deprecated Use {@link #getShapeY()} instead + */ + default float getHeight() { + return getShapeY(); + } - /** - * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything. - * @returntrue
if the depthTest is enabled
- */
- boolean isDepthTestEnabled();
-
- /**
- * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
- * @param enabled if the depth-test should be enabled for this {@link ShapeMarker}
- */
- void setDepthTestEnabled(boolean enabled);
+ /**
+ * Getter for the height (y-coordinate) of where the shape is displayed on the map.
+ * @return the height of the shape on the map
+ */
+ float getShapeY();
- /**
- * Getter for the width of the border-line of this {@link ShapeMarker}.
- * @return the width of the line in pixels
- */
- int getLineWidth();
+ /**
+ * Sets the {@link Shape} of this {@link ShapeMarker}.
+ * 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.
+ * @param shape the new {@link Shape} + * @param y the new height (y-coordinate) of the shape on the map + */ + void setShape(Shape shape, float y); - /** - * Sets the width of the border-line for this {@link ShapeMarker}. - * @param width the new width in pixels - */ - void setLineWidth(int width); + /** + * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything. + * @returntrue
if the depthTest is enabled
+ */
+ boolean isDepthTestEnabled();
- /**
- * Getter for the {@link Color} of the border of the shape.
- * @return the border-color
- * @deprecated Use {@link #getLineColor()} instead
- */
- default Color getBorderColor() {
- return getLineColor();
- }
-
- /**
- * Sets the {@link Color} of the border of the shape.
- * @param color the new border-color
- * @deprecated Use {@link #setLineColor(Color)} instead
- */
- default void setBorderColor(Color color){
- setLineColor(color);
- }
+ /**
+ * If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the marker when it is not behind anything.
+ * @param enabled if the depth-test should be enabled for this {@link ShapeMarker}
+ */
+ void setDepthTestEnabled(boolean enabled);
- /**
- * Getter for the {@link Color} of the border-line of the shape.
- * @return the line-color
- */
- Color getLineColor();
+ /**
+ * Getter for the width of the border-line of this {@link ShapeMarker}.
+ * @return the width of the line in pixels
+ */
+ int getLineWidth();
- /**
- * Sets the {@link Color} of the border-line of the shape.
- * @param color the new line-color
- */
- void setLineColor(Color color);
+ /**
+ * Sets the width of the border-line for this {@link ShapeMarker}.
+ * @param width the new width in pixels
+ */
+ void setLineWidth(int width);
+
+ /**
+ * Getter for the {@link Color} of the border of the shape.
+ * @return the border-color
+ * @deprecated Use {@link #getLineColor()} instead
+ */
+ default Color getBorderColor() {
+ return getLineColor();
+ }
+
+ /**
+ * Sets the {@link Color} of the border of the shape.
+ * @param color the new border-color
+ * @deprecated Use {@link #setLineColor(Color)} instead
+ */
+ default void setBorderColor(Color color){
+ setLineColor(color);
+ }
+
+ /**
+ * Getter for the {@link Color} of the border-line of the shape.
+ * @return the line-color
+ */
+ Color getLineColor();
+
+ /**
+ * Sets the {@link Color} of the border-line of the shape.
+ * @param color the new line-color
+ */
+ void setLineColor(Color color);
+
+ /**
+ * Getter for the fill-{@link Color} of the shape.
+ * @return the fill-color
+ */
+ Color getFillColor();
+
+ /**
+ * Sets the fill-{@link Color} of the shape.
+ * @param color the new fill-color
+ */
+ void setFillColor(Color color);
+
+ /**
+ * Sets the border- and fill- color.
+ * @param lineColor the new border-color
+ * @param fillColor the new fill-color
+ * @see #setLineColor(Color)
+ * @see #setFillColor(Color)
+ */
+ default void setColors(Color lineColor, Color fillColor) {
+ setLineColor(lineColor);
+ setFillColor(fillColor);
+ }
- /**
- * Getter for the fill-{@link Color} of the shape.
- * @return the fill-color
- */
- Color getFillColor();
-
- /**
- * Sets the fill-{@link Color} of the shape.
- * @param color the new fill-color
- */
- void setFillColor(Color color);
-
- /**
- * Sets the border- and fill- color.
- * @param lineColor the new border-color
- * @param fillColor the new fill-color
- * @see #setLineColor(Color)
- * @see #setFillColor(Color)
- */
- default void setColors(Color lineColor, Color fillColor) {
- setLineColor(lineColor);
- setFillColor(fillColor);
- }
-
}
diff --git a/src/main/java/de/bluecolored/bluemap/api/renderer/RenderAPI.java b/src/main/java/de/bluecolored/bluemap/api/renderer/RenderAPI.java
index e860cc3..060b9b1 100644
--- a/src/main/java/de/bluecolored/bluemap/api/renderer/RenderAPI.java
+++ b/src/main/java/de/bluecolored/bluemap/api/renderer/RenderAPI.java
@@ -38,140 +38,140 @@
*/
public interface RenderAPI {
- /**
- * Schedules the render of the map-tile at this block position for all maps of this world.true
if this renderer is running
- */
- boolean isRunning();
-
- /**
- * Starts the renderer if it is not already running.
- */
- void start();
+ /**
+ * Schedules a task to purge the given map.
+ * An update-task will be scheduled right after the purge, to get the map up-to-date again.
+ * @param map the map to be purged
+ * @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
+ * @throws IOException if an IOException occurs while trying to create the task.
+ */
+ boolean scheduleMapPurgeTask(BlueMapMap map) throws IOException;
+
+ /**
+ * Getter for the current size of the render-queue.
+ * @return the current size of the render-queue
+ */
+ int renderQueueSize();
+
+ /**
+ * Getter for the count of render threads.
+ * @return the count of render threads
+ */
+ int renderThreadCount();
+
+ /**
+ * Whether this {@link RenderAPI} is currently running or paused.
+ * @return true
if this renderer is running
+ */
+ boolean isRunning();
+
+ /**
+ * Starts the renderer if it is not already running.
+ */
+ void start();
+
+ /**
+ * Pauses the renderer if it currently is running.
+ */
+ void pause();
- /**
- * Pauses the renderer if it currently is running.
- */
- void pause();
-
}