Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longitude and latitude to detection response #149

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class AlarmController(
)
.toString(),
annotations = emptyList(),
longitude = camera.longitude.toBigDecimal(),
latitude = camera.latitude.toBigDecimal(),
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.servlet.support.ServletUriComponentsBuilder
import java.math.BigDecimal
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
Expand Down Expand Up @@ -169,7 +170,9 @@ class DetectionController(
type = it.type,
value = it.value,
imageSrc = storageService.uri(it.snapshotImageId).toString(),
annotations = annotations
annotations = annotations,
longitude = it.snapshot.camera.longitude.toBigDecimal(),
latitude = it.snapshot.camera.latitude.toBigDecimal(),
)
)
)
Expand Down Expand Up @@ -383,7 +386,9 @@ class DetectionController(
type = it.type,
value = it.value,
imageSrc = storageService.uri(it.snapshotImageId).toString(),
annotations = annotationMap[Pair(it.snapshotImageId, it.type)] ?: emptyList()
annotations = annotationMap[Pair(it.snapshotImageId, it.type)] ?: emptyList(),
longitude = it.snapshot.camera.longitude.toBigDecimal(),
latitude = it.snapshot.camera.latitude.toBigDecimal(),
)
}
return PageImpl(list, pageRequest, Long.MAX_VALUE)
Expand Down Expand Up @@ -419,7 +424,9 @@ class DetectionController(
value = 3,
imageSrc = ServletUriComponentsBuilder.fromUri(appProperties.baseUri)
.path("/v1/image/${storageService.dummyId()}").toUriString(),
annotations = annotations
annotations = annotations,
longitude = BigDecimal.ONE,
latitude = BigDecimal.ONE,
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.katalisindonesia.banyuwangi.controller

import com.katalisindonesia.banyuwangi.model.Annotation
import com.katalisindonesia.banyuwangi.model.DetectionType
import java.math.BigDecimal
import java.time.Instant
import java.time.LocalDate

Expand All @@ -14,4 +15,6 @@ data class DetectionResponse(
val value: Int,
val imageSrc: String,
val annotations: List<Annotation>,
val longitude: BigDecimal,
val latitude: BigDecimal,
)
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ data class Camera(
var location: String,

@Column(nullable = false)
var latitude: Float = 0F,
var latitude: Double = 0.0,

@Column(nullable = false)
var longitude: Float = 0F,
var longitude: Double = 0.0,

@Column(nullable = false)
var host: String = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ data class SnapshotCount(
@Column(nullable = false)
var snapshotCameraLocation: String = snapshot.camera.location,

var snapshotCameraLongitude: Float? = snapshot.camera.longitude,
var snapshotCameraLatitude: Float? = snapshot.camera.latitude,
var snapshotCameraLongitude: Double? = snapshot.camera.longitude,
var snapshotCameraLatitude: Double? = snapshot.camera.latitude,

@Enumerated(EnumType.STRING)
@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class LiveViewControllerTest(
channel = 1,
userName = "admin",
password = "Password123",
longitude = 2F,
latitude = 3F,
longitude = 2.0,
latitude = 3.0,
type = CameraType.HIKVISION,
)
mockMvc.post("/v1/camera") {
Expand Down