Make elevation optional for Gmc
This commit is contained in:
parent
9a7e086591
commit
82a1260e3f
@ -8,7 +8,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
group = "center.sciprog"
|
||||
version = "0.2.1-dev-3"
|
||||
version = "0.2.1-dev-4"
|
||||
}
|
||||
|
||||
ksciencePublish{
|
||||
|
@ -2,11 +2,13 @@ package center.sciprog.maps.coordinates
|
||||
|
||||
/**
|
||||
* Geodetic coordinated
|
||||
*
|
||||
* @param elevation is optional
|
||||
*/
|
||||
public class GeodeticMapCoordinates(
|
||||
public val latitude: Angle,
|
||||
public val longitude: Angle,
|
||||
public val elevation: Distance = 0.kilometers,
|
||||
public val elevation: Distance? = null,
|
||||
) {
|
||||
init {
|
||||
require(latitude in (-Angle.piDiv2)..(Angle.piDiv2)) { "Latitude $latitude is not in (-PI/2)..(PI/2)" }
|
||||
|
@ -37,8 +37,8 @@ internal fun JsonElement.toGmc() = jsonArray.run {
|
||||
internal fun Gmc.toJsonArray(): JsonArray = buildJsonArray {
|
||||
add(longitude.degrees.value)
|
||||
add(latitude.degrees.value)
|
||||
if (elevation.kilometers != 0.0) {
|
||||
add(elevation.meters)
|
||||
elevation?.let {
|
||||
add(it.meters)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ class XYViewScope(
|
||||
(canvasSize.width / 2 + (x.dp - viewPoint.focus.x.dp) * viewPoint.zoom),
|
||||
(canvasSize.height / 2 + (viewPoint.focus.y.dp - y.dp) * viewPoint.zoom)
|
||||
)
|
||||
|
||||
override fun computeViewPoint(rectangle: Rectangle<XY>): ViewPoint<XY> {
|
||||
val scale = min(
|
||||
canvasSize.width.value / rectangle.width,
|
||||
|
Loading…
Reference in New Issue
Block a user