mirror of
https://github.com/BlueMap-Minecraft/BlueMapAPI.git
synced 2025-01-07 08:37:45 +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.
|
* 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 {
|
public abstract class BlueMapAPI {
|
||||||
private static BlueMapAPI instance;
|
private static BlueMapAPI instance;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private static final Collection<BlueMapAPIListener> listener = new HashSet<>(2);
|
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);
|
|
||||||
|
|
||||||
/**
|
private static final Collection<Consumer<BlueMapAPI>> onEnableConsumers = new HashSet<>(2);
|
||||||
* Getter for the {@link RenderAPI}.
|
private static final Collection<Consumer<BlueMapAPI>> onDisableConsumers = new HashSet<>(2);
|
||||||
* @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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all images that are available. This includes all images previously created with the {@link #createImage(BufferedImage, String)}
|
* Getter for the {@link RenderAPI}.
|
||||||
* function, but might include more.
|
* @return the {@link RenderAPI}
|
||||||
* @return A map of available images where:
|
*/
|
||||||
* <ul>
|
public abstract RenderAPI getRenderAPI();
|
||||||
* <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 configured web-root folder
|
* Getter for the {@link MarkerAPI}.<br>
|
||||||
* @return The {@link Path} of the web-root folder
|
* 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}
|
||||||
public abstract Path getWebRoot();
|
* @throws IOException if there was an IOException loading the marker.json
|
||||||
|
*/
|
||||||
|
public abstract MarkerAPI getMarkerAPI() throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the installed BlueMap version
|
* Getter for all {@link BlueMapMap}s loaded by BlueMap.
|
||||||
* @return the version-string
|
* @return an unmodifiable collection of all loaded {@link BlueMapMap}s
|
||||||
*/
|
*/
|
||||||
public abstract String getBlueMapVersion();
|
public abstract Collection<BlueMapMap> getMaps();
|
||||||
|
|
||||||
/**
|
|
||||||
* 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>
|
* Getter for all {@link BlueMapWorld}s loaded by BlueMap.
|
||||||
* If {@link BlueMapAPI} is already enabled when this listener is registered the consumer will be called immediately <i>(once, on the same thread)</i>!
|
* @return an unmodifiable collection of all loaded {@link BlueMapWorld}s
|
||||||
* <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>
|
public abstract Collection<BlueMapWorld> getWorlds();
|
||||||
* <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)}.
|
* Getter for a {@link BlueMapWorld} loaded by BlueMap with the given {@link UUID}.
|
||||||
* @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
|
* <p><i>See the documentation of {@link BlueMapWorld#getUuid()} for more information about the nature of the worlds {@link UUID}s!</i></p>
|
||||||
*/
|
*
|
||||||
public static synchronized boolean unregisterListener(Consumer<BlueMapAPI> consumer) {
|
* @see BlueMapWorld#getUuid()
|
||||||
return onEnableConsumers.remove(consumer) | onDisableConsumers.remove(consumer);
|
*
|
||||||
}
|
* @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.
|
* Getter for a {@link BlueMapMap} loaded by BlueMap with the given id.
|
||||||
* @param instance the {@link BlueMapAPI}-instance
|
* @param id the map id (equivalent to the id configured in BlueMap's config
|
||||||
* @return <code>true</code> if the instance has been registered, <code>false</code> if there already was an instance registered
|
* @return an {@link Optional} with the {@link BlueMapMap} if it exists
|
||||||
* @throws ExecutionException if a {@link BlueMapAPIListener} threw an exception during the registration
|
*/
|
||||||
*/
|
public abstract Optional<BlueMapMap> getMap(String id);
|
||||||
@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);
|
/**
|
||||||
|
* 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).
|
||||||
for (Consumer<BlueMapAPI> listener : BlueMapAPI.onEnableConsumers) {
|
*
|
||||||
try {
|
* <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>
|
||||||
listener.accept(BlueMapAPI.instance);
|
* <p>If the image file with the given path already exists, it will be replaced.</p>
|
||||||
} catch (Throwable ex) {
|
*
|
||||||
thrownExceptions.add(ex);
|
* @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
|
||||||
// backwards compatibility
|
* @throws IOException If an {@link IOException} is thrown while writing the image
|
||||||
for (BlueMapAPIListener listener : BlueMapAPI.listener) {
|
*/
|
||||||
try {
|
public abstract String createImage(BufferedImage image, String path) throws IOException;
|
||||||
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;
|
/**
|
||||||
}
|
* 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:
|
||||||
* Used by BlueMap to unregister the API and call the listeners properly.
|
* <ul>
|
||||||
* @param instance the {@link BlueMapAPI} instance
|
* <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>
|
||||||
* @return <code>true</code> if the instance was unregistered, <code>false</code> if there was no or an other instance registered
|
* <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>
|
||||||
* @throws ExecutionException if a {@link BlueMapAPIListener} threw an exception during the un-registration
|
* </ul>
|
||||||
*/
|
* @throws IOException If an {@link IOException} is thrown while reading the images
|
||||||
@SuppressWarnings("deprecation")
|
*/
|
||||||
protected static synchronized boolean unregisterInstance(BlueMapAPI instance) throws ExecutionException {
|
public abstract Map<String, String> availableImages() throws IOException;
|
||||||
if (BlueMapAPI.instance != instance) return false;
|
|
||||||
|
|
||||||
List<Exception> thrownExceptions = new ArrayList<>(0);
|
/**
|
||||||
|
* Getter for the configured web-root folder
|
||||||
for (Consumer<BlueMapAPI> listener : BlueMapAPI.onDisableConsumers) {
|
* @return The {@link Path} of the web-root folder
|
||||||
try {
|
*/
|
||||||
listener.accept(BlueMapAPI.instance);
|
public abstract Path getWebRoot();
|
||||||
} catch (Exception ex) {
|
|
||||||
thrownExceptions.add(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// backwards compatibility
|
/**
|
||||||
for (BlueMapAPIListener listener : BlueMapAPI.listener) {
|
* Getter for the installed BlueMap version
|
||||||
try {
|
* @return the version-string
|
||||||
listener.onDisable(BlueMapAPI.instance);
|
*/
|
||||||
} catch (Exception ex) {
|
public abstract String getBlueMapVersion();
|
||||||
thrownExceptions.add(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BlueMapAPI.instance = null;
|
|
||||||
|
|
||||||
if (!thrownExceptions.isEmpty()) {
|
/**
|
||||||
ExecutionException ex = new ExecutionException(thrownExceptions.get(0));
|
* Register a listener that will be called when the API enables/disables
|
||||||
for (int i = 1; i < thrownExceptions.size(); i++) {
|
* @param listener the {@link BlueMapAPIListener}
|
||||||
ex.addSuppressed(thrownExceptions.get(i));
|
*
|
||||||
}
|
* @deprecated Implementing {@link BlueMapAPIListener} can cause a ClassNotFoundException when you soft-depend on BlueMap and your plugin/mod gets used without BlueMap.
|
||||||
throw ex;
|
* Use {@link BlueMapAPI#onEnable(Consumer)} and {@link BlueMapAPI#onDisable(Consumer)} instead.
|
||||||
}
|
*/
|
||||||
|
@Deprecated
|
||||||
return true;
|
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
|
@Deprecated
|
||||||
public interface BlueMapAPIListener {
|
public interface BlueMapAPIListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when BlueMap has been loaded and started and the API is ready to use.<br>
|
* 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>!
|
* 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>
|
* <p><i>(Note: This method will likely be called asynchronously, <b>not</b> on the server-thread!</i></p>
|
||||||
* @param blueMapApi the {@link BlueMapAPI}
|
* @param blueMapApi the {@link BlueMapAPI}
|
||||||
*/
|
*/
|
||||||
default void onEnable(BlueMapAPI 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>
|
* 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.
|
* 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>
|
* <p><i>(Note: This method will likely be called asynchronously, <b>not</b> on the server-thread!</i></p>
|
||||||
* @param blueMapApi the {@link BlueMapAPI}
|
* @param blueMapApi the {@link BlueMapAPI}
|
||||||
*/
|
*/
|
||||||
default void onDisable(BlueMapAPI blueMapApi) {}
|
default void onDisable(BlueMapAPI blueMapApi) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,99 +37,99 @@
|
|||||||
*/
|
*/
|
||||||
public interface BlueMapMap {
|
public interface BlueMapMap {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this maps id, this is equal to the id configured in bluemap's config for this map.
|
* Returns this maps id, this is equal to the id configured in bluemap's config for this map.
|
||||||
* @return the id of this map
|
* @return the id of this map
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this maps display-name, this is equal to the name configured in bluemap's config for this map.
|
* 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
|
* @return the name of this map
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for the {@link BlueMapWorld} of this map.
|
|
||||||
* @return the {@link BlueMapWorld} of this map
|
|
||||||
*/
|
|
||||||
BlueMapWorld getWorld();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the size of all tiles on this map in blocks.
|
* Getter for the {@link BlueMapWorld} of this map.
|
||||||
* @return the tile-size in blocks
|
* @return the {@link BlueMapWorld} of this map
|
||||||
*/
|
*/
|
||||||
Vector2i getTileSize();
|
BlueMapWorld getWorld();
|
||||||
|
|
||||||
/**
|
|
||||||
* 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();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Sets a filter that determines if a specific (hires) tile of this map should be updated or not.
|
* Getter for the size of all tiles on this map in blocks.
|
||||||
* 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>
|
* @return the tile-size in blocks
|
||||||
* <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>
|
Vector2i getTileSize();
|
||||||
* @param filter The filter that will be used from now on.
|
|
||||||
*/
|
|
||||||
void setTileFilter(Predicate<Vector2i> filter);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freezes or unfreezes the map in the same way the `/bluemap freeze` command does.
|
* Getter for the offset of the tile-grid on this map.<br>
|
||||||
* BlueMap will no longer attempt to update this map if it is frozen.
|
* E.g. an offset of (2|-1) would mean that the tile (0|0) has block (2|0|-1) at it's min-corner.
|
||||||
* @param frozen Whether the map will be frozen or not
|
* @return the tile-offset in blocks
|
||||||
*/
|
*/
|
||||||
void setFrozen(boolean frozen);
|
Vector2i getTileOffset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the map is currently frozen
|
* <p>Sets a filter that determines if a specific (hires) tile of this map should be updated or not.
|
||||||
* @return true if the map is frozen, false otherwise
|
* 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>
|
||||||
boolean isFrozen();
|
* <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>.
|
* 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.
|
||||||
Predicate<Vector2i> getTileFilter();
|
* @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
|
* Checks if the map is currently frozen
|
||||||
*
|
* @return true if the map is frozen, false otherwise
|
||||||
* @param blockX the x-position of the block
|
*/
|
||||||
* @param blockZ the z-position of the block
|
boolean isFrozen();
|
||||||
* @return the tile position
|
|
||||||
*/
|
/**
|
||||||
default Vector2i posToTile(double blockX, double blockZ){
|
* Returns the currently set TileFilter. The default TileFilter is equivalent to <code>t -> true</code>.
|
||||||
Vector2i offset = getTileOffset();
|
*/
|
||||||
Vector2i size = getTileSize();
|
Predicate<Vector2i> getTileFilter();
|
||||||
|
|
||||||
return Vector2i.from(
|
/**
|
||||||
(int) Math.floor((blockX - offset.getX()) / size.getX()),
|
* Converts a block-position to a map-tile-coordinate for this map
|
||||||
(int) Math.floor((blockZ - offset.getY()) / size.getY())
|
*
|
||||||
);
|
* @param blockX the x-position of the block
|
||||||
}
|
* @param blockZ the z-position of the block
|
||||||
|
* @return the tile position
|
||||||
/**
|
*/
|
||||||
* Converts a block-position to a map-tile-coordinate for this map
|
default Vector2i posToTile(double blockX, double blockZ){
|
||||||
*
|
Vector2i offset = getTileOffset();
|
||||||
* @param pos the position of the block
|
Vector2i size = getTileSize();
|
||||||
* @return the tile position
|
|
||||||
*/
|
return Vector2i.from(
|
||||||
default Vector2i posToTile(Vector3i pos){
|
(int) Math.floor((blockX - offset.getX()) / size.getX()),
|
||||||
return posToTile(pos.getX(), pos.getZ());
|
(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 {
|
public interface BlueMapWorld {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the {@link UUID} of the world.</p>
|
* <p>Getter for the {@link UUID} of the world.</p>
|
||||||
* <p>
|
* <p>
|
||||||
* The {@link UUID}s of this worlds are <b>not</b> guaranteed to be consistent across reloads/restarts!
|
* The {@link UUID}s of this worlds are <b>not</b> guaranteed to be consistent across reloads/restarts!
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* <b>Implementation notes:</b><br>
|
* <b>Implementation notes:</b><br>
|
||||||
* The used UUID highly depends on the implementation
|
* The used UUID highly depends on the implementation
|
||||||
* </p>
|
* </p>
|
||||||
* <table>
|
* <table>
|
||||||
* <caption>Implementations</caption>
|
* <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>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>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>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>
|
* <tr><th>CLI</th><td>The UUID is randomly generated, and changes on each reload/restart</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*
|
*
|
||||||
* @return the {@link UUID} of the world
|
* @return the {@link UUID} of the world
|
||||||
*/
|
*/
|
||||||
UUID getUuid();
|
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> ).
|
* 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.
|
* @return the save-folder of this world.
|
||||||
*/
|
*/
|
||||||
Path getSaveFolder();
|
Path getSaveFolder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for all {@link BlueMapMap}s for this world
|
* Getter for all {@link BlueMapMap}s for this world
|
||||||
* @return an unmodifiable {@link Collection} of all {@link BlueMapMap}s for this world
|
* @return an unmodifiable {@link Collection} of all {@link BlueMapMap}s for this world
|
||||||
*/
|
*/
|
||||||
Collection<BlueMapMap> getMaps();
|
Collection<BlueMapMap> getMaps();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,36 +26,36 @@
|
|||||||
|
|
||||||
public interface DistanceRangedMarker extends Marker {
|
public interface DistanceRangedMarker extends Marker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the minimum distance of the camera to the position for this {@link Marker} to be displayed.<br>
|
* 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!
|
* 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
|
* @return the minimum distance for this {@link Marker} to be displayed
|
||||||
*/
|
*/
|
||||||
double getMinDistance();
|
double getMinDistance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the minimum distance of the camera to the position of the {@link Marker} for it to be displayed.<br>
|
* 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!
|
* If the camera is closer to this {@link Marker} than this distance, it will be hidden!
|
||||||
*
|
*
|
||||||
* @param minDistance the new minimum distance
|
* @param minDistance the new minimum distance
|
||||||
*/
|
*/
|
||||||
void setMinDistance(double minDistance);
|
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>
|
* 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!
|
* 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
|
* @return the maximum distance for this {@link Marker} to be displayed
|
||||||
*/
|
*/
|
||||||
double getMaxDistance();
|
double getMaxDistance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum distance of the camera to the position of the {@link Marker} for it to be displayed.<br>
|
* 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!
|
* If the camera is further to this {@link Marker} than this distance, it will be hidden!
|
||||||
*
|
*
|
||||||
* @param maxDistance the new maximum distance
|
* @param maxDistance the new maximum distance
|
||||||
*/
|
*/
|
||||||
void setMaxDistance(double maxDistance);
|
void setMaxDistance(double maxDistance);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,95 +28,95 @@
|
|||||||
|
|
||||||
public interface ExtrudeMarker extends ObjectMarker, DistanceRangedMarker {
|
public interface ExtrudeMarker extends ObjectMarker, DistanceRangedMarker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for {@link Shape} of this {@link ExtrudeMarker}.
|
* 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>
|
* <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}
|
* @return the {@link Shape}
|
||||||
*/
|
*/
|
||||||
Shape getShape();
|
Shape getShape();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the minimum height (y-coordinate) of where the shape is displayed on the map.<br>
|
* 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>
|
* <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
|
* @return the min-height of the shape on the map
|
||||||
*/
|
*/
|
||||||
float getShapeMinY();
|
float getShapeMinY();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the maximum height (y-coordinate) of where the shape is displayed on the map.
|
* 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>
|
* <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
|
* @return the max-height of the shape on the map
|
||||||
*/
|
*/
|
||||||
float getShapeMaxY();
|
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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* Sets the {@link Shape} of this {@link ExtrudeMarker}.
|
||||||
* @return <code>true</code> if the depthTest is enabled
|
* <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>
|
||||||
boolean isDepthTestEnabled();
|
* @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
|
||||||
* 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 setShape(Shape shape, float minY, float maxY);
|
||||||
*/
|
|
||||||
void setDepthTestEnabled(boolean enabled);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the width of the lines of this {@link ExtrudeMarker}.
|
* 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 the width of the lines in pixels
|
* @return <code>true</code> if the depthTest is enabled
|
||||||
*/
|
*/
|
||||||
int getLineWidth();
|
boolean isDepthTestEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the width of the lines for this {@link ExtrudeMarker}.
|
* 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 width the new width in pixels
|
* @param enabled if the depth-test should be enabled for this {@link ExtrudeMarker}
|
||||||
*/
|
*/
|
||||||
void setLineWidth(int width);
|
void setDepthTestEnabled(boolean enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the {@link Color} of the border-line of the shape.
|
* Getter for the width of the lines of this {@link ExtrudeMarker}.
|
||||||
* @return the line-color
|
* @return the width of the lines in pixels
|
||||||
*/
|
*/
|
||||||
Color getLineColor();
|
int getLineWidth();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link Color} of the border-line of the shape.
|
* Sets the width of the lines for this {@link ExtrudeMarker}.
|
||||||
* @param color the new line-color
|
* @param width the new width in pixels
|
||||||
*/
|
*/
|
||||||
void setLineColor(Color color);
|
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 {
|
public interface HtmlMarker extends Marker, DistanceRangedMarker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the position (in pixels) where the html-element is anchored to the map.
|
* Getter for the position (in pixels) where the html-element is anchored to the map.
|
||||||
* @return the anchor-position in pixels
|
* @return the anchor-position in pixels
|
||||||
*/
|
*/
|
||||||
Vector2i getAnchor();
|
Vector2i getAnchor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the position (in pixels) where the html-element is anchored to the map.
|
* Sets the position (in pixels) where the html-element is anchored to the map.
|
||||||
* @param anchor the anchor-position in pixels
|
* @param anchor the anchor-position in pixels
|
||||||
*/
|
*/
|
||||||
void setAnchor(Vector2i anchor);
|
void setAnchor(Vector2i anchor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the position (in pixels) where the html-element is anchored to the map.
|
* Sets the position (in pixels) where the html-element is anchored to the map.
|
||||||
* @param x the anchor-x-position in pixels
|
* @param x the anchor-x-position in pixels
|
||||||
* @param y the anchor-y-position in pixels
|
* @param y the anchor-y-position in pixels
|
||||||
*/
|
*/
|
||||||
default void setAnchor(int x, int y) {
|
default void setAnchor(int x, int y) {
|
||||||
setAnchor(new Vector2i(x, y));
|
setAnchor(new Vector2i(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the html-code of this HTML marker
|
* Getter for the html-code of this HTML marker
|
||||||
* @return the html-code
|
* @return the html-code
|
||||||
*/
|
*/
|
||||||
String getHtml();
|
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 {
|
public class Line {
|
||||||
|
|
||||||
private final Vector3d[] points;
|
private final Vector3d[] points;
|
||||||
private Vector3d min = null;
|
private Vector3d min = null;
|
||||||
private Vector3d max = 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 {
|
public interface LineMarker extends ObjectMarker, DistanceRangedMarker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for {@link Line} of this {@link LineMarker}.
|
* Getter for {@link Line} of this {@link LineMarker}.
|
||||||
* @return the {@link Line}
|
* @return the {@link Line}
|
||||||
*/
|
*/
|
||||||
Line getLine();
|
Line getLine();
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the {@link Line} of this {@link LineMarker}.
|
|
||||||
* @param line the new {@link Line}
|
|
||||||
*/
|
|
||||||
void setLine(Line line);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* Sets the {@link Line} of this {@link LineMarker}.
|
||||||
* @return <code>true</code> if the depthTest is enabled
|
* @param line the new {@link Line}
|
||||||
*/
|
*/
|
||||||
boolean isDepthTestEnabled();
|
void setLine(Line line);
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 width of the lines of this {@link LineMarker}.
|
* 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 the width of the lines in pixels
|
* @return <code>true</code> if the depthTest is enabled
|
||||||
*/
|
*/
|
||||||
int getLineWidth();
|
boolean isDepthTestEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the width of the lines for this {@link LineMarker}.
|
* 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 width the new width in pixels
|
* @param enabled if the depth-test should be enabled for this {@link LineMarker}
|
||||||
*/
|
*/
|
||||||
void setLineWidth(int width);
|
void setDepthTestEnabled(boolean enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the {@link Color} of the border-line of the shape.
|
* Getter for the width of the lines of this {@link LineMarker}.
|
||||||
* @return the line-color
|
* @return the width of the lines in pixels
|
||||||
*/
|
*/
|
||||||
Color getLineColor();
|
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 {
|
public interface LinkMarker extends Marker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the link-address of this {@link Marker}.<br>
|
* 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.
|
* 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
|
* @return the {@link Optional} link
|
||||||
*/
|
*/
|
||||||
Optional<String> getLink();
|
Optional<String> getLink();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this is <code>true</code> the link ({@link #getLink()}) will be opened in a new tab.
|
* 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
|
* @return whether the link will be opened in a new tab
|
||||||
* @see #getLink()
|
* @see #getLink()
|
||||||
*/
|
*/
|
||||||
boolean isNewTab();
|
boolean isNewTab();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the link-address of this {@link Marker}.<br>
|
* 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.
|
* 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 link the link, or <code>null</code> to disable the link
|
||||||
* @param newTab whether the link should be opened in a new tab
|
* @param newTab whether the link should be opened in a new tab
|
||||||
*/
|
*/
|
||||||
void setLink(String link, boolean newTab);
|
void setLink(String link, boolean newTab);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the link of this {@link Marker}.
|
* Removes the link of this {@link Marker}.
|
||||||
*/
|
*/
|
||||||
void removeLink();
|
void removeLink();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,129 +31,129 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A marker that is displayed on one of the maps in the web-app.
|
* 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 {
|
public interface Marker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the id of this {@link Marker}.
|
* Getter for the id of this {@link Marker}.
|
||||||
* <p>The id is unique in the {@link MarkerSet} that this marker is in.</p>
|
* <p>The id is unique in the {@link MarkerSet} that this marker is in.</p>
|
||||||
* @return the id of this {@link Marker}
|
* @return the id of this {@link Marker}
|
||||||
*/
|
*/
|
||||||
String getId();
|
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 minimum distance of the camera to the position ({@link #getPosition()} of the {@link Marker} for it to be displayed.<br>
|
* Getter for the {@link BlueMapMap} this {@link Marker} lives in.
|
||||||
* If the camera is closer to this {@link Marker} than this distance, it will be hidden!
|
* @return the {@link BlueMapMap} this {@link Marker} lives in
|
||||||
*
|
*/
|
||||||
* @return the minimum distance for this {@link Marker} to be displayed
|
BlueMapMap getMap();
|
||||||
* @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>
|
* Sets the {@link BlueMapMap} this {@link Marker} lives in
|
||||||
* If the camera is closer to this {@link Marker} than this distance, it will be hidden!
|
* @param map the new {@link BlueMapMap}
|
||||||
*
|
*/
|
||||||
* @param minDistance the new minimum distance
|
void setMap(BlueMapMap map);
|
||||||
* @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>
|
* Getter for the position of where this {@link Marker} lives on the map.
|
||||||
* If the camera is further to this {@link Marker} than this distance, it will be hidden!
|
* @return the position of this {@link Marker}
|
||||||
*
|
*/
|
||||||
* @return the maximum distance for this {@link Marker} to be displayed
|
Vector3d getPosition();
|
||||||
* @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>
|
* Sets the position of where this {@link Marker} lives on the map.
|
||||||
* If the camera is further to this {@link Marker} than this distance, it will be hidden!
|
* @param position the new position
|
||||||
*
|
*/
|
||||||
* @param maxDistance the new maximum distance
|
void setPosition(Vector3d position);
|
||||||
* @deprecated Not all marker-types support this
|
|
||||||
*/
|
|
||||||
void setMaxDistance(double maxDistance);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the link-address of this {@link Marker}.<br>
|
* Getter for the label of this marker.
|
||||||
* If a link is present, this link will be followed when the user clicks on the marker in the web-app.
|
* @return the label of this {@link Marker}
|
||||||
*
|
*/
|
||||||
* @return the {@link Optional} link
|
String getLabel();
|
||||||
* @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.
|
* Sets the label of this {@link Marker}.
|
||||||
* @return whether the link will be opened in a new tab
|
* <p>
|
||||||
* @see #getLink()
|
* <b>Using html-tags in the label is possible but deprecated!</b>
|
||||||
* @deprecated Not all marker-types support this
|
* </p>
|
||||||
*/
|
* <p>
|
||||||
boolean isNewTab();
|
* <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!
|
||||||
* Sets the link-address of this {@link Marker}.<br>
|
* </p>
|
||||||
* If a link is present, this link will be followed when the user clicks on the marker in the web-app.
|
*
|
||||||
*
|
* @param label the new label for this {@link Marker}
|
||||||
* @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 setLabel(String label);
|
||||||
* @deprecated Not all marker-types support this
|
|
||||||
*/
|
/**
|
||||||
void setLink(String link, boolean newTab);
|
* 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>
|
* <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>
|
* 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>
|
||||||
* <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()
|
* @see BlueMapAPI#getMarkerAPI()
|
||||||
*/
|
*/
|
||||||
public interface MarkerAPI {
|
public interface MarkerAPI {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for an <i>unmodifiable</i> {@link Collection} containing all {@link MarkerSet}s that are currently loaded with BlueMap.
|
* 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
|
* @return a {@link Collection} with all loaded {@link MarkerSet}s
|
||||||
*/
|
*/
|
||||||
Collection<MarkerSet> getMarkerSets();
|
Collection<MarkerSet> getMarkerSets();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for a loaded {@link MarkerSet} with the given id.<br>
|
* 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.
|
* Returns an empty {@link Optional} if no {@link MarkerSet} with that id is loaded.
|
||||||
*
|
*
|
||||||
* @param id the id of the {@link MarkerSet}
|
* @param id the id of the {@link MarkerSet}
|
||||||
* @return an {@link Optional}<{@link MarkerSet}> with the given id
|
* @return an {@link Optional}<{@link MarkerSet}> with the given id
|
||||||
*/
|
*/
|
||||||
Optional<MarkerSet> getMarkerSet(String id);
|
Optional<MarkerSet> getMarkerSet(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created a new {@link MarkerSet} with the given id.<br>
|
* 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.
|
* 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}
|
* @param id the id of the {@link MarkerSet}
|
||||||
* @return a {@link MarkerSet} with the given id
|
* @return a {@link MarkerSet} with the given id
|
||||||
*/
|
*/
|
||||||
MarkerSet createMarkerSet(String id);
|
MarkerSet createMarkerSet(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the given {@link MarkerSet}.<br>
|
* Removes the given {@link MarkerSet}.<br>
|
||||||
* This is equivalent to calling <code>removeMarkerSet(markerSet.getId())</code>.
|
* This is equivalent to calling <code>removeMarkerSet(markerSet.getId())</code>.
|
||||||
*
|
*
|
||||||
* @param markerSet the {@link MarkerSet} to be removed
|
* @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
|
* @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) {
|
default boolean removeMarkerSet(MarkerSet markerSet) {
|
||||||
return removeMarkerSet(markerSet.getId());
|
return removeMarkerSet(markerSet.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the {@link MarkerSet} with the given id.
|
* Removes the {@link MarkerSet} with the given id.
|
||||||
*
|
*
|
||||||
* @param id the id of the {@link MarkerSet} to be removed
|
* @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
|
* @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);
|
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>
|
* 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!
|
* 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>
|
* @throws IOException if an {@link IOException} occurred while loading the <code>markers.json</code>
|
||||||
*/
|
*/
|
||||||
void load() throws IOException;
|
void load() throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves all changes made with this instance to the <code>markers.json</code>.<br>
|
* 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>
|
* @throws IOException if an {@link IOException} occurred while saving the <code>markers.json</code>
|
||||||
*/
|
*/
|
||||||
void save() throws IOException;
|
void save() throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,313 +33,313 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A set of {@link Marker}s that are displayed on the maps in the web-app.
|
* 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 {
|
public interface MarkerSet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the id of this {@link MarkerSet}.
|
* Getter for the id of this {@link MarkerSet}.
|
||||||
* @return the id of this {@link MarkerSet}
|
* @return the id of this {@link MarkerSet}
|
||||||
*/
|
*/
|
||||||
String getId();
|
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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated method name has a typo, use {@link #isDefaultHidden()} instead.
|
* 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>
|
||||||
default boolean isDefautHidden() {
|
* @return the label of this {@link MarkerSet}
|
||||||
return isDefaultHidden();
|
*/
|
||||||
}
|
String getLabel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this {@link MarkerSet} is hidden by default.
|
* Sets the label of this {@link MarkerSet}.
|
||||||
* <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>
|
* <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
|
||||||
* @return whether this {@link MarkerSet} is hidden by default
|
*/
|
||||||
* @see #isToggleable()
|
void setLabel(String label);
|
||||||
*/
|
|
||||||
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>
|
* Checks if the {@link MarkerSet} is toggleable.
|
||||||
* If a Marker with that id already exists, it will be replaced by the new {@link POIMarker}!
|
* <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
|
||||||
* @param id the id of the new marker
|
*/
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
boolean isToggleable();
|
||||||
* @param position the position of the new marker
|
|
||||||
* @return the created {@link POIMarker}
|
/**
|
||||||
*/
|
* Changes if this {@link MarkerSet} is toggleable.
|
||||||
POIMarker createPOIMarker(String id, BlueMapMap map, Vector3d position);
|
* <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
|
||||||
/**
|
*/
|
||||||
* Creates a {@link POIMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
void setToggleable(boolean toggleable);
|
||||||
* 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
|
* @deprecated method name has a typo, use {@link #isDefaultHidden()} instead.
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
*/
|
||||||
* @param posX the x-position of the new marker
|
default boolean isDefautHidden() {
|
||||||
* @param posY the y-position of the new marker
|
return isDefaultHidden();
|
||||||
* @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) {
|
* Checks if this {@link MarkerSet} is hidden by default.
|
||||||
return createPOIMarker(id, map, new Vector3d(posX, posY, posZ));
|
* <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>
|
* 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}!
|
* 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 id the id of the new marker
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
* @param map the {@link BlueMapMap} of the new marker
|
||||||
* @param position the position of the new marker
|
* @param position the position of the new marker
|
||||||
* @param html the html-content of the new marker
|
* @param html the html-content of the new marker
|
||||||
* @return the created {@link HtmlMarker}
|
* @return the created {@link HtmlMarker}
|
||||||
*/
|
*/
|
||||||
HtmlMarker createHtmlMarker(String id, BlueMapMap map, Vector3d position, String html);
|
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>
|
* 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}!
|
* 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 id the id of the new marker
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
* @param map the {@link BlueMapMap} of the new marker
|
||||||
* @param posX the x-position of the new marker
|
* @param posX the x-position of the new marker
|
||||||
* @param posY the y-position of the new marker
|
* @param posY the y-position of the new marker
|
||||||
* @param posZ the z-position of the new marker
|
* @param posZ the z-position of the new marker
|
||||||
* @param html the html-content of the new marker
|
* @param html the html-content of the new marker
|
||||||
* @return the created {@link HtmlMarker}
|
* @return the created {@link HtmlMarker}
|
||||||
*/
|
*/
|
||||||
default HtmlMarker createHtmlMarker(String id, BlueMapMap map, double posX, double posY, double posZ, String html) {
|
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);
|
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 ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
* 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 ExtrudeMarker}!
|
* 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>
|
* <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 id the id of the new marker
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
* @param map the {@link BlueMapMap} of the new marker
|
||||||
* @param position the position 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 shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, 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 y the height (y-position on the map) of shape of the marker (See: {@link ShapeMarker#setShape(Shape, 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 ShapeMarker}
|
||||||
* @return the created {@link ExtrudeMarker}
|
*/
|
||||||
*/
|
ShapeMarker createShapeMarker(String id, BlueMapMap map, Vector3d position, Shape shape, float y);
|
||||||
ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, Vector3d position, Shape shape, float minY, float maxY);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link ExtrudeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
|
* 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 ExtrudeMarker}!
|
* 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>
|
* <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 id the id of the new marker
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
* @param map the {@link BlueMapMap} of the new marker
|
||||||
* @param posX the x-position of the new marker
|
* @param posX the x-position of the new marker
|
||||||
* @param posY the y-position of the new marker
|
* @param posY the y-position of the new marker
|
||||||
* @param posZ the z-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 shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, 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 y the height (y-position on the map) of shape of the marker (See: {@link ShapeMarker#setShape(Shape, 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 ShapeMarker}
|
||||||
* @return the created {@link ExtrudeMarker}
|
*/
|
||||||
*/
|
default ShapeMarker createShapeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape, float y) {
|
||||||
default ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape, float minY, float maxY) {
|
return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape, y);
|
||||||
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>
|
* 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 ExtrudeMarker}!
|
* 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>
|
* <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 id the id of the new marker
|
||||||
* @param map the {@link BlueMapMap} 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 shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, 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 y the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, 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 ShapeMarker}
|
||||||
* @return the created {@link ExtrudeMarker}
|
*/
|
||||||
*/
|
default ShapeMarker createShapeMarker(String id, BlueMapMap map, Shape shape, float y) {
|
||||||
default ExtrudeMarker createExtrudeMarker(String id, BlueMapMap map, Shape shape, float minY, float maxY) {
|
Vector2d center = shape.getMin().add(shape.getMax()).div(2);
|
||||||
Vector2d center = shape.getMin().add(shape.getMax()).div(2f);
|
return createShapeMarker(id, map, new Vector3d(center.getX(), y, center.getY()), shape, y);
|
||||||
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>
|
* 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 LineMarker}!
|
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||||
*
|
*
|
||||||
* <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>
|
* <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 id the id of the new marker
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
* @param map the {@link BlueMapMap} of the new marker
|
||||||
* @param position the position 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)})
|
* @param shape the {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)})
|
||||||
* @return the created {@link LineMarker}
|
* @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)})
|
||||||
LineMarker createLineMarker(String id, BlueMapMap map, Vector3d position, Line line);
|
* @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>
|
* 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 LineMarker}!
|
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ExtrudeMarker}!
|
||||||
*
|
*
|
||||||
* <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>
|
* <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 id the id of the new marker
|
||||||
* @param map the {@link BlueMapMap} of the new marker
|
* @param map the {@link BlueMapMap} of the new marker
|
||||||
* @param posX the x-position of the new marker
|
* @param posX the x-position of the new marker
|
||||||
* @param posY the y-position of the new marker
|
* @param posY the y-position of the new marker
|
||||||
* @param posZ the z-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)})
|
* @param shape the {@link Shape} of the marker (See: {@link ExtrudeMarker#setShape(Shape, float, float)})
|
||||||
* @return the created {@link LineMarker}
|
* @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)})
|
||||||
default LineMarker createLineMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Line line) {
|
* @return the created {@link ExtrudeMarker}
|
||||||
return createLineMarker(id, map, new Vector3d(posX, posY, posZ), line);
|
*/
|
||||||
}
|
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 {
|
public interface ObjectMarker extends Marker, LinkMarker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the detail of this marker. The label can include html-tags.
|
* Getter for the detail of this marker. The label can include html-tags.
|
||||||
* @return the detail of this {@link ObjectMarker}
|
* @return the detail of this {@link ObjectMarker}
|
||||||
*/
|
*/
|
||||||
String getDetail();
|
String getDetail();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the detail of this {@link ObjectMarker}. The detail can include html-tags.<br>
|
* 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.
|
* This is the text that will be displayed on the popup when you click on this marker.
|
||||||
* <p>
|
* <p>
|
||||||
* <b>Important:</b><br>
|
* <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>
|
* 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!
|
* 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>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param detail the new detail for this {@link ObjectMarker}
|
* @param detail the new detail for this {@link ObjectMarker}
|
||||||
*/
|
*/
|
||||||
void setDetail(String detail);
|
void setDetail(String detail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,42 +30,42 @@
|
|||||||
|
|
||||||
public interface POIMarker extends Marker, DistanceRangedMarker {
|
public interface POIMarker extends Marker, DistanceRangedMarker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the relative address of the icon used to display this {@link POIMarker}
|
* Getter for the relative address of the icon used to display this {@link POIMarker}
|
||||||
* @return the relative web-address of the icon
|
* @return the relative web-address of the icon
|
||||||
*/
|
*/
|
||||||
String getIconAddress();
|
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 position (in pixels) where the icon is anchored to the map.
|
* Getter for the position (in pixels) where the icon is anchored to the map.
|
||||||
* @return the anchor-position in pixels
|
* @return the anchor-position in pixels
|
||||||
*/
|
* @deprecated Use {@link #getAnchor()} instead
|
||||||
Vector2i getAnchor();
|
*/
|
||||||
|
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 {
|
public class Shape {
|
||||||
|
|
||||||
private final Vector2d[] points;
|
private final Vector2d[] points;
|
||||||
private Vector2d min = null;
|
private Vector2d min = null;
|
||||||
private Vector2d max = null;
|
private Vector2d max = null;
|
||||||
|
|
||||||
public Shape(Vector2d... points) {
|
public Shape(Vector2d... points) {
|
||||||
if (points.length < 3) throw new IllegalArgumentException("A shape has to have at least 3 points!");
|
if (points.length < 3) throw new IllegalArgumentException("A shape has to have at least 3 points!");
|
||||||
|
|
||||||
this.points = points;
|
this.points = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the amount of points in this shape.
|
* Getter for the amount of points in this shape.
|
||||||
* @return the amount of points
|
* @return the amount of points
|
||||||
*/
|
*/
|
||||||
public int getPointCount() {
|
public int getPointCount() {
|
||||||
return points.length;
|
return points.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2d getPoint(int i) {
|
public Vector2d getPoint(int i) {
|
||||||
return points[i];
|
return points[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <b>a copy</b> of the points array.<br>
|
* Getter for <b>a copy</b> of the points array.<br>
|
||||||
* <i>(A shape is immutable once created)</i>
|
* <i>(A shape is immutable once created)</i>
|
||||||
* @return the points of this shape
|
* @return the points of this shape
|
||||||
*/
|
*/
|
||||||
public Vector2d[] getPoints() {
|
public Vector2d[] getPoints() {
|
||||||
return Arrays.copyOf(points, points.length);
|
return Arrays.copyOf(points, points.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates and returns the minimum corner of the axis-aligned-bounding-box of this shape.
|
* Calculates and returns the minimum corner of the axis-aligned-bounding-box of this shape.
|
||||||
* @return the min of the AABB of this shape
|
* @return the min of the AABB of this shape
|
||||||
*/
|
*/
|
||||||
public Vector2d getMin() {
|
public Vector2d getMin() {
|
||||||
if (this.min == null) {
|
if (this.min == null) {
|
||||||
Vector2d min = points[0];
|
Vector2d min = points[0];
|
||||||
for (int i = 1; i < points.length; i++) {
|
for (int i = 1; i < points.length; i++) {
|
||||||
min = min.min(points[i]);
|
min = min.min(points[i]);
|
||||||
}
|
}
|
||||||
this.min = min;
|
this.min = min;
|
||||||
}
|
}
|
||||||
return this.min;
|
return this.min;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates and returns the maximum corner of the axis-aligned-bounding-box of this shape.
|
* Calculates and returns the maximum corner of the axis-aligned-bounding-box of this shape.
|
||||||
* @return the max of the AABB of this shape
|
* @return the max of the AABB of this shape
|
||||||
*/
|
*/
|
||||||
public Vector2d getMax() {
|
public Vector2d getMax() {
|
||||||
if (this.max == null) {
|
if (this.max == null) {
|
||||||
Vector2d max = points[0];
|
Vector2d max = points[0];
|
||||||
for (int i = 1; i < points.length; i++) {
|
for (int i = 1; i < points.length; i++) {
|
||||||
max = max.max(points[i]);
|
max = max.max(points[i]);
|
||||||
}
|
}
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
return this.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 {
|
public interface ShapeMarker extends ObjectMarker, DistanceRangedMarker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for {@link Shape} of this {@link ShapeMarker}.
|
* 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>
|
* <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}
|
* @return the {@link Shape}
|
||||||
*/
|
*/
|
||||||
Shape getShape();
|
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 the height (y-coordinate) of where the shape is displayed on the map.
|
* Getter for the height (y-coordinate) of where the shape is displayed on the map.
|
||||||
* @return the height of the shape on the map
|
* @return the height of the shape on the map
|
||||||
*/
|
* @deprecated Use {@link #getShapeY()} instead
|
||||||
float getShapeY();
|
*/
|
||||||
|
default float getHeight() {
|
||||||
/**
|
return 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* Getter for the height (y-coordinate) of where the shape is displayed on the map.
|
||||||
* @return <code>true</code> if the depthTest is enabled
|
* @return the height of the shape on the map
|
||||||
*/
|
*/
|
||||||
boolean isDepthTestEnabled();
|
float 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.
|
|
||||||
* @param enabled if the depth-test should be enabled for this {@link ShapeMarker}
|
|
||||||
*/
|
|
||||||
void setDepthTestEnabled(boolean enabled);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the width of the border-line of this {@link ShapeMarker}.
|
* Sets the {@link Shape} of this {@link ShapeMarker}.
|
||||||
* @return the width of the line in pixels
|
* <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}
|
||||||
int getLineWidth();
|
* @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}.
|
* 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 width the new width in pixels
|
* @return <code>true</code> if the depthTest is enabled
|
||||||
*/
|
*/
|
||||||
void setLineWidth(int width);
|
boolean isDepthTestEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the {@link Color} of the border of the shape.
|
* 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 the border-color
|
* @param enabled if the depth-test should be enabled for this {@link ShapeMarker}
|
||||||
* @deprecated Use {@link #getLineColor()} instead
|
*/
|
||||||
*/
|
void setDepthTestEnabled(boolean enabled);
|
||||||
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.
|
* Getter for the width of the border-line of this {@link ShapeMarker}.
|
||||||
* @return the line-color
|
* @return the width of the line in pixels
|
||||||
*/
|
*/
|
||||||
Color getLineColor();
|
int getLineWidth();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link Color} of the border-line of the shape.
|
* Sets the width of the border-line for this {@link ShapeMarker}.
|
||||||
* @param color the new line-color
|
* @param width the new width in pixels
|
||||||
*/
|
*/
|
||||||
void setLineColor(Color color);
|
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 {
|
public interface RenderAPI {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules the render of the map-tile at this block position for all maps of this world.<br>
|
* 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.
|
* 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 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)
|
* @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}
|
* @throws IllegalArgumentException if there is no world loaded with the provided {@link UUID}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void render(UUID world, Vector3i blockPosition);
|
void render(UUID world, Vector3i blockPosition);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules the render of the map-tile at this block position for all maps of this world.<br>
|
* 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.
|
* 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 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)
|
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tiles will be rendered not only that block)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
default void render(BlueMapWorld world, Vector3i blockPosition) {
|
default void render(BlueMapWorld world, Vector3i blockPosition) {
|
||||||
for (BlueMapMap map : world.getMaps()) {
|
for (BlueMapMap map : world.getMaps()) {
|
||||||
render(map, blockPosition);
|
render(map, blockPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules the render of the map-tile at this block position.<br>
|
* 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.
|
* 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 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)
|
* @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
|
* @throws IllegalArgumentException if there is no map loaded with the provided mapId
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void render(String mapId, Vector3i blockPosition);
|
void render(String mapId, Vector3i blockPosition);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules the render of map-tile at this block position and returns the created render-ticket.<br>
|
* 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.
|
* 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 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)
|
* @param blockPosition a {@link Vector3i} for the block-position to render (the whole map-tile will be rendered not only that block)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
default void render(BlueMapMap map, Vector3i blockPosition) {
|
default void render(BlueMapMap map, Vector3i blockPosition) {
|
||||||
render(map, map.posToTile(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 the map-tile.<br>
|
* 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.
|
* 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 mapId the id of the {@link BlueMapMap} to render
|
||||||
* @param tile a {@link Vector2i} for the tile-position to render
|
* @param tile a {@link Vector2i} for the tile-position to render
|
||||||
*/
|
*
|
||||||
@Deprecated
|
* @throws IllegalArgumentException if there is no map loaded with the provided mapId
|
||||||
void render(BlueMapMap map, Vector2i tile);
|
*/
|
||||||
|
@Deprecated
|
||||||
|
void render(String mapId, Vector2i tile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a task to update the given map.
|
* Schedules the render of the map-tile.<br>
|
||||||
* @param map the map to be updated
|
* If there already is a render scheduled for the tile, a second one will <b>not</b> be created.
|
||||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
*
|
||||||
*/
|
* @param map the {@link BlueMapMap}
|
||||||
default boolean scheduleMapUpdateTask(BlueMapMap map) {
|
* @param tile a {@link Vector2i} for the tile-position to render
|
||||||
return scheduleMapUpdateTask(map, false);
|
*/
|
||||||
}
|
@Deprecated
|
||||||
|
void render(BlueMapMap map, Vector2i tile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a task to update the given map.
|
* Schedules a task to update the given map.
|
||||||
* @param map the map to be updated
|
* @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)
|
||||||
* @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) {
|
||||||
boolean scheduleMapUpdateTask(BlueMapMap map, boolean force);
|
return scheduleMapUpdateTask(map, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a task to update the given map.
|
* Schedules a task to update the given map.
|
||||||
* @param map the map to be updated
|
* @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>
|
* @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.
|
||||||
* BlueMaps updating-system works based on region-files. For this reason you can always only update a whole region-file at once.
|
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
||||||
* @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);
|
||||||
*/
|
|
||||||
boolean scheduleMapUpdateTask(BlueMapMap map, Collection<Vector2i> regions, boolean force);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a task to purge the given map.
|
* Schedules a task to update 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 updated
|
||||||
* @param map the map to be purged
|
* @param regions The regions that should be updated ("region" refers to the coordinates of a minecraft region-file (32x32 chunks, 512x512 blocks))<br>
|
||||||
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
|
* BlueMaps updating-system works based on region-files. For this reason you can always only update a whole region-file at once.
|
||||||
* @throws IOException if an IOException occurs while trying to create the task.
|
* @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 scheduleMapPurgeTask(BlueMapMap map) throws IOException;
|
*/
|
||||||
|
boolean scheduleMapUpdateTask(BlueMapMap map, Collection<Vector2i> regions, boolean force);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the current size of the render-queue.
|
* Schedules a task to purge the given map.
|
||||||
* @return the current size of the render-queue
|
* 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
|
||||||
int renderQueueSize();
|
* @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.
|
||||||
/**
|
*/
|
||||||
* Getter for the count of render threads.
|
boolean scheduleMapPurgeTask(BlueMapMap map) throws IOException;
|
||||||
* @return the count of render threads
|
|
||||||
*/
|
/**
|
||||||
int renderThreadCount();
|
* Getter for the current size of the render-queue.
|
||||||
|
* @return the current size of the render-queue
|
||||||
/**
|
*/
|
||||||
* Whether this {@link RenderAPI} is currently running or paused.
|
int renderQueueSize();
|
||||||
* @return <code>true</code> if this renderer is running
|
|
||||||
*/
|
/**
|
||||||
boolean isRunning();
|
* Getter for the count of render threads.
|
||||||
|
* @return the count of render threads
|
||||||
/**
|
*/
|
||||||
* Starts the renderer if it is not already running.
|
int renderThreadCount();
|
||||||
*/
|
|
||||||
void start();
|
/**
|
||||||
|
* 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