Skip to content

Commit

Permalink
Julian constructor is public.
Browse files Browse the repository at this point in the history
  • Loading branch information
xclud committed Feb 12, 2024
1 parent d772acc commit 27499b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.0.5]

* Julian constructor is public.

## [2.0.4]

* Fix GMST, ECF and Topcentric calculations.
Expand Down
23 changes: 11 additions & 12 deletions lib/src/julian.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ extension DateTimeExtensions on DateTime {

/// Encapsulates a Julian date.
class Julian {
/// Initialize the Julian date object.
///
/// The first day of the year, Jan 1, is day 1.0. Noon on Jan 1 is
/// represented by the day value of 1.5, etc.
const Julian(this.value);
// Jan 1.5 2000 = Jan 1 2000 12h UTC

/// Create a Julian date object from a DateTime object. The time
Expand Down Expand Up @@ -49,16 +55,9 @@ class Julian {
// # - 0.5*sgn(100.0*year + mon - 190002.5) + 0.5;
;

return Julian._(j);
return Julian(j);
}

/// Initialize the Julian date object.
///
/// The first day of the year, Jan 1, is day 1.0. Noon on Jan 1 is
/// represented by the day value of 1.5, etc.
const Julian._(this.value);

/// The Julian date.
final double value;

Expand Down Expand Up @@ -87,16 +86,16 @@ class Julian {
static const _j1H12Y2000 = 2451545.0;

/// Adds days.
Julian addDays(double day) => Julian._(value + day);
Julian addDays(double day) => Julian(value + day);

/// Adds hours.
Julian addHours(double hours) => Julian._(value + hours / _hoursPerDay);
Julian addHours(double hours) => Julian(value + hours / _hoursPerDay);

/// Adds minutes.
Julian addMinutes(double min) => Julian._(value + min / _minutesPerDay);
Julian addMinutes(double min) => Julian(value + min / _minutesPerDay);

/// Adds seconds.
Julian addSeconds(double sec) => Julian._(value + _secondsPerDay);
Julian addSeconds(double sec) => Julian(value + _secondsPerDay);

/// Calculate Greenwich Mean Sidereal Time for the Julian date.
///
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: latlng
description: GeoJSON, Geodesy and Geographical calculations for Dart. Provides LatLong and Mercator projection (EPSG4326).
version: 2.0.4
version: 2.0.5
repository: https://github.com/xclud/dart_latlng
homepage: https://pwa.ir

Expand Down
2 changes: 1 addition & 1 deletion test/transform_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:latlng/latlng.dart';

final date = DateTime.utc(2024, 2, 9, 15, 4, 11);

var observer = LatLngAlt(
final observer = LatLngAlt(
Angle.degree(36.9613422),
Angle.degree(-122.0308),
0.370,
Expand Down

0 comments on commit 27499b5

Please sign in to comment.