Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagohm committed Jun 30, 2024
2 parents 98d2fea + 2e064ff commit 11828d2
Show file tree
Hide file tree
Showing 285 changed files with 22,958 additions and 20,655 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
.PHONY: api desktop build install
.PHONY: api desktop bootRun build install

ifeq ($(OS),Windows_NT)
api:
gradlew.bat api:bootJar

desktop:
cd desktop && npm run electron:build

bootRun:
gradlew.bat api:bootRun --args='--server.port=7000'
else
api:
./gradlew api:bootJar

desktop:
cd desktop && npm run electron:build:deb

bootRun:
./gradlew api:bootRun --args='--server.port=7000'

install:
sudo dpkg -i desktop/release/nebulosa_0.1.0_amd64.deb
endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nebulosa.api.alignment.polar.darv

import nebulosa.api.cameras.CameraCaptureEvent
import nebulosa.api.messages.MessageEvent
import nebulosa.api.message.MessageEvent
import nebulosa.guiding.GuideDirection
import nebulosa.indi.device.camera.Camera

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package nebulosa.api.alignment.polar.darv
import io.reactivex.rxjava3.functions.Consumer
import nebulosa.api.beans.annotations.Subscriber
import nebulosa.api.cameras.CameraEventAware
import nebulosa.api.messages.MessageEvent
import nebulosa.api.messages.MessageService
import nebulosa.api.message.MessageEvent
import nebulosa.api.message.MessageService
import nebulosa.indi.device.camera.Camera
import nebulosa.indi.device.camera.CameraEvent
import nebulosa.indi.device.guide.GuideOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import nebulosa.api.cameras.*
import nebulosa.api.guiding.GuidePulseEvent
import nebulosa.api.guiding.GuidePulseRequest
import nebulosa.api.guiding.GuidePulseTask
import nebulosa.api.messages.MessageEvent
import nebulosa.api.message.MessageEvent
import nebulosa.api.tasks.AbstractTask
import nebulosa.api.tasks.SplitTask
import nebulosa.api.tasks.Task
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize
import nebulosa.api.beans.converters.angle.DeclinationSerializer
import nebulosa.api.beans.converters.angle.RightAscensionSerializer
import nebulosa.api.cameras.CameraCaptureEvent
import nebulosa.api.messages.MessageEvent
import nebulosa.api.message.MessageEvent
import nebulosa.indi.device.camera.Camera
import nebulosa.math.Angle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package nebulosa.api.alignment.polar.tppa
import io.reactivex.rxjava3.functions.Consumer
import nebulosa.api.beans.annotations.Subscriber
import nebulosa.api.cameras.CameraEventAware
import nebulosa.api.messages.MessageEvent
import nebulosa.api.messages.MessageService
import nebulosa.api.message.MessageEvent
import nebulosa.api.message.MessageService
import nebulosa.indi.device.camera.Camera
import nebulosa.indi.device.camera.CameraEvent
import nebulosa.indi.device.mount.Mount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import io.reactivex.rxjava3.functions.Consumer
import nebulosa.alignment.polar.point.three.ThreePointPolarAlignment
import nebulosa.alignment.polar.point.three.ThreePointPolarAlignmentResult
import nebulosa.api.cameras.*
import nebulosa.api.messages.MessageEvent
import nebulosa.api.message.MessageEvent
import nebulosa.api.mounts.MountMoveRequest
import nebulosa.api.mounts.MountMoveTask
import nebulosa.api.tasks.AbstractTask
Expand Down
18 changes: 7 additions & 11 deletions api/src/main/kotlin/nebulosa/api/atlas/BodyPosition.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ package nebulosa.api.atlas
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import nebulosa.api.beans.converters.angle.AzimuthSerializer
import nebulosa.api.beans.converters.angle.DeclinationSerializer
import nebulosa.api.beans.converters.angle.DegreesSerializer
import nebulosa.api.beans.converters.angle.RightAscensionSerializer
import nebulosa.constants.AU_KM
import nebulosa.constants.SPEED_OF_LIGHT
import nebulosa.horizons.HorizonsElement
import nebulosa.horizons.HorizonsQuantity
import nebulosa.indi.device.mount.PierSide
import nebulosa.math.Angle
import nebulosa.math.deg
import nebulosa.nova.astrometry.Constellation
import nebulosa.nova.position.GeographicPosition
import nebulosa.skycatalog.SkyObject
import nebulosa.time.CurrentTime

data class BodyPosition(
@field:JsonSerialize(using = RightAscensionSerializer::class) val rightAscensionJ2000: Angle,
Expand All @@ -28,15 +26,14 @@ data class BodyPosition(
val distance: Double,
val distanceUnit: String,
val illuminated: Double,
val elongation: Double,
@field:JsonSerialize(using = DegreesSerializer::class) val elongation: Angle,
val leading: Boolean, // true = rises and sets BEFORE Sun.
val pierSide: PierSide,
) {

companion object {

@JvmStatic
fun of(element: HorizonsElement, position: GeographicPosition? = null): BodyPosition {
fun of(element: HorizonsElement): BodyPosition {
val lightTime = element.asDouble(HorizonsQuantity.ONE_WAY_LIGHT_TIME)
var distance = lightTime * (SPEED_OF_LIGHT * 0.06) // km
var distanceUnit = "km"
Expand All @@ -55,15 +52,14 @@ data class BodyPosition(
element.asDouble(HorizonsQuantity.ASTROMETRIC_RA).deg,
element.asDouble(HorizonsQuantity.ASTROMETRIC_DEC).deg,
rightAscension, declination,
element.asDouble(HorizonsQuantity.APPARENT_AZ).deg,
element.asDouble(HorizonsQuantity.APPARENT_ALT).deg,
element.asDoubleOrNull(HorizonsQuantity.APPARENT_AZ)?.deg ?: element.asDouble(HorizonsQuantity.APPARENT_REFRACTED_AZ).deg,
element.asDoubleOrNull(HorizonsQuantity.APPARENT_ALT)?.deg ?: element.asDouble(HorizonsQuantity.APPARENT_REFRACTED_ALT).deg,
element.asDouble(HorizonsQuantity.VISUAL_MAGNITUDE, SkyObject.UNKNOWN_MAGNITUDE),
element.asEnum(HorizonsQuantity.CONSTELLATION, Constellation.AND),
distance, distanceUnit,
element.asDouble(HorizonsQuantity.ILLUMINATED_FRACTION),
element.asDouble(HorizonsQuantity.SUN_OBSERVER_TARGET_ELONGATION_ANGLE),
element.asString(HorizonsQuantity.SUN_OBSERVER_TARGET_ELONGATION_ANGLE, index = 1) == "/L",
if (position == null) PierSide.NEITHER else PierSide.expectedPierSide(rightAscension, declination, position.lstAt(CurrentTime))
element.asDouble(HorizonsQuantity.SUN_OBSERVER_TARGET_ELONGATION_ANGLE).deg,
element.asStringOrNull(HorizonsQuantity.SUN_OBSERVER_TARGET_ELONGATION_ANGLE, index = 1) == "/L",
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/atlas/IERSUpdateTask.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package nebulosa.api.atlas

import nebulosa.api.preferences.PreferenceService
import nebulosa.api.preference.PreferenceService
import nebulosa.io.transferAndClose
import nebulosa.log.loggerFor
import nebulosa.time.IERS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nebulosa.api.atlas

import com.sun.jna.Platform
import nebulosa.api.preferences.PreferenceService
import nebulosa.api.preference.PreferenceService
import nebulosa.io.transferAndCloseOutput
import nebulosa.log.loggerFor
import nebulosa.wcs.LibWCS
Expand Down
26 changes: 15 additions & 11 deletions api/src/main/kotlin/nebulosa/api/atlas/Location.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package nebulosa.api.atlas

import nebulosa.math.deg
import nebulosa.math.m
import nebulosa.nova.position.GeographicPosition
import nebulosa.nova.position.Geoid
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import nebulosa.api.beans.converters.angle.DegreesDeserializer
import nebulosa.api.beans.converters.angle.DegreesSerializer
import nebulosa.api.beans.converters.distance.MetersDeserializer
import nebulosa.api.beans.converters.distance.MetersSerializer
import nebulosa.math.Angle
import nebulosa.math.Distance
import nebulosa.nova.position.GeographicCoordinate
import nebulosa.time.TimeZonedInSeconds

data class Location(
val latitude: Double = 0.0, // deg.
val longitude: Double = 0.0, // deg.
val elevation: Double = 0.0, // m.
@field:JsonSerialize(using = DegreesSerializer::class) @field:JsonDeserialize(using = DegreesDeserializer::class) override val latitude: Angle = 0.0,
@field:JsonSerialize(using = DegreesSerializer::class) @field:JsonDeserialize(using = DegreesDeserializer::class) override val longitude: Angle = 0.0,
@field:JsonSerialize(using = MetersSerializer::class) @field:JsonDeserialize(using = MetersDeserializer::class) override val elevation: Distance = 0.0,
val offsetInMinutes: Int = 0,
) {
) : GeographicCoordinate, TimeZonedInSeconds {

fun geographicPosition(): GeographicPosition {
return Geoid.IERS2010.lonLat(longitude.deg, latitude.deg, elevation.m)
}
override val offsetInSeconds = offsetInMinutes * 60
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package nebulosa.api.atlas

import nebulosa.api.notifications.NotificationEvent
import nebulosa.api.notification.NotificationEvent

sealed interface SatelliteUpdateNotificationEvent : NotificationEvent.System {

Expand Down
4 changes: 2 additions & 2 deletions api/src/main/kotlin/nebulosa/api/atlas/SatelliteUpdateTask.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nebulosa.api.atlas

import nebulosa.api.messages.MessageService
import nebulosa.api.preferences.PreferenceService
import nebulosa.api.message.MessageService
import nebulosa.api.preference.PreferenceService
import nebulosa.log.loggerFor
import okhttp3.OkHttpClient
import okhttp3.Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.stereotype.Component
@Component
class SimbadEntityRepository(@Qualifier("simbadBox") override val box: Box<SimbadEntity>) : BoxRepository<SimbadEntity>() {

fun find(
fun search(
name: String? = null, constellation: Constellation? = null,
rightAscension: Angle = 0.0, declination: Angle = 0.0, radius: Angle = 0.0,
magnitudeMin: Double = SkyObject.MAGNITUDE_MIN, magnitudeMax: Double = SkyObject.MAGNITUDE_MAX,
Expand Down
29 changes: 18 additions & 11 deletions api/src/main/kotlin/nebulosa/api/atlas/SkyAtlasController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,48 @@ class SkyAtlasController(
fun positionOfSun(
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDateTime,
) = skyAtlasService.positionOfSun(location, dateTime)
@RequestParam(required = false, defaultValue = "false") fast: Boolean,
) = skyAtlasService.positionOfSun(location, dateTime, fast)

@GetMapping("sun/altitude-points")
fun altitudePointsOfSun(
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDate,
@RequestParam(required = false, defaultValue = "1") @Valid @Min(1) stepSize: Int,
) = skyAtlasService.altitudePointsOfSun(location, dateTime, stepSize)
@RequestParam(required = false, defaultValue = "false") fast: Boolean,
) = skyAtlasService.altitudePointsOfSun(location, dateTime, stepSize, fast)

@GetMapping("moon/position")
fun positionOfMoon(
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDateTime,
) = skyAtlasService.positionOfMoon(location, dateTime)
@RequestParam(required = false, defaultValue = "false") fast: Boolean,
) = skyAtlasService.positionOfMoon(location, dateTime, fast)

@GetMapping("moon/altitude-points")
fun altitudePointsOfMoon(
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDate,
@RequestParam(required = false, defaultValue = "1") stepSize: Int,
) = skyAtlasService.altitudePointsOfMoon(location, dateTime, stepSize)
@RequestParam(required = false, defaultValue = "1") @Valid @Min(1) stepSize: Int,
@RequestParam(required = false, defaultValue = "false") fast: Boolean,
) = skyAtlasService.altitudePointsOfMoon(location, dateTime, stepSize, fast)

@GetMapping("planets/{code}/position")
fun positionOfPlanet(
@PathVariable code: String,
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDateTime,
) = skyAtlasService.positionOfPlanet(location, code, dateTime)
@RequestParam(required = false, defaultValue = "false") fast: Boolean,
) = skyAtlasService.positionOfPlanet(location, code, dateTime, fast)

@GetMapping("planets/{code}/altitude-points")
fun altitudePointsOfPlanet(
@PathVariable code: String,
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDate,
@RequestParam(required = false, defaultValue = "1") stepSize: Int,
) = skyAtlasService.altitudePointsOfPlanet(location, code, dateTime, stepSize)
@RequestParam(required = false, defaultValue = "1") @Valid @Min(1) stepSize: Int,
@RequestParam(required = false, defaultValue = "false") fast: Boolean,
) = skyAtlasService.altitudePointsOfPlanet(location, code, dateTime, stepSize, fast)

@GetMapping("minor-planets")
fun searchMinorPlanet(@RequestParam @Valid @NotBlank text: String) = skyAtlasService.searchMinorPlanet(text)
Expand All @@ -91,7 +97,7 @@ class SkyAtlasController(
@PathVariable id: Long,
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDate,
@RequestParam(required = false, defaultValue = "1") stepSize: Int,
@RequestParam(required = false, defaultValue = "1") @Valid @Min(1) stepSize: Int,
) = skyAtlasService.altitudePointsOfSkyObject(location, id, dateTime, stepSize)

@GetMapping("sky-objects")
Expand Down Expand Up @@ -124,7 +130,7 @@ class SkyAtlasController(
satellite: SatelliteEntity,
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDate,
@RequestParam(required = false, defaultValue = "1") stepSize: Int,
@RequestParam(required = false, defaultValue = "1") @Valid @Min(1) stepSize: Int,
) = skyAtlasService.altitudePointsOfSatellite(location, satellite, dateTime, stepSize)

@GetMapping("satellites")
Expand All @@ -137,5 +143,6 @@ class SkyAtlasController(
fun twilight(
@LocationParam location: Location,
@DateAndTimeParam dateTime: LocalDate,
) = skyAtlasService.twilight(location, dateTime)
@RequestParam(required = false, defaultValue = "false") fast: Boolean,
) = skyAtlasService.twilight(location, dateTime, fast)
}
Loading

0 comments on commit 11828d2

Please sign in to comment.