Skip to content

Commit

Permalink
Docs: Add doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gschulze committed Sep 22, 2024
1 parent 2cdf88b commit 888d14a
Showing 1 changed file with 66 additions and 55 deletions.
121 changes: 66 additions & 55 deletions src/geo_key_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ use num_enum::{IntoPrimitive, TryFromPrimitive};
use tiff::tags::Tag;
use tiff::{TiffError, TiffFormatError, TiffResult};

/// The GeoKeyDirectoryTag Requirements Class specifies the requirements for
/// implementing the reserved GeoKeyDirectoryTag TIFF tag.
///
/// Ref: https://docs.ogc.org/is/19-008r4/19-008r4.html#_requirements_class_geokeydirectorytag
#[derive(Debug, PartialEq)]
pub struct GeoKeyDirectory {
pub key_directory_version: u16,
Expand Down Expand Up @@ -54,61 +58,6 @@ pub struct GeoKeyDirectory {
pub vertical_units: Option<u16>,
}

impl Default for GeoKeyDirectory {
fn default() -> Self {
Self {
key_directory_version: 1,
key_revision: 1,
minor_revision: 1,
model_type: None,
raster_type: None,
citation: None,
geographic_type: None,
geog_citation: None,
geog_geodetic_datum: None,
geog_prime_meridian: None,
geog_linear_units: None,
geog_linear_unit_size: None,
geog_angular_units: None,
geog_angular_unit_size: None,
geog_ellipsoid: None,
geog_semi_major_axis: None,
geog_semi_minor_axis: None,
geog_inv_flattening: None,
geog_azimuth_units: None,
geog_prime_meridian_long: None,
projected_type: None,
proj_citation: None,
projection: None,
proj_coord_trans: None,
proj_linear_units: None,
proj_linear_unit_size: None,
proj_std_parallel1: None,
proj_std_parallel2: None,
proj_nat_origin_long: None,
proj_nat_origin_lat: None,
proj_false_easting: None,
proj_false_northing: None,
proj_false_origin_long: None,
proj_false_origin_lat: None,
proj_false_origin_easting: None,
proj_false_origin_northing: None,
proj_center_long: None,
proj_center_lat: None,
proj_center_easting: None,
proj_center_northing: None,
proj_scale_at_nat_origin: None,
proj_scale_at_center: None,
proj_azimuth_angle: None,
proj_straight_vert_pole_long: None,
vertical: None,
vertical_citation: None,
vertical_datum: None,
vertical_units: None,
}
}
}

impl GeoKeyDirectory {
pub(crate) fn from_tag_data(
directory_data: Vec<u16>,
Expand Down Expand Up @@ -589,6 +538,68 @@ impl GeoKeyDirectory {
}
}

impl Default for GeoKeyDirectory {
fn default() -> Self {
// According to https://docs.ogc.org/is/19-008r4/19-008r4.html#_requirements_class_geokeydirectorytag,
// - the value of KeyDirectoryVersion SHALL be 1
// - the value of KeyRevision SHALL be 1
// - a MinorRevision of 1 indicates GeoTIFF 1.1, which is recommended for production/writing a GeoTIFF file
Self {
key_directory_version: 1,
key_revision: 1,
minor_revision: 1,
model_type: None,
raster_type: None,
citation: None,
geographic_type: None,
geog_citation: None,
geog_geodetic_datum: None,
geog_prime_meridian: None,
geog_linear_units: None,
geog_linear_unit_size: None,
geog_angular_units: None,
geog_angular_unit_size: None,
geog_ellipsoid: None,
geog_semi_major_axis: None,
geog_semi_minor_axis: None,
geog_inv_flattening: None,
geog_azimuth_units: None,
geog_prime_meridian_long: None,
projected_type: None,
proj_citation: None,
projection: None,
proj_coord_trans: None,
proj_linear_units: None,
proj_linear_unit_size: None,
proj_std_parallel1: None,
proj_std_parallel2: None,
proj_nat_origin_long: None,
proj_nat_origin_lat: None,
proj_false_easting: None,
proj_false_northing: None,
proj_false_origin_long: None,
proj_false_origin_lat: None,
proj_false_origin_easting: None,
proj_false_origin_northing: None,
proj_center_long: None,
proj_center_lat: None,
proj_center_easting: None,
proj_center_northing: None,
proj_scale_at_nat_origin: None,
proj_scale_at_center: None,
proj_azimuth_angle: None,
proj_straight_vert_pole_long: None,
vertical: None,
vertical_citation: None,
vertical_datum: None,
vertical_units: None,
}
}
}

/// GeoTIFF key names and IDs.
///
/// Ref: https://docs.ogc.org/is/19-008r4/19-008r4.html#_summary_of_geokey_ids_and_names
#[derive(Debug, TryFromPrimitive, IntoPrimitive)]
#[repr(u16)]
enum GeoKeyDirectoryTag {
Expand Down

0 comments on commit 888d14a

Please sign in to comment.