Skip to content

Commit 9b229fb

Browse files
committed
Finish adding serde derives
1 parent fa5fd98 commit 9b229fb

File tree

7 files changed

+9
-2
lines changed

7 files changed

+9
-2
lines changed

src/ellipsoidal/ellipsoid.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::{
44

55
/// An ellipsoid.
66
#[derive(PartialEq, Clone, Copy, Debug, Default)]
7+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
78
pub struct Ellipsoid {
89
equatorial_radius: Length,
910
polar_radius: Length,

src/positions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl LatLong {
226226
/// - z-axis points to the North Pole along the body's rotation axis,
227227
/// - x-axis points towards the point where latitude = longitude = 0
228228
#[derive(PartialEq, Clone, Copy, Debug, Default)]
229-
229+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
230230
pub struct NVector(Vec3);
231231

232232
impl NVector {

src/spherical/cap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use super::Sphere;
77
/// A [spherical cap](https://en.wikipedia.org/wiki/Spherical_cap): a portion of a sphere cut off by a plane.
88
/// This struct and implementation is very much based on [S2Cap](https://github.com/google/s2geometry/blob/master/src/s2/s2cap.h).
99
#[derive(PartialEq, Clone, Copy, Debug, Default)]
10+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1011
pub struct Cap {
1112
centre: NVector,
1213
chord_radius2: f64,

src/spherical/great_circle.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use super::base::easting;
99
/// It is internally represented as its normal vector - i.e. the normal vector
1010
/// to the plane containing the great circle.
1111
#[derive(PartialEq, Clone, Copy, Debug, Default)]
12+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1213
pub struct GreatCircle {
1314
normal: Vec3,
1415
}

src/spherical/minor_arc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use super::base::{angle_radians_between, exact_side};
88
/// Oriented minor arc of a great circle between two positions: shortest path between positions
99
/// on a great circle.
1010
#[derive(PartialEq, Clone, Copy, Debug, Default)]
11+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1112
pub struct MinorArc {
1213
start: NVector,
1314
end: NVector,

src/spherical/rectangle.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use super::MinorArc;
1111
///
1212
/// This struct and implementation is very much based on [S2LatLngRect](https://github.com/google/s2geometry/blob/master/src/s2/s2latlng_rect.h).
1313
#[derive(PartialEq, Clone, Copy, Debug, Default)]
14+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1415
pub struct Rectangle {
1516
lat: LatitudeInterval,
1617
lng: LongitudeInterval,
@@ -317,6 +318,7 @@ impl Rectangle {
317318

318319
/// latitude interval: {@link #lo} is assumed to be less than {@link #hi}, otherwise the interval is empty.
319320
#[derive(PartialEq, Clone, Copy, Debug, Default)]
321+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
320322
struct LatitudeInterval {
321323
lo: Angle,
322324
hi: Angle,
@@ -450,6 +452,7 @@ impl LatitudeInterval {
450452
}
451453

452454
#[derive(PartialEq, Clone, Copy, Debug, Default)]
455+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
453456
struct LongitudeInterval {
454457
lo: Angle,
455458
hi: Angle,

src/spherical/sloop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ impl Loop {
532532
}
533533

534534
/// Triangulates this loop using the [Ear Clipping](https://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf) method.
535-
///
535+
///
536536
/// This method returns either ([loop number vertices](crate::spherical::Loop::num_vertices) - 2) triangles - as triples of [NVector]s, if
537537
/// the triangulation succeeds, or [empty](Vec::new) if the triangulation fails - which should only occur for [non simple](crate::spherical::Loop::is_simple) loops.
538538
///

0 commit comments

Comments
 (0)