mirror of
https://github.com/BlueMap-Minecraft/BlueMapAPI.git
synced 2025-01-05 23:58:38 +01:00
Apply spotless fixes
This commit is contained in:
parent
adcce9769e
commit
3bed723f27
@ -38,251 +38,251 @@
|
||||
|
||||
/**
|
||||
* An API to control the running instance of BlueMap.
|
||||
* <p>This API is thread-save, so you <b>can</b> use it async, off the main-server-thread, to save performance!</p>
|
||||
* <p>This API is thread-save, so you <b>can</b> use it async, off the main-server-thread, to save performance!</p>
|
||||
*/
|
||||
public abstract class BlueMapAPI {
|
||||
private static BlueMapAPI instance;
|
||||
private static BlueMapAPI instance;
|
||||
|
||||
@Deprecated
|
||||
private static final Collection<BlueMapAPIListener> listener = new HashSet<>(2);
|
||||
|
||||
private static final Collection<Consumer<BlueMapAPI>> onEnableConsumers = new HashSet<>(2);
|
||||
private static final Collection<Consumer<BlueMapAPI>> onDisableConsumers = new HashSet<>(2);
|
||||
@Deprecated
|
||||
private static final Collection<BlueMapAPIListener> listener = new HashSet<>(2);
|
||||
|
||||
/**
|
||||
* Getter for the {@link RenderAPI}.
|
||||
* @return the {@link RenderAPI}
|
||||
*/
|
||||
public abstract RenderAPI getRenderAPI();
|
||||
|
||||
/**
|
||||
* Getter for the {@link MarkerAPI}.<br>
|
||||
* 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 Collection<BlueMapMap> getMaps();
|
||||
|
||||
/**
|
||||
* Getter for all {@link BlueMapWorld}s loaded by BlueMap.
|
||||
* @return an unmodifiable collection of all loaded {@link BlueMapWorld}s
|
||||
*/
|
||||
public abstract Collection<BlueMapWorld> getWorlds();
|
||||
|
||||
/**
|
||||
* Getter for a {@link BlueMapWorld} loaded by BlueMap with the given {@link UUID}.
|
||||
*
|
||||
* <p><i>See the documentation of {@link BlueMapWorld#getUuid()} for more information about the nature of the worlds {@link UUID}s!</i></p>
|
||||
*
|
||||
* @see BlueMapWorld#getUuid()
|
||||
*
|
||||
* @param uuid the {@link UUID} of the world
|
||||
*
|
||||
* @return an {@link Optional} with the {@link BlueMapWorld} if it exists
|
||||
*/
|
||||
public abstract Optional<BlueMapWorld> getWorld(UUID uuid);
|
||||
|
||||
/**
|
||||
* 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 Optional<BlueMapMap> getMap(String id);
|
||||
|
||||
/**
|
||||
* Creates an image-file with the given {@link BufferedImage} somewhere in the web-root, so it can be used in the web-app (e.g. for {@link Marker}-icons).
|
||||
*
|
||||
* <p>The given <code>path</code> is used as file-name and (separated with '/') optional folders to organize the image-files. Do NOT include the file-ending! (e.g. <code>"someFolder/somePOIIcon"</code> will result in a file "somePOIIcon.png" in a folder "someFolder").</p>
|
||||
* <p>If the image file with the given path already exists, it will be replaced.</p>
|
||||
*
|
||||
* @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,
|
||||
* which can be used as it is e.g. in the {@link de.bluecolored.bluemap.api.marker.POIMarker#setIcon(String, Vector2i)} method
|
||||
* @throws IOException If an {@link IOException} is thrown while writing the image
|
||||
*/
|
||||
public abstract String createImage(BufferedImage image, String path) throws IOException;
|
||||
private static final Collection<Consumer<BlueMapAPI>> onEnableConsumers = new HashSet<>(2);
|
||||
private static final Collection<Consumer<BlueMapAPI>> onDisableConsumers = new HashSet<>(2);
|
||||
|
||||
/**
|
||||
* 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:
|
||||
* <ul>
|
||||
* <li>the <b>key</b> is the image path how it would be used in the "path" parameter of the {@link #createImage(BufferedImage, String)} method</li>
|
||||
* <li>and the <b>value</b> is the relative address of the image. The same ones that are returned from the {@link #createImage(BufferedImage, String)} method</li>
|
||||
* </ul>
|
||||
* @throws IOException If an {@link IOException} is thrown while reading the images
|
||||
*/
|
||||
public abstract Map<String, String> availableImages() throws IOException;
|
||||
/**
|
||||
* Getter for the {@link RenderAPI}.
|
||||
* @return the {@link RenderAPI}
|
||||
*/
|
||||
public abstract RenderAPI getRenderAPI();
|
||||
|
||||
/**
|
||||
* Getter for the configured web-root folder
|
||||
* @return The {@link Path} of the web-root folder
|
||||
*/
|
||||
public abstract Path getWebRoot();
|
||||
/**
|
||||
* Getter for the {@link MarkerAPI}.<br>
|
||||
* 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 <code>true</code> 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<BlueMapAPI> getInstance() {
|
||||
return Optional.ofNullable(instance);
|
||||
}
|
||||
/**
|
||||
* Getter for all {@link BlueMapMap}s loaded by BlueMap.
|
||||
* @return an unmodifiable collection of all loaded {@link BlueMapMap}s
|
||||
*/
|
||||
public abstract Collection<BlueMapMap> getMaps();
|
||||
|
||||
/**
|
||||
* Registers a {@link Consumer} that will be called every time BlueMap has just been loaded and started and the API is ready to use.<br>
|
||||
* If {@link BlueMapAPI} is already enabled when this listener is registered the consumer will be called immediately <i>(once, on the same thread)</i>!
|
||||
* <p><b>The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded!</b></p>
|
||||
* <p><i>(Note: The consumer will likely be called asynchronously, <b>not</b> on the server-thread!)</i></p>
|
||||
* <p>Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}.</p>
|
||||
* @param consumer the {@link Consumer}
|
||||
*/
|
||||
public static synchronized void onEnable(Consumer<BlueMapAPI> consumer) {
|
||||
onEnableConsumers.add(consumer);
|
||||
if (BlueMapAPI.instance != null) consumer.accept(BlueMapAPI.instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a {@link Consumer} that will be called every time <b>before</b> BlueMap is being unloaded and stopped, after the consumer returns the API is no longer usable!<br>
|
||||
* Unlike with {@link BlueMapAPI#onEnable(Consumer)}, if {@link BlueMapAPI} is not enabled when this listener is registered the consumer will <b>not</b> be called.
|
||||
* <p><b>The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded!</b></p>
|
||||
* <p><i>(Note: The consumer will likely be called asynchronously, <b>not</b> on the server-thread!)</i></p>
|
||||
* <p>Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}.</p>
|
||||
* @param consumer the {@link Consumer}
|
||||
*/
|
||||
public static synchronized void onDisable(Consumer<BlueMapAPI> consumer) {
|
||||
onDisableConsumers.add(consumer);
|
||||
}
|
||||
/**
|
||||
* Getter for all {@link BlueMapWorld}s loaded by BlueMap.
|
||||
* @return an unmodifiable collection of all loaded {@link BlueMapWorld}s
|
||||
*/
|
||||
public abstract Collection<BlueMapWorld> getWorlds();
|
||||
|
||||
/**
|
||||
* Removes a {@link Consumer} that has been registered using {@link #onEnable(Consumer)} or {@link #onDisable(Consumer)}.
|
||||
* @param consumer the {@link Consumer} instance that has been registered previously
|
||||
* @return <code>true</code> if a listener was removed as a result of this call
|
||||
*/
|
||||
public static synchronized boolean unregisterListener(Consumer<BlueMapAPI> consumer) {
|
||||
return onEnableConsumers.remove(consumer) | onDisableConsumers.remove(consumer);
|
||||
}
|
||||
/**
|
||||
* Getter for a {@link BlueMapWorld} loaded by BlueMap with the given {@link UUID}.
|
||||
*
|
||||
* <p><i>See the documentation of {@link BlueMapWorld#getUuid()} for more information about the nature of the worlds {@link UUID}s!</i></p>
|
||||
*
|
||||
* @see BlueMapWorld#getUuid()
|
||||
*
|
||||
* @param uuid the {@link UUID} of the world
|
||||
*
|
||||
* @return an {@link Optional} with the {@link BlueMapWorld} if it exists
|
||||
*/
|
||||
public abstract Optional<BlueMapWorld> getWorld(UUID uuid);
|
||||
|
||||
/**
|
||||
* Used by BlueMap to register the API and call the listeners properly.
|
||||
* @param instance the {@link BlueMapAPI}-instance
|
||||
* @return <code>true</code> if the instance has been registered, <code>false</code> 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 Optional<BlueMapMap> getMap(String id);
|
||||
|
||||
List<Throwable> thrownExceptions = new ArrayList<>(0);
|
||||
|
||||
for (Consumer<BlueMapAPI> listener : BlueMapAPI.onEnableConsumers) {
|
||||
try {
|
||||
listener.accept(BlueMapAPI.instance);
|
||||
} catch (Throwable ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// backwards compatibility
|
||||
for (BlueMapAPIListener listener : BlueMapAPI.listener) {
|
||||
try {
|
||||
listener.onEnable(BlueMapAPI.instance);
|
||||
} catch (Throwable ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (!thrownExceptions.isEmpty()) {
|
||||
ExecutionException ex = new ExecutionException(thrownExceptions.get(0));
|
||||
for (int i = 1; i < thrownExceptions.size(); i++) {
|
||||
ex.addSuppressed(thrownExceptions.get(i));
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
/**
|
||||
* Creates an image-file with the given {@link BufferedImage} somewhere in the web-root, so it can be used in the web-app (e.g. for {@link Marker}-icons).
|
||||
*
|
||||
* <p>The given <code>path</code> is used as file-name and (separated with '/') optional folders to organize the image-files. Do NOT include the file-ending! (e.g. <code>"someFolder/somePOIIcon"</code> will result in a file "somePOIIcon.png" in a folder "someFolder").</p>
|
||||
* <p>If the image file with the given path already exists, it will be replaced.</p>
|
||||
*
|
||||
* @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,
|
||||
* which can be used as it is e.g. in the {@link de.bluecolored.bluemap.api.marker.POIMarker#setIcon(String, Vector2i)} method
|
||||
* @throws IOException If an {@link IOException} is thrown while writing the image
|
||||
*/
|
||||
public abstract String createImage(BufferedImage image, String path) throws IOException;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by BlueMap to unregister the API and call the listeners properly.
|
||||
* @param instance the {@link BlueMapAPI} instance
|
||||
* @return <code>true</code> if the instance was unregistered, <code>false</code> 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:
|
||||
* <ul>
|
||||
* <li>the <b>key</b> is the image path how it would be used in the "path" parameter of the {@link #createImage(BufferedImage, String)} method</li>
|
||||
* <li>and the <b>value</b> is the relative address of the image. The same ones that are returned from the {@link #createImage(BufferedImage, String)} method</li>
|
||||
* </ul>
|
||||
* @throws IOException If an {@link IOException} is thrown while reading the images
|
||||
*/
|
||||
public abstract Map<String, String> availableImages() throws IOException;
|
||||
|
||||
List<Exception> thrownExceptions = new ArrayList<>(0);
|
||||
|
||||
for (Consumer<BlueMapAPI> listener : BlueMapAPI.onDisableConsumers) {
|
||||
try {
|
||||
listener.accept(BlueMapAPI.instance);
|
||||
} catch (Exception ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Getter for the configured web-root folder
|
||||
* @return The {@link Path} of the web-root folder
|
||||
*/
|
||||
public abstract Path getWebRoot();
|
||||
|
||||
// backwards compatibility
|
||||
for (BlueMapAPIListener listener : BlueMapAPI.listener) {
|
||||
try {
|
||||
listener.onDisable(BlueMapAPI.instance);
|
||||
} catch (Exception ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
BlueMapAPI.instance = null;
|
||||
/**
|
||||
* Getter for the installed BlueMap version
|
||||
* @return the version-string
|
||||
*/
|
||||
public abstract String getBlueMapVersion();
|
||||
|
||||
if (!thrownExceptions.isEmpty()) {
|
||||
ExecutionException ex = new ExecutionException(thrownExceptions.get(0));
|
||||
for (int i = 1; i < thrownExceptions.size(); i++) {
|
||||
ex.addSuppressed(thrownExceptions.get(i));
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 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 <code>true</code> 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<BlueMapAPI> getInstance() {
|
||||
return Optional.ofNullable(instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a {@link Consumer} that will be called every time BlueMap has just been loaded and started and the API is ready to use.<br>
|
||||
* If {@link BlueMapAPI} is already enabled when this listener is registered the consumer will be called immediately <i>(once, on the same thread)</i>!
|
||||
* <p><b>The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded!</b></p>
|
||||
* <p><i>(Note: The consumer will likely be called asynchronously, <b>not</b> on the server-thread!)</i></p>
|
||||
* <p>Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}.</p>
|
||||
* @param consumer the {@link Consumer}
|
||||
*/
|
||||
public static synchronized void onEnable(Consumer<BlueMapAPI> consumer) {
|
||||
onEnableConsumers.add(consumer);
|
||||
if (BlueMapAPI.instance != null) consumer.accept(BlueMapAPI.instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a {@link Consumer} that will be called every time <b>before</b> BlueMap is being unloaded and stopped, after the consumer returns the API is no longer usable!<br>
|
||||
* Unlike with {@link BlueMapAPI#onEnable(Consumer)}, if {@link BlueMapAPI} is not enabled when this listener is registered the consumer will <b>not</b> be called.
|
||||
* <p><b>The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded!</b></p>
|
||||
* <p><i>(Note: The consumer will likely be called asynchronously, <b>not</b> on the server-thread!)</i></p>
|
||||
* <p>Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}.</p>
|
||||
* @param consumer the {@link Consumer}
|
||||
*/
|
||||
public static synchronized void onDisable(Consumer<BlueMapAPI> consumer) {
|
||||
onDisableConsumers.add(consumer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a {@link Consumer} that has been registered using {@link #onEnable(Consumer)} or {@link #onDisable(Consumer)}.
|
||||
* @param consumer the {@link Consumer} instance that has been registered previously
|
||||
* @return <code>true</code> if a listener was removed as a result of this call
|
||||
*/
|
||||
public static synchronized boolean unregisterListener(Consumer<BlueMapAPI> consumer) {
|
||||
return onEnableConsumers.remove(consumer) | onDisableConsumers.remove(consumer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by BlueMap to register the API and call the listeners properly.
|
||||
* @param instance the {@link BlueMapAPI}-instance
|
||||
* @return <code>true</code> if the instance has been registered, <code>false</code> 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;
|
||||
|
||||
List<Throwable> thrownExceptions = new ArrayList<>(0);
|
||||
|
||||
for (Consumer<BlueMapAPI> listener : BlueMapAPI.onEnableConsumers) {
|
||||
try {
|
||||
listener.accept(BlueMapAPI.instance);
|
||||
} catch (Throwable ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// backwards compatibility
|
||||
for (BlueMapAPIListener listener : BlueMapAPI.listener) {
|
||||
try {
|
||||
listener.onEnable(BlueMapAPI.instance);
|
||||
} catch (Throwable ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (!thrownExceptions.isEmpty()) {
|
||||
ExecutionException ex = new ExecutionException(thrownExceptions.get(0));
|
||||
for (int i = 1; i < thrownExceptions.size(); i++) {
|
||||
ex.addSuppressed(thrownExceptions.get(i));
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by BlueMap to unregister the API and call the listeners properly.
|
||||
* @param instance the {@link BlueMapAPI} instance
|
||||
* @return <code>true</code> if the instance was unregistered, <code>false</code> 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<Exception> thrownExceptions = new ArrayList<>(0);
|
||||
|
||||
for (Consumer<BlueMapAPI> listener : BlueMapAPI.onDisableConsumers) {
|
||||
try {
|
||||
listener.accept(BlueMapAPI.instance);
|
||||
} catch (Exception ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// backwards compatibility
|
||||
for (BlueMapAPIListener listener : BlueMapAPI.listener) {
|
||||
try {
|
||||
listener.onDisable(BlueMapAPI.instance);
|
||||
} catch (Exception ex) {
|
||||
thrownExceptions.add(ex);
|
||||
}
|
||||
}
|
||||
|
||||
BlueMapAPI.instance = null;
|
||||
|
||||
if (!thrownExceptions.isEmpty()) {
|
||||
ExecutionException ex = new ExecutionException(thrownExceptions.get(0));
|
||||
for (int i = 1; i < thrownExceptions.size(); i++) {
|
||||
ex.addSuppressed(thrownExceptions.get(i));
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -33,20 +33,20 @@
|
||||
@Deprecated
|
||||
public interface BlueMapAPIListener {
|
||||
|
||||
/**
|
||||
* Called when BlueMap has been loaded and started and the API is ready to use.<br>
|
||||
* If {@link BlueMapAPI} is already enabled when this listener is registered this method will be called immediately <i>(on the same thread)</i>!
|
||||
* <p><i>(Note: This method will likely be called asynchronously, <b>not</b> on the server-thread!</i></p>
|
||||
* @param blueMapApi the {@link BlueMapAPI}
|
||||
*/
|
||||
default void onEnable(BlueMapAPI blueMapApi) {}
|
||||
|
||||
/**
|
||||
* Called <b>before</b> BlueMap is being unloaded and stopped, after this method returns the API is no longer usable!<br>
|
||||
* Unlike {@link BlueMapAPIListener#onEnable(BlueMapAPI)}, if {@link BlueMapAPI} is not enabled when this listener is registered this method will <b>not</b> be called immediately.
|
||||
* <p><i>(Note: This method will likely be called asynchronously, <b>not</b> on the server-thread!</i></p>
|
||||
* @param blueMapApi the {@link BlueMapAPI}
|
||||
*/
|
||||
default void onDisable(BlueMapAPI blueMapApi) {}
|
||||
|
||||
/**
|
||||
* Called when BlueMap has been loaded and started and the API is ready to use.<br>
|
||||
* If {@link BlueMapAPI} is already enabled when this listener is registered this method will be called immediately <i>(on the same thread)</i>!
|
||||
* <p><i>(Note: This method will likely be called asynchronously, <b>not</b> on the server-thread!</i></p>
|
||||
* @param blueMapApi the {@link BlueMapAPI}
|
||||
*/
|
||||
default void onEnable(BlueMapAPI blueMapApi) {}
|
||||
|
||||
/**
|
||||
* Called <b>before</b> BlueMap is being unloaded and stopped, after this method returns the API is no longer usable!<br>
|
||||
* Unlike {@link BlueMapAPIListener#onEnable(BlueMapAPI)}, if {@link BlueMapAPI} is not enabled when this listener is registered this method will <b>not</b> be called immediately.
|
||||
* <p><i>(Note: This method will likely be called asynchronously, <b>not</b> on the server-thread!</i></p>
|
||||
* @param blueMapApi the {@link BlueMapAPI}
|
||||
*/
|
||||
default void onDisable(BlueMapAPI blueMapApi) {}
|
||||
|
||||
}
|
||||
|
@ -37,99 +37,99 @@
|
||||
*/
|
||||
public interface BlueMapMap {
|
||||
|
||||
/**
|
||||
* Returns this maps id, this is equal to the id configured in bluemap's config for this map.
|
||||
* @return the id of this map
|
||||
*/
|
||||
String getId();
|
||||
/**
|
||||
* Returns this maps id, this is equal to the id configured in bluemap's config for this map.
|
||||
* @return the id of this map
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Returns this maps display-name, this is equal to the name configured in bluemap's config for this map.
|
||||
* @return the name of this map
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Getter for the {@link BlueMapWorld} of this map.
|
||||
* @return the {@link BlueMapWorld} of this map
|
||||
*/
|
||||
BlueMapWorld getWorld();
|
||||
/**
|
||||
* Returns this maps display-name, this is equal to the name configured in bluemap's config for this map.
|
||||
* @return the name of this map
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Getter for the size of all tiles on this map in blocks.
|
||||
* @return the tile-size in blocks
|
||||
*/
|
||||
Vector2i getTileSize();
|
||||
|
||||
/**
|
||||
* Getter for the offset of the tile-grid on this map.<br>
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* <p>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.</p>
|
||||
* <p><b>Warning:</b> Using this method will harm the integrity of the map! Since BlueMap will still assume that the tile got updated properly.</p>
|
||||
* <p>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.</p>
|
||||
* @param filter The filter that will be used from now on.
|
||||
*/
|
||||
void setTileFilter(Predicate<Vector2i> filter);
|
||||
/**
|
||||
* Getter for the size of all tiles on this map in blocks.
|
||||
* @return the tile-size in blocks
|
||||
*/
|
||||
Vector2i getTileSize();
|
||||
|
||||
/**
|
||||
* Freezes or unfreezes the map in the same way the `/bluemap freeze` command does.
|
||||
* BlueMap will no longer attempt to update this map if it is frozen.
|
||||
* @param frozen Whether the map will be frozen or not
|
||||
*/
|
||||
void setFrozen(boolean frozen);
|
||||
/**
|
||||
* Getter for the offset of the tile-grid on this map.<br>
|
||||
* 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();
|
||||
/**
|
||||
* <p>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.</p>
|
||||
* <p><b>Warning:</b> Using this method will harm the integrity of the map! Since BlueMap will still assume that the tile got updated properly.</p>
|
||||
* <p>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.</p>
|
||||
* @param filter The filter that will be used from now on.
|
||||
*/
|
||||
void setTileFilter(Predicate<Vector2i> filter);
|
||||
|
||||
/**
|
||||
* Returns the currently set TileFilter. The default TileFilter is equivalent to <code>t -> true</code>.
|
||||
*/
|
||||
Predicate<Vector2i> getTileFilter();
|
||||
/**
|
||||
* Freezes or unfreezes the map in the same way the `/bluemap freeze` command does.
|
||||
* BlueMap will no longer attempt to update this map if it is frozen.
|
||||
* @param frozen Whether the map will be frozen or not
|
||||
*/
|
||||
void setFrozen(boolean frozen);
|
||||
|
||||
/**
|
||||
* Converts a block-position to a map-tile-coordinate for this map
|
||||
*
|
||||
* @param blockX the x-position of the block
|
||||
* @param blockZ the z-position of the block
|
||||
* @return the tile position
|
||||
*/
|
||||
default Vector2i posToTile(double blockX, double blockZ){
|
||||
Vector2i offset = getTileOffset();
|
||||
Vector2i size = getTileSize();
|
||||
|
||||
return Vector2i.from(
|
||||
(int) Math.floor((blockX - offset.getX()) / size.getX()),
|
||||
(int) Math.floor((blockZ - offset.getY()) / size.getY())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a block-position to a map-tile-coordinate for this map
|
||||
*
|
||||
* @param pos the position of the block
|
||||
* @return the tile position
|
||||
*/
|
||||
default Vector2i posToTile(Vector3i pos){
|
||||
return posToTile(pos.getX(), pos.getZ());
|
||||
}
|
||||
/**
|
||||
* Checks if the map is currently frozen
|
||||
* @return true if the map is frozen, false otherwise
|
||||
*/
|
||||
boolean isFrozen();
|
||||
|
||||
/**
|
||||
* Returns the currently set TileFilter. The default TileFilter is equivalent to <code>t -> true</code>.
|
||||
*/
|
||||
Predicate<Vector2i> getTileFilter();
|
||||
|
||||
/**
|
||||
* Converts a block-position to a map-tile-coordinate for this map
|
||||
*
|
||||
* @param blockX the x-position of the block
|
||||
* @param blockZ the z-position of the block
|
||||
* @return the tile position
|
||||
*/
|
||||
default Vector2i posToTile(double blockX, double blockZ){
|
||||
Vector2i offset = getTileOffset();
|
||||
Vector2i size = getTileSize();
|
||||
|
||||
return Vector2i.from(
|
||||
(int) Math.floor((blockX - offset.getX()) / size.getX()),
|
||||
(int) Math.floor((blockZ - offset.getY()) / size.getY())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a block-position to a map-tile-coordinate for this map
|
||||
*
|
||||
* @param pos the position of the block
|
||||
* @return the tile position
|
||||
*/
|
||||
default Vector2i posToTile(Vector3i pos){
|
||||
return posToTile(pos.getX(), pos.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a block-position to a map-tile-coordinate for this map
|
||||
*
|
||||
* @param pos the position of the block
|
||||
* @return the tile position
|
||||
*/
|
||||
default Vector2i posToTile(Vector3d pos){
|
||||
return posToTile(pos.getX(), pos.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a block-position to a map-tile-coordinate for this map
|
||||
*
|
||||
* @param pos the position of the block
|
||||
* @return the tile position
|
||||
*/
|
||||
default Vector2i posToTile(Vector3d pos){
|
||||
return posToTile(pos.getX(), pos.getZ());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,37 +33,37 @@
|
||||
*/
|
||||
public interface BlueMapWorld {
|
||||
|
||||
/**
|
||||
* <p>Getter for the {@link UUID} of the world.</p>
|
||||
* <p>
|
||||
* The {@link UUID}s of this worlds are <b>not</b> guaranteed to be consistent across reloads/restarts!
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Implementation notes:</b><br>
|
||||
* The used UUID highly depends on the implementation
|
||||
* </p>
|
||||
* <table>
|
||||
* <caption>Implementations</caption>
|
||||
* <tr><th>Sponge</th><td>The UUID is equal to the returned UUID by world-instances of the Sponge-API, so you can just use <code>spongeWorld.getUniqueId()</code></td></tr>
|
||||
* <tr><th>Bukkit</th><td>The UUID is equal to the returned UUID by world-instances of the Bukkit-API, so you can just use <code>bukkitWorld.getUID()</code></td></tr>
|
||||
* <tr><th>Forge</th><td>The UUID is randomly generated, and changes on each reload/restart</td></tr>
|
||||
* <tr><th>CLI</th><td>The UUID is randomly generated, and changes on each reload/restart</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @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 ( <code>world:</code> ).
|
||||
* @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<BlueMapMap> getMaps();
|
||||
|
||||
/**
|
||||
* <p>Getter for the {@link UUID} of the world.</p>
|
||||
* <p>
|
||||
* The {@link UUID}s of this worlds are <b>not</b> guaranteed to be consistent across reloads/restarts!
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Implementation notes:</b><br>
|
||||
* The used UUID highly depends on the implementation
|
||||
* </p>
|
||||
* <table>
|
||||
* <caption>Implementations</caption>
|
||||
* <tr><th>Sponge</th><td>The UUID is equal to the returned UUID by world-instances of the Sponge-API, so you can just use <code>spongeWorld.getUniqueId()</code></td></tr>
|
||||
* <tr><th>Bukkit</th><td>The UUID is equal to the returned UUID by world-instances of the Bukkit-API, so you can just use <code>bukkitWorld.getUID()</code></td></tr>
|
||||
* <tr><th>Forge</th><td>The UUID is randomly generated, and changes on each reload/restart</td></tr>
|
||||
* <tr><th>CLI</th><td>The UUID is randomly generated, and changes on each reload/restart</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @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 ( <code>world:</code> ).
|
||||
* @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<BlueMapMap> getMaps();
|
||||
|
||||
}
|
||||
|
@ -26,36 +26,36 @@
|
||||
|
||||
public interface DistanceRangedMarker extends Marker {
|
||||
|
||||
/**
|
||||
* Getter for the minimum distance of the camera to the position for this {@link Marker} to be displayed.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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);
|
||||
|
||||
}
|
||||
|
@ -28,95 +28,95 @@
|
||||
|
||||
public interface ExtrudeMarker extends ObjectMarker, DistanceRangedMarker {
|
||||
|
||||
/**
|
||||
* Getter for {@link Shape} of this {@link ExtrudeMarker}.
|
||||
* <p>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.</p>
|
||||
* @return the {@link Shape}
|
||||
*/
|
||||
Shape getShape();
|
||||
/**
|
||||
* Getter for {@link Shape} of this {@link ExtrudeMarker}.
|
||||
* <p>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.</p>
|
||||
* @return the {@link Shape}
|
||||
*/
|
||||
Shape getShape();
|
||||
|
||||
/**
|
||||
* Getter for the minimum height (y-coordinate) of where the shape is displayed on the map.<br>
|
||||
* <i>(The shape will be extruded from this value to {@link #getShapeMaxY()} on the map)</i>
|
||||
* @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.<br>
|
||||
* <i>(The shape will be extruded from this value to {@link #getShapeMaxY()} on the map)</i>
|
||||
* @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.
|
||||
* <i>(The shape will be extruded from {@link #getShapeMinY()} to this value on the map)</i>
|
||||
* @return the max-height of the shape on the map
|
||||
*/
|
||||
float getShapeMaxY();
|
||||
|
||||
/**
|
||||
* Sets the {@link Shape} of this {@link ExtrudeMarker}.
|
||||
* <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>
|
||||
* <i>(The shape will be extruded from minY to maxY on the map)</i>
|
||||
* @param shape the new {@link Shape}
|
||||
* @param minY the new min-height (y-coordinate) of the shape on the map
|
||||
* @param maxY the new max-height (y-coordinate) of the shape on the map
|
||||
*/
|
||||
void setShape(Shape shape, float minY, float maxY);
|
||||
/**
|
||||
* Getter for the maximum height (y-coordinate) of where the shape is displayed on the map.
|
||||
* <i>(The shape will be extruded from {@link #getShapeMinY()} to this value on the map)</i>
|
||||
* @return the max-height of the shape on the map
|
||||
*/
|
||||
float getShapeMaxY();
|
||||
|
||||
/**
|
||||
* 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 <code>true</code> 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}.
|
||||
* <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>
|
||||
* <i>(The shape will be extruded from minY to maxY on the map)</i>
|
||||
* @param shape the new {@link Shape}
|
||||
* @param minY the new min-height (y-coordinate) of the shape on the map
|
||||
* @param maxY the new max-height (y-coordinate) of the shape on the map
|
||||
*/
|
||||
void setShape(Shape shape, float minY, float maxY);
|
||||
|
||||
/**
|
||||
* Getter for the width of the lines of this {@link ExtrudeMarker}.
|
||||
* @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 <code>true</code> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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}.
|
||||
*
|
||||
* <p>
|
||||
* <b>Important:</b><br>
|
||||
* Make sure you escape all html-tags from possible user inputs to prevent possible <a href="https://en.wikipedia.org/wiki/Cross-site_scripting">XSS-Attacks</a> on the web-client!
|
||||
* </p>
|
||||
*
|
||||
* @param html the html that will be inserted as the marker.
|
||||
*/
|
||||
void setHtml(String html);
|
||||
|
||||
/**
|
||||
* Sets the html for this {@link HtmlMarker}.
|
||||
*
|
||||
* <p>
|
||||
* <b>Important:</b><br>
|
||||
* Make sure you escape all html-tags from possible user inputs to prevent possible <a href="https://en.wikipedia.org/wiki/Cross-site_scripting">XSS-Attacks</a> on the web-client!
|
||||
* </p>
|
||||
*
|
||||
* @param html the html that will be inserted as the marker.
|
||||
*/
|
||||
void setHtml(String html);
|
||||
|
||||
}
|
||||
|
@ -33,64 +33,64 @@
|
||||
*/
|
||||
public class Line {
|
||||
|
||||
private final Vector3d[] points;
|
||||
private Vector3d min = null;
|
||||
private Vector3d max = null;
|
||||
private final Vector3d[] points;
|
||||
private Vector3d min = null;
|
||||
private Vector3d max = null;
|
||||
|
||||
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 <b>a copy</b> of the points array.<br>
|
||||
* <i>(A line is immutable once created)</i>
|
||||
* @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 <b>a copy</b> of the points array.<br>
|
||||
* <i>(A line is immutable once created)</i>
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 <code>true</code> 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 <code>true</code> 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);
|
||||
|
||||
}
|
||||
|
@ -28,33 +28,33 @@
|
||||
|
||||
public interface LinkMarker extends Marker {
|
||||
|
||||
/**
|
||||
* Gets the link-address of this {@link Marker}.<br>
|
||||
* 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<String> getLink();
|
||||
/**
|
||||
* Gets the link-address of this {@link Marker}.<br>
|
||||
* 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<String> getLink();
|
||||
|
||||
/**
|
||||
* If this is <code>true</code> 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 <code>true</code> 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}.<br>
|
||||
* 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 <code>null</code> 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}.<br>
|
||||
* 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 <code>null</code> 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();
|
||||
|
||||
}
|
||||
|
@ -31,129 +31,129 @@
|
||||
|
||||
/**
|
||||
* A marker that is displayed on one of the maps in the web-app.
|
||||
* <p>Each marker has an id that is unique in the {@link MarkerSet} that it is in.</p>
|
||||
* <p>Each marker has an id that is unique in the {@link MarkerSet} that it is in.</p>
|
||||
*/
|
||||
public interface Marker {
|
||||
|
||||
/**
|
||||
* Getter for the id of this {@link Marker}.
|
||||
* <p>The id is unique in the {@link MarkerSet} that this marker is in.</p>
|
||||
* @return the id of this {@link Marker}
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Getter for the {@link BlueMapMap} this {@link Marker} lives in.
|
||||
* @return the {@link BlueMapMap} this {@link Marker} lives in
|
||||
*/
|
||||
BlueMapMap getMap();
|
||||
|
||||
/**
|
||||
* Sets the {@link BlueMapMap} this {@link Marker} lives in
|
||||
* @param map the new {@link BlueMapMap}
|
||||
*/
|
||||
void setMap(BlueMapMap map);
|
||||
|
||||
/**
|
||||
* Getter for the position of where this {@link Marker} lives on the map.
|
||||
* @return the position of this {@link Marker}
|
||||
*/
|
||||
Vector3d getPosition();
|
||||
|
||||
/**
|
||||
* Sets the position of where this {@link Marker} lives on the map.
|
||||
* @param position the new position
|
||||
*/
|
||||
void setPosition(Vector3d position);
|
||||
|
||||
/**
|
||||
* Getter for the label of this marker.
|
||||
* @return the label of this {@link Marker}
|
||||
*/
|
||||
String getLabel();
|
||||
|
||||
/**
|
||||
* Sets the label of this {@link Marker}.
|
||||
* <p>
|
||||
* <b>Using html-tags in the label is possible but deprecated!</b>
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Important:</b><br>
|
||||
* Html-tags in the label will not be escaped, so you can use them to style the {@link Marker}-labels.<br>
|
||||
* Make sure you escape all html-tags from possible user inputs to prevent possible <a href="https://en.wikipedia.org/wiki/Cross-site_scripting">XSS-Attacks</a> on the web-client!
|
||||
* </p>
|
||||
*
|
||||
* @param label the new label for this {@link Marker}
|
||||
*/
|
||||
void setLabel(String label);
|
||||
/**
|
||||
* Getter for the id of this {@link Marker}.
|
||||
* <p>The id is unique in the {@link MarkerSet} that this marker is in.</p>
|
||||
* @return the id of this {@link Marker}
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Getter for the minimum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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}.<br>
|
||||
* 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
|
||||
*/
|
||||
Optional<String> getLink();
|
||||
/**
|
||||
* Getter for the label of this marker.
|
||||
* @return the label of this {@link Marker}
|
||||
*/
|
||||
String getLabel();
|
||||
|
||||
/**
|
||||
* If this is <code>true</code> 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}.<br>
|
||||
* 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 <code>null</code> 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}.
|
||||
* <p>
|
||||
* <b>Using html-tags in the label is possible but deprecated!</b>
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Important:</b><br>
|
||||
* Html-tags in the label will not be escaped, so you can use them to style the {@link Marker}-labels.<br>
|
||||
* Make sure you escape all html-tags from possible user inputs to prevent possible <a href="https://en.wikipedia.org/wiki/Cross-site_scripting">XSS-Attacks</a> on the web-client!
|
||||
* </p>
|
||||
*
|
||||
* @param label the new label for this {@link Marker}
|
||||
*/
|
||||
void setLabel(String label);
|
||||
|
||||
/**
|
||||
* Getter for the minimum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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.<br>
|
||||
* 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}.<br>
|
||||
* 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
|
||||
*/
|
||||
Optional<String> getLink();
|
||||
|
||||
/**
|
||||
* If this is <code>true</code> 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}.<br>
|
||||
* 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 <code>null</code> 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();
|
||||
|
||||
}
|
||||
|
@ -36,69 +36,69 @@
|
||||
* <b>Important:</b><br>
|
||||
* 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()}!<br>
|
||||
* </p>
|
||||
* <p>To avoid any concurrent modifications to the <code>markers.json</code>, make sure your {@link MarkerAPI} is always loaded before making any changes, and saved right after the changes.</p>
|
||||
*
|
||||
* <p>To avoid any concurrent modifications to the <code>markers.json</code>, make sure your {@link MarkerAPI} is always loaded before making any changes, and saved right after the changes.</p>
|
||||
*
|
||||
* @see BlueMapAPI#getMarkerAPI()
|
||||
*/
|
||||
public interface MarkerAPI {
|
||||
|
||||
/**
|
||||
* Getter for an <i>unmodifiable</i> {@link Collection} containing all {@link MarkerSet}s that are currently loaded with BlueMap.
|
||||
*
|
||||
* @return a {@link Collection} with all loaded {@link MarkerSet}s
|
||||
*/
|
||||
Collection<MarkerSet> getMarkerSets();
|
||||
|
||||
/**
|
||||
* Getter for a loaded {@link MarkerSet} with the given id.<br>
|
||||
* Returns an empty {@link Optional} if no {@link MarkerSet} with that id is loaded.
|
||||
*
|
||||
* @param id the id of the {@link MarkerSet}
|
||||
* @return an {@link Optional}<{@link MarkerSet}> with the given id
|
||||
*/
|
||||
Optional<MarkerSet> getMarkerSet(String id);
|
||||
|
||||
/**
|
||||
* Created a new {@link MarkerSet} with the given id.<br>
|
||||
* If there is already a {@link MarkerSet} with that id loaded, no new {@link MarkerSet} is created and the existing one is returned.
|
||||
*
|
||||
* @param id the id of the {@link MarkerSet}
|
||||
* @return a {@link MarkerSet} with the given id
|
||||
*/
|
||||
MarkerSet createMarkerSet(String id);
|
||||
|
||||
/**
|
||||
* Removes the given {@link MarkerSet}.<br>
|
||||
* This is equivalent to calling <code>removeMarkerSet(markerSet.getId())</code>.
|
||||
*
|
||||
* @param markerSet the {@link MarkerSet} to be removed
|
||||
* @return <code>true</code> if the {@link MarkerSet} was removed, <code>false</code> 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 <code>true</code> if the {@link MarkerSet} was removed, <code>false</code> 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 <code>markers.json</code>.<br>
|
||||
* Calling this will <b>override all unsaved changes</b> you made with this instance!
|
||||
*
|
||||
* @throws IOException if an {@link IOException} occurred while loading the <code>markers.json</code>
|
||||
*/
|
||||
void load() throws IOException;
|
||||
|
||||
/**
|
||||
* Saves all changes made with this instance to the <code>markers.json</code>.<br>
|
||||
*
|
||||
* @throws IOException if an {@link IOException} occurred while saving the <code>markers.json</code>
|
||||
*/
|
||||
void save() throws IOException;
|
||||
|
||||
/**
|
||||
* Getter for an <i>unmodifiable</i> {@link Collection} containing all {@link MarkerSet}s that are currently loaded with BlueMap.
|
||||
*
|
||||
* @return a {@link Collection} with all loaded {@link MarkerSet}s
|
||||
*/
|
||||
Collection<MarkerSet> getMarkerSets();
|
||||
|
||||
/**
|
||||
* Getter for a loaded {@link MarkerSet} with the given id.<br>
|
||||
* Returns an empty {@link Optional} if no {@link MarkerSet} with that id is loaded.
|
||||
*
|
||||
* @param id the id of the {@link MarkerSet}
|
||||
* @return an {@link Optional}<{@link MarkerSet}> with the given id
|
||||
*/
|
||||
Optional<MarkerSet> getMarkerSet(String id);
|
||||
|
||||
/**
|
||||
* Created a new {@link MarkerSet} with the given id.<br>
|
||||
* If there is already a {@link MarkerSet} with that id loaded, no new {@link MarkerSet} is created and the existing one is returned.
|
||||
*
|
||||
* @param id the id of the {@link MarkerSet}
|
||||
* @return a {@link MarkerSet} with the given id
|
||||
*/
|
||||
MarkerSet createMarkerSet(String id);
|
||||
|
||||
/**
|
||||
* Removes the given {@link MarkerSet}.<br>
|
||||
* This is equivalent to calling <code>removeMarkerSet(markerSet.getId())</code>.
|
||||
*
|
||||
* @param markerSet the {@link MarkerSet} to be removed
|
||||
* @return <code>true</code> if the {@link MarkerSet} was removed, <code>false</code> 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 <code>true</code> if the {@link MarkerSet} was removed, <code>false</code> 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 <code>markers.json</code>.<br>
|
||||
* Calling this will <b>override all unsaved changes</b> you made with this instance!
|
||||
*
|
||||
* @throws IOException if an {@link IOException} occurred while loading the <code>markers.json</code>
|
||||
*/
|
||||
void load() throws IOException;
|
||||
|
||||
/**
|
||||
* Saves all changes made with this instance to the <code>markers.json</code>.<br>
|
||||
*
|
||||
* @throws IOException if an {@link IOException} occurred while saving the <code>markers.json</code>
|
||||
*/
|
||||
void save() throws IOException;
|
||||
|
||||
}
|
||||
|
@ -33,313 +33,313 @@
|
||||
|
||||
/**
|
||||
* A set of {@link Marker}s that are displayed on the maps in the web-app.
|
||||
*
|
||||
* <p>Each {@link MarkerSet} has an unique id.</p>
|
||||
*
|
||||
* <p>Each {@link MarkerSet} has an unique id.</p>
|
||||
*/
|
||||
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}.
|
||||
* <p>The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})</p>
|
||||
* @return the label of this {@link MarkerSet}
|
||||
*/
|
||||
String getLabel();
|
||||
|
||||
/**
|
||||
* Sets the label of this {@link MarkerSet}.
|
||||
* <p>The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})</p>
|
||||
* @param label the new label
|
||||
*/
|
||||
void setLabel(String label);
|
||||
|
||||
/**
|
||||
* Checks if the {@link MarkerSet} is toggleable.
|
||||
* <p>If this is <code>true</code>, 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.</p>
|
||||
* @return whether this {@link MarkerSet} is toggleable
|
||||
*/
|
||||
boolean isToggleable();
|
||||
|
||||
/**
|
||||
* Changes if this {@link MarkerSet} is toggleable.
|
||||
* <p>If this is <code>true</code>, 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.</p>
|
||||
* @param toggleable whether this {@link MarkerSet} should be toggleable
|
||||
*/
|
||||
void setToggleable(boolean toggleable);
|
||||
/**
|
||||
* Getter for the id of this {@link MarkerSet}.
|
||||
* @return the id of this {@link MarkerSet}
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @deprecated method name has a typo, use {@link #isDefaultHidden()} instead.
|
||||
*/
|
||||
default boolean isDefautHidden() {
|
||||
return isDefaultHidden();
|
||||
}
|
||||
/**
|
||||
* Getter for the label of this {@link MarkerSet}.
|
||||
* <p>The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})</p>
|
||||
* @return the label of this {@link MarkerSet}
|
||||
*/
|
||||
String getLabel();
|
||||
|
||||
/**
|
||||
* Checks if this {@link MarkerSet} is hidden by default.
|
||||
* <p>This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is <code>true</code> the markers of this marker set will initially be hidden and can be displayed using the toggle-button.</p>
|
||||
*
|
||||
* @return whether this {@link MarkerSet} is hidden by default
|
||||
* @see #isToggleable()
|
||||
*/
|
||||
boolean isDefaultHidden();
|
||||
|
||||
/**
|
||||
* Sets if this {@link MarkerSet} is hidden by default.
|
||||
* <p>This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is <code>true</code> the markers of this marker set will initially be hidden and can be displayed using the toggle-button.</p>
|
||||
*
|
||||
* @param defaultHide whether this {@link MarkerSet} should be hidden by default
|
||||
* @see #isToggleable()
|
||||
*/
|
||||
void setDefaultHidden(boolean defaultHide);
|
||||
|
||||
/**
|
||||
* Getter for an <b>unmodifiable</b> {@link Collection} of all {@link Marker}s in this {@link MarkerSet}.
|
||||
*
|
||||
* @return a {@link Collection} with all {@link Marker}s of this {@link MarkerSet}.
|
||||
*/
|
||||
Collection<Marker> getMarkers();
|
||||
|
||||
/**
|
||||
* Getter for a {@link Marker} with the given id.<br>
|
||||
* Returns an empty {@link Optional} if no {@link Marker} exists with the given id.
|
||||
*
|
||||
* @param id the id of the {@link Marker}
|
||||
* @return an {@link Optional}<{@link Marker}> with the given id
|
||||
*/
|
||||
Optional<Marker> getMarker(String id);
|
||||
/**
|
||||
* Sets the label of this {@link MarkerSet}.
|
||||
* <p>The label is used in the web-app to name the toggle-button of this {@link MarkerSet} if it is toggleable. ({@link #isToggleable()})</p>
|
||||
* @param label the new label
|
||||
*/
|
||||
void setLabel(String label);
|
||||
|
||||
/**
|
||||
* Creates a {@link POIMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link POIMarker}!
|
||||
*
|
||||
* @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
|
||||
* @return the created {@link POIMarker}
|
||||
*/
|
||||
POIMarker createPOIMarker(String id, BlueMapMap map, Vector3d position);
|
||||
|
||||
/**
|
||||
* Creates a {@link POIMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link POIMarker}!
|
||||
*
|
||||
* @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
|
||||
* @return the created {@link POIMarker}
|
||||
*/
|
||||
default POIMarker createPOIMarker(String id, BlueMapMap map, double posX, double posY, double posZ) {
|
||||
return createPOIMarker(id, map, new Vector3d(posX, posY, posZ));
|
||||
}
|
||||
/**
|
||||
* Checks if the {@link MarkerSet} is toggleable.
|
||||
* <p>If this is <code>true</code>, 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.</p>
|
||||
* @return whether this {@link MarkerSet} is toggleable
|
||||
*/
|
||||
boolean isToggleable();
|
||||
|
||||
/**
|
||||
* Changes if this {@link MarkerSet} is toggleable.
|
||||
* <p>If this is <code>true</code>, 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.</p>
|
||||
* @param toggleable whether this {@link MarkerSet} should be toggleable
|
||||
*/
|
||||
void setToggleable(boolean toggleable);
|
||||
|
||||
/**
|
||||
* @deprecated method name has a typo, use {@link #isDefaultHidden()} instead.
|
||||
*/
|
||||
default boolean isDefautHidden() {
|
||||
return isDefaultHidden();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this {@link MarkerSet} is hidden by default.
|
||||
* <p>This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is <code>true</code> the markers of this marker set will initially be hidden and can be displayed using the toggle-button.</p>
|
||||
*
|
||||
* @return whether this {@link MarkerSet} is hidden by default
|
||||
* @see #isToggleable()
|
||||
*/
|
||||
boolean isDefaultHidden();
|
||||
|
||||
/**
|
||||
* Sets if this {@link MarkerSet} is hidden by default.
|
||||
* <p>This is basically the default-state of the toggle-button from {@link #isToggleable()}. If this is <code>true</code> the markers of this marker set will initially be hidden and can be displayed using the toggle-button.</p>
|
||||
*
|
||||
* @param defaultHide whether this {@link MarkerSet} should be hidden by default
|
||||
* @see #isToggleable()
|
||||
*/
|
||||
void setDefaultHidden(boolean defaultHide);
|
||||
|
||||
/**
|
||||
* Getter for an <b>unmodifiable</b> {@link Collection} of all {@link Marker}s in this {@link MarkerSet}.
|
||||
*
|
||||
* @return a {@link Collection} with all {@link Marker}s of this {@link MarkerSet}.
|
||||
*/
|
||||
Collection<Marker> getMarkers();
|
||||
|
||||
/**
|
||||
* Getter for a {@link Marker} with the given id.<br>
|
||||
* Returns an empty {@link Optional} if no {@link Marker} exists with the given id.
|
||||
*
|
||||
* @param id the id of the {@link Marker}
|
||||
* @return an {@link Optional}<{@link Marker}> with the given id
|
||||
*/
|
||||
Optional<Marker> getMarker(String id);
|
||||
|
||||
/**
|
||||
* Creates a {@link POIMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link POIMarker}!
|
||||
*
|
||||
* @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
|
||||
* @return the created {@link POIMarker}
|
||||
*/
|
||||
POIMarker createPOIMarker(String id, BlueMapMap map, Vector3d position);
|
||||
|
||||
/**
|
||||
* Creates a {@link POIMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link POIMarker}!
|
||||
*
|
||||
* @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
|
||||
* @return the created {@link POIMarker}
|
||||
*/
|
||||
default POIMarker createPOIMarker(String id, BlueMapMap map, double posX, double posY, double posZ) {
|
||||
return createPOIMarker(id, map, new Vector3d(posX, posY, posZ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a {@link HtmlMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link HtmlMarker}!
|
||||
*
|
||||
* @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 html the html-content of the new marker
|
||||
* @return the created {@link HtmlMarker}
|
||||
*/
|
||||
HtmlMarker createHtmlMarker(String id, BlueMapMap map, Vector3d position, String html);
|
||||
/**
|
||||
* Creates a {@link HtmlMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link HtmlMarker}!
|
||||
*
|
||||
* @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 html the html-content of the new marker
|
||||
* @return the created {@link HtmlMarker}
|
||||
*/
|
||||
HtmlMarker createHtmlMarker(String id, BlueMapMap map, Vector3d position, String html);
|
||||
|
||||
/**
|
||||
* Creates a {@link HtmlMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link HtmlMarker}!
|
||||
*
|
||||
* @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 html the html-content of the new marker
|
||||
* @return the created {@link HtmlMarker}
|
||||
*/
|
||||
default HtmlMarker createHtmlMarker(String id, BlueMapMap map, double posX, double posY, double posZ, String html) {
|
||||
return createHtmlMarker(id, map, new Vector3d(posX, posY, posZ), html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ShapeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link ShapeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link ShapeMarker}!
|
||||
*
|
||||
* <p><i>(The position of the marker will be the center of the shape (it's bounding box))</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link HtmlMarker}!
|
||||
*
|
||||
* @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 html the html-content of the new marker
|
||||
* @return the created {@link HtmlMarker}
|
||||
*/
|
||||
default HtmlMarker createHtmlMarker(String id, BlueMapMap map, double posX, double posY, double posZ, String html) {
|
||||
return createHtmlMarker(id, map, new Vector3d(posX, posY, posZ), html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ShapeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link ShapeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||
*
|
||||
* <p><i>(The position of the marker will be the center of the shape (it's bounding box))</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a Marker with that id already exists, it will be replaced by the new {@link ShapeMarker}!
|
||||
*
|
||||
* <p><i>(The position of the marker will be the center of the shape (it's bounding box))</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link LineMarker}!
|
||||
*
|
||||
* <p><i>(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link LineMarker}!
|
||||
*
|
||||
* <p><i>(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||
*
|
||||
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||
*
|
||||
* <p><i>(The position of the marker will be the center of the shape (it's bounding box))</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link LineMarker}!
|
||||
*
|
||||
* <p><i>(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link LineMarker}!
|
||||
*
|
||||
* <p><i>(Since the line has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link LineMarker}!
|
||||
*
|
||||
* <p><i>(The position of the marker will be the center of the line (it's bounding box))</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* This is equivalent to calling <code>removeMarker(marker.getId())</code>.
|
||||
*
|
||||
* @param marker the {@link Marker} to be removed
|
||||
* @return <code>true</code> if the {@link Marker} was removed, <code>false</code> 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 <code>true</code> if the {@link Marker} was removed, <code>false</code> 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}.<br>
|
||||
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link LineMarker}!
|
||||
*
|
||||
* <p><i>(The position of the marker will be the center of the line (it's bounding box))</i></p>
|
||||
*
|
||||
* @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}.<br>
|
||||
* This is equivalent to calling <code>removeMarker(marker.getId())</code>.
|
||||
*
|
||||
* @param marker the {@link Marker} to be removed
|
||||
* @return <code>true</code> if the {@link Marker} was removed, <code>false</code> 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 <code>true</code> if the {@link Marker} was removed, <code>false</code> if there was no {@link Marker} with that id
|
||||
*/
|
||||
boolean removeMarker(String id);
|
||||
|
||||
}
|
||||
|
@ -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.<br>
|
||||
* This is the text that will be displayed on the popup when you click on this marker.
|
||||
* <p>
|
||||
* <b>Important:</b><br>
|
||||
* Html-tags in the label will not be escaped, so you can use them to style the {@link ObjectMarker}-detail.<br>
|
||||
* Make sure you escape all html-tags from possible user inputs to prevent possible <a href="https://en.wikipedia.org/wiki/Cross-site_scripting">XSS-Attacks</a> on the web-client!
|
||||
* </p>
|
||||
*
|
||||
* @param detail the new detail for this {@link ObjectMarker}
|
||||
*/
|
||||
void setDetail(String detail);
|
||||
/**
|
||||
* Sets the detail of this {@link ObjectMarker}. The detail can include html-tags.<br>
|
||||
* This is the text that will be displayed on the popup when you click on this marker.
|
||||
* <p>
|
||||
* <b>Important:</b><br>
|
||||
* Html-tags in the label will not be escaped, so you can use them to style the {@link ObjectMarker}-detail.<br>
|
||||
* Make sure you escape all html-tags from possible user inputs to prevent possible <a href="https://en.wikipedia.org/wiki/Cross-site_scripting">XSS-Attacks</a> on the web-client!
|
||||
* </p>
|
||||
*
|
||||
* @param detail the new detail for this {@link ObjectMarker}
|
||||
*/
|
||||
void setDetail(String detail);
|
||||
|
||||
}
|
||||
|
@ -30,42 +30,42 @@
|
||||
|
||||
public interface POIMarker extends Marker, DistanceRangedMarker {
|
||||
|
||||
/**
|
||||
* Getter for the relative address of the icon used to display this {@link POIMarker}
|
||||
* @return the relative web-address of the icon
|
||||
*/
|
||||
String getIconAddress();
|
||||
|
||||
/**
|
||||
* Getter for the position (in pixels) where the icon is anchored to the map.
|
||||
* @return the anchor-position in pixels
|
||||
* @deprecated Use {@link #getAnchor()} instead
|
||||
*/
|
||||
default Vector2i getIconAnchor() {
|
||||
return getAnchor();
|
||||
}
|
||||
/**
|
||||
* Getter for the relative address of the icon used to display this {@link POIMarker}
|
||||
* @return the relative web-address of the icon
|
||||
*/
|
||||
String getIconAddress();
|
||||
|
||||
/**
|
||||
* Getter for the position (in pixels) where the icon is anchored to the map.
|
||||
* @return the anchor-position in pixels
|
||||
*/
|
||||
Vector2i getAnchor();
|
||||
/**
|
||||
* Getter for the position (in pixels) where the icon is anchored to the map.
|
||||
* @return the anchor-position in pixels
|
||||
* @deprecated Use {@link #getAnchor()} instead
|
||||
*/
|
||||
default Vector2i getIconAnchor() {
|
||||
return getAnchor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the position (in pixels) where the icon is anchored to the map.
|
||||
* @return the anchor-position in pixels
|
||||
*/
|
||||
Vector2i getAnchor();
|
||||
|
||||
/**
|
||||
* Sets the icon for this {@link POIMarker}.
|
||||
* @param iconAddress the web-address of the icon-image. Can be an absolute or relative. You can also use an address returned by {@link BlueMapAPI#createImage(java.awt.image.BufferedImage, String)}.
|
||||
* @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
|
||||
*/
|
||||
default void setIcon(String iconAddress, int anchorX, int anchorY) {
|
||||
setIcon(iconAddress, new Vector2i(anchorX, anchorY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon for this {@link POIMarker}.
|
||||
* @param iconAddress the web-address of the icon-image. Can be an absolute or relative. You can also use an address returned by {@link BlueMapAPI#createImage(java.awt.image.BufferedImage, String)}.
|
||||
* @param anchor the position of the position (in pixels) where the icon is anchored to the map
|
||||
*/
|
||||
void setIcon(String iconAddress, Vector2i anchor);
|
||||
|
||||
/**
|
||||
* Sets the icon for this {@link POIMarker}.
|
||||
* @param iconAddress the web-address of the icon-image. Can be an absolute or relative. You can also use an address returned by {@link BlueMapAPI#createImage(java.awt.image.BufferedImage, String)}.
|
||||
* @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
|
||||
*/
|
||||
default void setIcon(String iconAddress, int anchorX, int anchorY) {
|
||||
setIcon(iconAddress, new Vector2i(anchorX, anchorY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon for this {@link POIMarker}.
|
||||
* @param iconAddress the web-address of the icon-image. Can be an absolute or relative. You can also use an address returned by {@link BlueMapAPI#createImage(java.awt.image.BufferedImage, String)}.
|
||||
* @param anchor the position of the position (in pixels) where the icon is anchored to the map
|
||||
*/
|
||||
void setIcon(String iconAddress, Vector2i anchor);
|
||||
|
||||
}
|
||||
|
@ -33,153 +33,153 @@
|
||||
*/
|
||||
public class Shape {
|
||||
|
||||
private final Vector2d[] points;
|
||||
private Vector2d min = null;
|
||||
private Vector2d max = null;
|
||||
|
||||
public Shape(Vector2d... points) {
|
||||
if (points.length < 3) throw new IllegalArgumentException("A shape has to have at least 3 points!");
|
||||
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the amount of points in this shape.
|
||||
* @return the amount of points
|
||||
*/
|
||||
public int getPointCount() {
|
||||
return points.length;
|
||||
}
|
||||
|
||||
public Vector2d getPoint(int i) {
|
||||
return points[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <b>a copy</b> of the points array.<br>
|
||||
* <i>(A shape is immutable once created)</i>
|
||||
* @return the points of this shape
|
||||
*/
|
||||
public Vector2d[] getPoints() {
|
||||
return Arrays.copyOf(points, points.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates and returns the minimum corner of the axis-aligned-bounding-box of this shape.
|
||||
* @return the min of the AABB of this shape
|
||||
*/
|
||||
public Vector2d getMin() {
|
||||
if (this.min == null) {
|
||||
Vector2d 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 shape.
|
||||
* @return the max of the AABB of this shape
|
||||
*/
|
||||
public Vector2d getMax() {
|
||||
if (this.max == null) {
|
||||
Vector2d max = points[0];
|
||||
for (int i = 1; i < points.length; i++) {
|
||||
max = max.max(points[i]);
|
||||
}
|
||||
this.max = max;
|
||||
}
|
||||
return this.max;
|
||||
}
|
||||
private final Vector2d[] points;
|
||||
private Vector2d min = null;
|
||||
private Vector2d max = null;
|
||||
|
||||
public Shape(Vector2d... points) {
|
||||
if (points.length < 3) throw new IllegalArgumentException("A shape has to have at least 3 points!");
|
||||
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the amount of points in this shape.
|
||||
* @return the amount of points
|
||||
*/
|
||||
public int getPointCount() {
|
||||
return points.length;
|
||||
}
|
||||
|
||||
public Vector2d getPoint(int i) {
|
||||
return points[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <b>a copy</b> of the points array.<br>
|
||||
* <i>(A shape is immutable once created)</i>
|
||||
* @return the points of this shape
|
||||
*/
|
||||
public Vector2d[] getPoints() {
|
||||
return Arrays.copyOf(points, points.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates and returns the minimum corner of the axis-aligned-bounding-box of this shape.
|
||||
* @return the min of the AABB of this shape
|
||||
*/
|
||||
public Vector2d getMin() {
|
||||
if (this.min == null) {
|
||||
Vector2d 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 shape.
|
||||
* @return the max of the AABB of this shape
|
||||
*/
|
||||
public Vector2d getMax() {
|
||||
if (this.max == null) {
|
||||
Vector2d max = points[0];
|
||||
for (int i = 1; i < points.length; i++) {
|
||||
max = max.max(points[i]);
|
||||
}
|
||||
this.max = max;
|
||||
}
|
||||
return this.max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a rectangle spanning over pos1 and pos2
|
||||
* @param pos1 one corner of the rectangle
|
||||
* @param pos2 the opposite corner of the rectangle
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createRect(Vector2d pos1, Vector2d pos2) {
|
||||
Vector2d min = pos1.min(pos2);
|
||||
Vector2d max = pos1.max(pos2);
|
||||
|
||||
return new Shape(
|
||||
min,
|
||||
new Vector2d(max.getX(), min.getY()),
|
||||
max,
|
||||
new Vector2d(min.getX(), max.getY())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a rectangle spanning over two points
|
||||
* @param x1 x position of one corner of the rectangle
|
||||
* @param y1 y position of one corner of the rectangle
|
||||
* @param x2 x position of the opposite corner of the rectangle
|
||||
* @param y2 y position of the opposite corner of the rectangle
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createRect(double x1, double y1, double x2, double y2) {
|
||||
return createRect(new Vector2d(x1, y1), new Vector2d(x2, y2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing an ellipse.
|
||||
* @param centerPos the center of the ellipse
|
||||
* @param radiusX the x radius of the ellipse
|
||||
* @param radiusY the y radius of the ellipse
|
||||
* @param points the amount of points used to create the ellipse (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createEllipse(Vector2d centerPos, double radiusX, double radiusY, int points) {
|
||||
if (points < 3) throw new IllegalArgumentException("A shape has to have at least 3 points!");
|
||||
|
||||
Vector2d[] pointArray = new Vector2d[points];
|
||||
double segmentAngle = 2 * Math.PI / points;
|
||||
double angle = 0d;
|
||||
for (int i = 0; i < points; i++) {
|
||||
pointArray[i] = centerPos.add(Math.sin(angle) * radiusX, Math.cos(angle) * radiusY);
|
||||
angle += segmentAngle;
|
||||
}
|
||||
|
||||
return new Shape(pointArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing an ellipse.
|
||||
* @param centerX the x-position of the center of the ellipse
|
||||
* @param centerY the y-position of the center of the ellipse
|
||||
* @param radiusX the x radius of the ellipse
|
||||
* @param radiusY the y radius of the ellipse
|
||||
* @param points the amount of points used to create the ellipse (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createEllipse(double centerX, double centerY, double radiusX, double radiusY, int points) {
|
||||
return createEllipse(new Vector2d(centerX, centerY), radiusX, radiusY, points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a circle.
|
||||
* @param centerPos the center of the circle
|
||||
* @param radius the radius of the circle
|
||||
* @param points the amount of points used to create the circle (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createCircle(Vector2d centerPos, double radius, int points) {
|
||||
return createEllipse(centerPos, radius, radius, points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a circle.
|
||||
* @param centerX the x-position of the center of the circle
|
||||
* @param centerY the y-position of the center of the circle
|
||||
* @param radius the radius of the circle
|
||||
* @param points the amount of points used to create the circle (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createCircle(double centerX, double centerY, double radius, int points) {
|
||||
return createCircle(new Vector2d(centerX, centerY), radius, points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a rectangle spanning over pos1 and pos2
|
||||
* @param pos1 one corner of the rectangle
|
||||
* @param pos2 the opposite corner of the rectangle
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createRect(Vector2d pos1, Vector2d pos2) {
|
||||
Vector2d min = pos1.min(pos2);
|
||||
Vector2d max = pos1.max(pos2);
|
||||
|
||||
return new Shape(
|
||||
min,
|
||||
new Vector2d(max.getX(), min.getY()),
|
||||
max,
|
||||
new Vector2d(min.getX(), max.getY())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a rectangle spanning over two points
|
||||
* @param x1 x position of one corner of the rectangle
|
||||
* @param y1 y position of one corner of the rectangle
|
||||
* @param x2 x position of the opposite corner of the rectangle
|
||||
* @param y2 y position of the opposite corner of the rectangle
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createRect(double x1, double y1, double x2, double y2) {
|
||||
return createRect(new Vector2d(x1, y1), new Vector2d(x2, y2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing an ellipse.
|
||||
* @param centerPos the center of the ellipse
|
||||
* @param radiusX the x radius of the ellipse
|
||||
* @param radiusY the y radius of the ellipse
|
||||
* @param points the amount of points used to create the ellipse (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createEllipse(Vector2d centerPos, double radiusX, double radiusY, int points) {
|
||||
if (points < 3) throw new IllegalArgumentException("A shape has to have at least 3 points!");
|
||||
|
||||
Vector2d[] pointArray = new Vector2d[points];
|
||||
double segmentAngle = 2 * Math.PI / points;
|
||||
double angle = 0d;
|
||||
for (int i = 0; i < points; i++) {
|
||||
pointArray[i] = centerPos.add(Math.sin(angle) * radiusX, Math.cos(angle) * radiusY);
|
||||
angle += segmentAngle;
|
||||
}
|
||||
|
||||
return new Shape(pointArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing an ellipse.
|
||||
* @param centerX the x-position of the center of the ellipse
|
||||
* @param centerY the y-position of the center of the ellipse
|
||||
* @param radiusX the x radius of the ellipse
|
||||
* @param radiusY the y radius of the ellipse
|
||||
* @param points the amount of points used to create the ellipse (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createEllipse(double centerX, double centerY, double radiusX, double radiusY, int points) {
|
||||
return createEllipse(new Vector2d(centerX, centerY), radiusX, radiusY, points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a circle.
|
||||
* @param centerPos the center of the circle
|
||||
* @param radius the radius of the circle
|
||||
* @param points the amount of points used to create the circle (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createCircle(Vector2d centerPos, double radius, int points) {
|
||||
return createEllipse(centerPos, radius, radius, points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Shape} representing a circle.
|
||||
* @param centerX the x-position of the center of the circle
|
||||
* @param centerY the y-position of the center of the circle
|
||||
* @param radius the radius of the circle
|
||||
* @param points the amount of points used to create the circle (at least 3)
|
||||
* @return the created {@link Shape}
|
||||
*/
|
||||
public static Shape createCircle(double centerX, double centerY, double radius, int points) {
|
||||
return createCircle(new Vector2d(centerX, centerY), radius, points);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,112 +28,112 @@
|
||||
|
||||
public interface ShapeMarker extends ObjectMarker, DistanceRangedMarker {
|
||||
|
||||
/**
|
||||
* Getter for {@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 are the z-coordinates in the map.</p>
|
||||
* @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}.
|
||||
* <p>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.</p>
|
||||
* @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}.
|
||||
* <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 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.
|
||||
* @return <code>true</code> 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}.
|
||||
* <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 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.
|
||||
* @return <code>true</code> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,140 +38,140 @@
|
||||
*/
|
||||
public interface RenderAPI {
|
||||
|
||||
/**
|
||||
* Schedules the render of the map-tile at this block position for all maps of this world.<br>
|
||||
* If there already is a render scheduled for one of the tiles, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param world the {@link UUID} of the {@link BlueMapWorld} to render
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tiles will be rendered not only that block)
|
||||
*
|
||||
* @throws IllegalArgumentException if there is no world loaded with the provided {@link UUID}
|
||||
*/
|
||||
@Deprecated
|
||||
void render(UUID world, Vector3i blockPosition);
|
||||
/**
|
||||
* Schedules the render of the map-tile at this block position for all maps of this world.<br>
|
||||
* If there already is a render scheduled for one of the tiles, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param world the {@link UUID} of the {@link BlueMapWorld} to render
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tiles will be rendered not only that block)
|
||||
*
|
||||
* @throws IllegalArgumentException if there is no world loaded with the provided {@link UUID}
|
||||
*/
|
||||
@Deprecated
|
||||
void render(UUID world, Vector3i blockPosition);
|
||||
|
||||
/**
|
||||
* Schedules the render of the map-tile at this block position for all maps of this world.<br>
|
||||
* If there already is a render scheduled for one of the tiles, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param world the {@link BlueMapWorld} to render
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tiles will be rendered not only that block)
|
||||
*/
|
||||
@Deprecated
|
||||
default void render(BlueMapWorld world, Vector3i blockPosition) {
|
||||
for (BlueMapMap map : world.getMaps()) {
|
||||
render(map, blockPosition);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Schedules the render of the map-tile at this block position for all maps of this world.<br>
|
||||
* If there already is a render scheduled for one of the tiles, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param world the {@link BlueMapWorld} to render
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tiles will be rendered not only that block)
|
||||
*/
|
||||
@Deprecated
|
||||
default void render(BlueMapWorld world, Vector3i blockPosition) {
|
||||
for (BlueMapMap map : world.getMaps()) {
|
||||
render(map, blockPosition);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules the render of the map-tile at this block position.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param mapId the id of the {@link BlueMapMap} to render
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tile will be rendered not only that block)
|
||||
*
|
||||
* @throws IllegalArgumentException if there is no map loaded with the provided mapId
|
||||
*/
|
||||
@Deprecated
|
||||
void render(String mapId, Vector3i blockPosition);
|
||||
/**
|
||||
* Schedules the render of the map-tile at this block position.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param mapId the id of the {@link BlueMapMap} to render
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tile will be rendered not only that block)
|
||||
*
|
||||
* @throws IllegalArgumentException if there is no map loaded with the provided mapId
|
||||
*/
|
||||
@Deprecated
|
||||
void render(String mapId, Vector3i blockPosition);
|
||||
|
||||
/**
|
||||
* Schedules the render of map-tile at this block position and returns the created render-ticket.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param map the {@link BlueMapMap}
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tile will be rendered not only that block)
|
||||
*/
|
||||
@Deprecated
|
||||
default void render(BlueMapMap map, Vector3i blockPosition) {
|
||||
render(map, map.posToTile(blockPosition));
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules the render of the map-tile.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param mapId the id of the {@link BlueMapMap} to render
|
||||
* @param tile a {@link Vector2i} for the tile-position to render
|
||||
*
|
||||
* @throws IllegalArgumentException if there is no map loaded with the provided mapId
|
||||
*/
|
||||
@Deprecated
|
||||
void render(String mapId, Vector2i tile);
|
||||
/**
|
||||
* Schedules the render of map-tile at this block position and returns the created render-ticket.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param map the {@link BlueMapMap}
|
||||
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tile will be rendered not only that block)
|
||||
*/
|
||||
@Deprecated
|
||||
default void render(BlueMapMap map, Vector3i blockPosition) {
|
||||
render(map, map.posToTile(blockPosition));
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules the render of the map-tile.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param map the {@link BlueMapMap}
|
||||
* @param tile a {@link Vector2i} for the tile-position to render
|
||||
*/
|
||||
@Deprecated
|
||||
void render(BlueMapMap map, Vector2i tile);
|
||||
/**
|
||||
* Schedules the render of the map-tile.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param mapId the id of the {@link BlueMapMap} to render
|
||||
* @param tile a {@link Vector2i} for the tile-position to render
|
||||
*
|
||||
* @throws IllegalArgumentException if there is no map loaded with the provided mapId
|
||||
*/
|
||||
@Deprecated
|
||||
void render(String mapId, Vector2i tile);
|
||||
|
||||
/**
|
||||
* Schedules a task to update the given map.
|
||||
* @param map the map to be updated
|
||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
||||
*/
|
||||
default boolean scheduleMapUpdateTask(BlueMapMap map) {
|
||||
return scheduleMapUpdateTask(map, false);
|
||||
}
|
||||
/**
|
||||
* Schedules the render of the map-tile.<br>
|
||||
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||
*
|
||||
* @param map the {@link BlueMapMap}
|
||||
* @param tile a {@link Vector2i} for the tile-position to render
|
||||
*/
|
||||
@Deprecated
|
||||
void render(BlueMapMap map, Vector2i tile);
|
||||
|
||||
/**
|
||||
* Schedules a task to update the given map.
|
||||
* @param map the map to be updated
|
||||
* @param force it this is true, the task will forcefully re-render all tiles, even if there are no changes since the last map-update.
|
||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
||||
*/
|
||||
boolean scheduleMapUpdateTask(BlueMapMap map, boolean force);
|
||||
/**
|
||||
* Schedules a task to update the given map.
|
||||
* @param map the map to be updated
|
||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
||||
*/
|
||||
default boolean scheduleMapUpdateTask(BlueMapMap map) {
|
||||
return scheduleMapUpdateTask(map, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to update the given map.
|
||||
* @param map the map to be updated
|
||||
* @param regions The regions that should be updated ("region" refers to the coordinates of a minecraft region-file (32x32 chunks, 512x512 blocks))<br>
|
||||
* BlueMaps updating-system works based on region-files. For this reason you can always only update a whole region-file at once.
|
||||
* @param force it this is true, the task will forcefully re-render all tiles, even if there are no changes since the last map-update.
|
||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
||||
*/
|
||||
boolean scheduleMapUpdateTask(BlueMapMap map, Collection<Vector2i> regions, boolean force);
|
||||
/**
|
||||
* Schedules a task to update the given map.
|
||||
* @param map the map to be updated
|
||||
* @param force it this is true, the task will forcefully re-render all tiles, even if there are no changes since the last map-update.
|
||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
||||
*/
|
||||
boolean scheduleMapUpdateTask(BlueMapMap map, boolean force);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Schedules a task to update the given map.
|
||||
* @param map the map to be updated
|
||||
* @param regions The regions that should be updated ("region" refers to the coordinates of a minecraft region-file (32x32 chunks, 512x512 blocks))<br>
|
||||
* BlueMaps updating-system works based on region-files. For this reason you can always only update a whole region-file at once.
|
||||
* @param force it this is true, the task will forcefully re-render all tiles, even if there are no changes since the last map-update.
|
||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
||||
*/
|
||||
boolean scheduleMapUpdateTask(BlueMapMap map, Collection<Vector2i> regions, boolean force);
|
||||
|
||||
/**
|
||||
* 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 <code>true</code> 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 <code>true</code> 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();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user