Fix failing test
This commit is contained in:
parent
e106ceef9a
commit
3e31effa80
@ -57,6 +57,21 @@ public class MapDrawFeature(
|
|||||||
MapDrawFeature(newCoordinates, zoomRange, drawFeature)
|
MapDrawFeature(newCoordinates, zoomRange, drawFeature)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//public class MapPathFeature(
|
||||||
|
// public val rectangle: GmcRectangle,
|
||||||
|
// public val path: Path,
|
||||||
|
// public val brush: Brush,
|
||||||
|
// public val style: DrawStyle = Fill,
|
||||||
|
// public val targetRect: Rect = path.getBounds(),
|
||||||
|
// override val zoomRange: IntRange = defaultZoomRange,
|
||||||
|
//) : DraggableMapFeature {
|
||||||
|
// override fun withCoordinates(newCoordinates: GeodeticMapCoordinates): MapFeature =
|
||||||
|
// MapPathFeature(rectangle.moveTo(newCoordinates), path, brush, style, targetRect, zoomRange)
|
||||||
|
//
|
||||||
|
// override fun getBoundingBox(zoom: Double): GmcRectangle = rectangle
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
public class MapPointsFeature(
|
public class MapPointsFeature(
|
||||||
public val points: List<GeodeticMapCoordinates>,
|
public val points: List<GeodeticMapCoordinates>,
|
||||||
override val zoomRange: IntRange = defaultZoomRange,
|
override val zoomRange: IntRange = defaultZoomRange,
|
||||||
@ -64,9 +79,7 @@ public class MapPointsFeature(
|
|||||||
public val color: Color = Color.Red,
|
public val color: Color = Color.Red,
|
||||||
public val pointMode: PointMode = PointMode.Points,
|
public val pointMode: PointMode = PointMode.Points,
|
||||||
) : MapFeature {
|
) : MapFeature {
|
||||||
override fun getBoundingBox(zoom: Double): GmcRectangle {
|
override fun getBoundingBox(zoom: Double): GmcRectangle = GmcRectangle(points.first(), points.last())
|
||||||
return GmcRectangle(points.first(), points.last())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapCircleFeature(
|
public class MapCircleFeature(
|
||||||
@ -118,8 +131,11 @@ public class MapArcFeature(
|
|||||||
public val arcLength: Angle,
|
public val arcLength: Angle,
|
||||||
override val zoomRange: IntRange = defaultZoomRange,
|
override val zoomRange: IntRange = defaultZoomRange,
|
||||||
public val color: Color = Color.Red,
|
public val color: Color = Color.Red,
|
||||||
) : MapFeature {
|
) : DraggableMapFeature {
|
||||||
override fun getBoundingBox(zoom: Double): GmcRectangle = oval
|
override fun getBoundingBox(zoom: Double): GmcRectangle = oval
|
||||||
|
|
||||||
|
override fun withCoordinates(newCoordinates: GeodeticMapCoordinates): MapFeature =
|
||||||
|
MapArcFeature(oval.moveTo(newCoordinates), startAngle, arcLength, zoomRange, color)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapBitmapImageFeature(
|
public class MapBitmapImageFeature(
|
||||||
|
@ -268,6 +268,7 @@ public actual fun MapView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is MapBitmapImageFeature -> drawImage(feature.image, feature.position.toOffset())
|
is MapBitmapImageFeature -> drawImage(feature.image, feature.position.toOffset())
|
||||||
|
|
||||||
is MapVectorImageFeature -> {
|
is MapVectorImageFeature -> {
|
||||||
val offset = feature.position.toOffset()
|
val offset = feature.position.toOffset()
|
||||||
val size = feature.size.toSize()
|
val size = feature.size.toSize()
|
||||||
@ -302,6 +303,14 @@ public actual fun MapView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is MapPathFeature -> {
|
||||||
|
// val offset = feature.rectangle.center.toOffset() - feature.targetRect.center
|
||||||
|
// translate(offset.x, offset.y) {
|
||||||
|
// sca
|
||||||
|
// drawPath(feature.path, brush = feature.brush, style = feature.style)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
is MapPointsFeature -> {
|
is MapPointsFeature -> {
|
||||||
val points = feature.points.map { it.toOffset() }
|
val points = feature.points.map { it.toOffset() }
|
||||||
drawPoints(
|
drawPoints(
|
||||||
@ -312,9 +321,9 @@ public actual fun MapView(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
// else -> {
|
||||||
logger.error { "Unrecognized feature type: ${feature::class}" }
|
// logger.error { "Unrecognized feature type: ${feature::class}" }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ public data class GmcRectangle(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public fun GmcRectangle.moveTo(newCenter: Gmc): GmcRectangle = GmcRectangle.square(newCenter, height = latitudeDelta, width = longitudeDelta)
|
||||||
|
|
||||||
public val GmcRectangle.center: GeodeticMapCoordinates
|
public val GmcRectangle.center: GeodeticMapCoordinates
|
||||||
get() = GeodeticMapCoordinates(
|
get() = GeodeticMapCoordinates(
|
||||||
(a.latitude + b.latitude) / 2,
|
(a.latitude + b.latitude) / 2,
|
||||||
|
@ -20,7 +20,7 @@ internal class DistanceTest {
|
|||||||
val distance = curve.distance
|
val distance = curve.distance
|
||||||
|
|
||||||
assertEquals(632.035426877, distance.kilometers, 0.0001)
|
assertEquals(632.035426877, distance.kilometers, 0.0001)
|
||||||
assertEquals((-0.6947937116552751).radians, curve.forward.bearing)
|
assertEquals(-0.6947937116552751, curve.forward.bearing.radians.value, 0.0001)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user