mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-20 18:23:51 +00:00
[android] add support for schuko/type-E charge sockets
The commit is slightly more complicated that expected because: - it adds supports for both schuko and type-E, using the same icon (but maintaining the underlying type annotated in OSM) - it adds logic to *not* display the power of schuko socket as 'unknown' when not provided in OSM, as it is 'implicit' (3.7kW in most countries) Signed-off-by: Séverin Lemaignan <severin@guakamole.org>
This commit is contained in:
@@ -1,7 +1,33 @@
|
||||
package app.organicmaps.sdk.bookmarks.data;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* represents the details of the socket available on a particular charging station
|
||||
*
|
||||
*/
|
||||
public record ChargeSocketDescriptor(String type, int count, double power) {}
|
||||
public record ChargeSocketDescriptor(String type, int count, double power) {
|
||||
|
||||
/**
|
||||
* Some charge sockets have the same visuals as other sockets, even though they are different and are tagged
|
||||
* differently in OSM. This method returns the 'visual' type that should be used for the socket.
|
||||
*
|
||||
* @return the 'equivalent' visual style that should be used for this socket
|
||||
*/
|
||||
public String visualType() {
|
||||
if (type.equals("typee")) {
|
||||
return "schuko";
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* For some sockets (eg, domestic sockets), the power is usually not provided, as it is 'implicit'
|
||||
*
|
||||
* @return true if this socket type does not require displaying the power
|
||||
*/
|
||||
public Boolean ignorePower() {
|
||||
return type.equals("typee") || type.equals("schuko");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user