From c01beebfa8c0467471fabd901ffed33fd333ab1b Mon Sep 17 00:00:00 2001 From: risty Date: Thu, 16 Nov 2017 14:29:00 +0300 Subject: [PATCH] some documenting, cleanup and version increase --- SonarLogAPI/CSV/CSVLogData.cs | 3 + SonarLogAPI/Compass/CompassLogEntry.cs | 3 +- SonarLogAPI/DepthAdjuster.cs | 35 +++--- .../Localization/ProjectDescriptions.cs | 2 +- SonarLogAPI/Lowrance/Frame.cs | 99 ++++++++++------- SonarLogAPI/Lowrance/Header.cs | 8 +- SonarLogAPI/Lowrance/SoundedData.cs | 32 +++--- SonarLogAPI/Primitives/Coordinate.cs | 30 ++--- SonarLogAPI/Primitives/CoordinatePoint.cs | 104 +++++++++--------- SonarLogAPI/Primitives/IDepthPointSource.cs | 5 +- .../Primitives/ITemperaturePointSource.cs | 7 ++ SonarLogAPI/Primitives/Latitude.cs | 41 ++++--- SonarLogAPI/Primitives/LinearDimension.cs | 60 +++++----- SonarLogAPI/Primitives/Longitude.cs | 51 +++++---- 14 files changed, 271 insertions(+), 209 deletions(-) diff --git a/SonarLogAPI/CSV/CSVLogData.cs b/SonarLogAPI/CSV/CSVLogData.cs index b320d5a..7b93b48 100644 --- a/SonarLogAPI/CSV/CSVLogData.cs +++ b/SonarLogAPI/CSV/CSVLogData.cs @@ -4,6 +4,9 @@ using System.Collections.Generic; using System.IO; + /// + ///Log data that consists of CSV entries. + /// public class CsvLogData { /// diff --git a/SonarLogAPI/Compass/CompassLogEntry.cs b/SonarLogAPI/Compass/CompassLogEntry.cs index 1aa9016..41bc4f5 100644 --- a/SonarLogAPI/Compass/CompassLogEntry.cs +++ b/SonarLogAPI/Compass/CompassLogEntry.cs @@ -3,10 +3,11 @@ using System; using Primitives; + /// /// /// The log entry with information from compass. /// - /// + /// public class CompassLogEntry : ICoordinatePointSource { /// diff --git a/SonarLogAPI/DepthAdjuster.cs b/SonarLogAPI/DepthAdjuster.cs index 9325ec2..67e6e8f 100644 --- a/SonarLogAPI/DepthAdjuster.cs +++ b/SonarLogAPI/DepthAdjuster.cs @@ -7,25 +7,28 @@ using SonarLogAPI.Primitives; + /// + /// Depth adjuster. + /// public class DepthAdjuster { private readonly object _syncRoot = new object(); /// - /// Base points sequence + /// Base points sequence. /// public IEnumerable BasePoints { get; set; } /// - /// Adjustable points sequence + /// Adjustable points sequence. /// public IEnumerable AdjustablePoints { get; set; } /// - /// Create instance of + /// Create instance of . /// - /// Base points sequence - /// Adjustable points sequence + /// Base points sequence. + /// Adjustable points sequence. public DepthAdjuster(IEnumerable basePoints, IEnumerable adjustablePoints) { BasePoints = basePoints; @@ -33,9 +36,9 @@ public DepthAdjuster(IEnumerable basePoints, IEnumerable - /// Ajust depth at + /// Ajust depth at . /// - /// after depth adjust + /// after depth adjust. public IEnumerable AdjustDepth() { var nearestPoint = FindNearestPoint(BasePoints, AdjustablePoints); @@ -45,7 +48,7 @@ public IEnumerable AdjustDepth() /// /// Ajust depth at async. /// - /// after depth adjust + /// after depth adjust. public Task> AdjustDepthAsync() { return Task.Run(() => AdjustDepth()); @@ -54,9 +57,9 @@ public Task> AdjustDepthAsync() /// /// Find nearest points at two sequence. /// - /// First points sequence - /// Second points sequence - /// + /// First points sequence. + /// Second points sequence. + /// . private NearestPointsEventArgs FindNearestPoint(IEnumerable firstSequence, IEnumerable secondSequence) { var uniqueBasePoints = firstSequence.GroupBy(point => point.Point) @@ -113,11 +116,11 @@ private NearestPointsEventArgs FindNearestPoint(IEnumerable f } /// - /// Ajust depth at sequence of points/> + /// Ajust depth at sequence of points. /// - /// Sequence of points to adjust depth - /// Value to add to depth - /// Sequence of points after depth adjust + /// Sequence of points to adjust depth. + /// Value to add to depth. + /// Sequence of points after depth adjust. private static IEnumerable AdjustDepth(IEnumerable innerSequence, LinearDimension ajustValue) { var depthPointSources = innerSequence as IDepthPointSource[] ?? innerSequence.ToArray(); @@ -138,7 +141,7 @@ protected virtual void OnNearestPointFound(NearestPointsEventArgs e) } /// - /// EventArgs with information about two nearest points and distance between em + /// EventArgs with information about two nearest points and distance between em. /// public class NearestPointsEventArgs : EventArgs { diff --git a/SonarLogAPI/Localization/ProjectDescriptions.cs b/SonarLogAPI/Localization/ProjectDescriptions.cs index d7f6159..119645a 100644 --- a/SonarLogAPI/Localization/ProjectDescriptions.cs +++ b/SonarLogAPI/Localization/ProjectDescriptions.cs @@ -10,6 +10,6 @@ public class ProjectDescriptions /// Gets copyright information. public const string Copyright = "Copyright @ Bagrich Ivan 2016-2017"; /// Gets version information. - public const string Version = "0.4"; + public const string Version = "0.5"; } } \ No newline at end of file diff --git a/SonarLogAPI/Lowrance/Frame.cs b/SonarLogAPI/Lowrance/Frame.cs index 52917d5..399a108 100644 --- a/SonarLogAPI/Lowrance/Frame.cs +++ b/SonarLogAPI/Lowrance/Frame.cs @@ -7,6 +7,9 @@ using Primitives; + /// + /// from which frame is given. + /// public enum ChannelType : byte { /// @@ -293,6 +296,9 @@ public static IDictionary + ///Values, which are specific for sl2 frame type. + /// private static IEnumerable SpecificSL2FrameValues => new[] { @@ -321,6 +327,9 @@ public static IDictionary + /// Values, which are specific for sl3 frame type. + /// private static IEnumerable SpecificSL3FrameValues => new[] { /*Looking for the @@ -340,11 +349,11 @@ public static IDictionary - /// Verify SL log file and create frames map + /// Verify SL log file and create frames map. /// - /// - /// Offset of first frame (in bytes) in 's stream - /// + /// . + /// Offset of first frame (in bytes) in 's stream. + /// . /// File creation time. /// Sequence(tuple) of frames offsets at reader and Timespans from logging start. public static IEnumerable> GetFramesMap(BinaryReader reader, int readPosition, FileVersion version, out DateTimeOffset fileCreationTime) @@ -475,9 +484,9 @@ public static IEnumerable> GetFramesMap(BinaryReader reader } /// - /// Read frame from Reader + /// Read frame from Reader. /// - /// + /// . /// Frame offset in readers stream. /// . /// object. @@ -578,12 +587,12 @@ public static Frame ReadFrame(BinaryReader reader, int frameStartByteOffset, Fil } /// - /// Write sequence of frames to writer + /// Write sequence of frames to writer. /// - /// - /// Sequence of frames to write - /// offset of first frame in Writers stream - /// Outer stream version + /// . + /// Sequence of frames to write. + /// Offset of first frame in Writers stream. + /// Outer stream version. public static void WriteFrames(BinaryWriter writer, List framesToWrite, int framesSetStartByteOffset, FileVersion version) { switch (version) @@ -600,6 +609,12 @@ public static void WriteFrames(BinaryWriter writer, List framesToWrite, i } } + /// + /// Write sequence of SL3 frames to writer. + /// + /// . + /// Sequence of frames to write. + /// Offset of first frame in Writers stream. private static void WriteSl3Frames(BinaryWriter writer, List framesToWrite, int framesSetStartByteOffset) { //sort before writing @@ -615,7 +630,7 @@ private static void WriteSl3Frames(BinaryWriter writer, List framesToWrit int lastSidescanCompositeChannelFrameOffset = 0; int lastThreeDChannelFrameOffset = 0; - //take earlies date from frames and start writing from it + //take earliest date from frames and start writing from it var firstFrameTime = framesToWrite.Select(frame => frame.DateTimeOffset).Min(); int lastFrameIndex = 0; int timeOffsetMiliseconds = 0; @@ -738,6 +753,12 @@ private static void WriteSl3Frames(BinaryWriter writer, List framesToWrit } + /// + /// Write sequence of SL2 frames to writer. + /// + /// . + /// Sequence of frames to write. + /// Offset of first frame in Writers stream. private static void WriteSl2Frames(BinaryWriter writer, List framesToWrite, int framesSetStartByteOffset) { //takes frame with channel type != ChannelType.ThreeD and sort it after @@ -755,7 +776,7 @@ private static void WriteSl2Frames(BinaryWriter writer, List framesToWrit int lastSidescanCompositeChannelFrameOffset = 0; //take earlies date from frames and start writing from it - var firstFrameTime = framesToWrite.Select(frame=> frame.DateTimeOffset).Min(); + var firstFrameTime = framesToWrite.Select(frame => frame.DateTimeOffset).Min(); int lastFrameIndex = 0; int timeOffsetMiliseconds = 0; @@ -789,7 +810,7 @@ private static void WriteSl2Frames(BinaryWriter writer, List framesToWrit case ChannelType.SidescanComposite: lastSidescanCompositeChannelFrameOffset = frameOffset; break; - //sl2 cant contains ThreeD channel data + //sl2 can't contains ThreeD channel data case ChannelType.ThreeD: throw new ArgumentOutOfRangeException(); default: @@ -878,10 +899,10 @@ private static void WriteSl2Frames(BinaryWriter writer, List framesToWrit } /// - /// Converts Frames flags to two bytes + /// Converts Frames flags to two bytes. /// - /// - /// Array of two bytes + /// . + /// Array of two bytes. private static byte[] TwoFlagsBytes(Frame frame) { var twoFlagsBytes = new byte[2]; @@ -950,10 +971,10 @@ private static byte[] TwoFlagsBytes(Frame frame) } /// - /// Gets offset map type for file version + /// Gets offset map type for file version. /// - /// - /// Type of offset map + /// . + /// Type of offset map. private static Type GetOffsetsTypeForFileVersion(FileVersion version) { Type slType; @@ -977,41 +998,41 @@ private static Type GetOffsetsTypeForFileVersion(FileVersion version) } /// - /// Parse property to enum and convert it to byte + /// Parse property to enum and convert it to byte. /// - /// Type of enum - /// Property name - /// Property byte representation + /// Type of enum. + /// Property name. + /// Property byte representation. private static byte GetOffset(Type slType, string propertyName) { return Convert.ToByte(Enum.Parse(slType, propertyName)); } /// - /// Converts Longitude double degrees value in WGS84 to int value in Lowrance format + /// Converts Longitude double degrees value in WGS84 to int value in Lowrance format. /// - /// Longitude double degrees value in WGS84 - /// Longitude int value in Lowrance format + /// Longitude double degrees value in WGS84. + /// Longitude int value in Lowrance format. private static int ConvertLongitudeToLowranceInt(double longitudeWGS84) { return Convert.ToInt32(longitudeWGS84 * _earthWGS84PolarRadius / _radConversion); } /// - /// Converts Longitude int value in Lowrance format to double degrees value in WGS84 format + /// Converts Longitude int value in Lowrance format to double degrees value in WGS84 format. /// - /// Longitude int value in Lowrance format - /// Double degrees value in WGS84 format + /// Longitude int value in Lowrance format. + /// Double degrees value in WGS84 format. private static double ConvertLongitudeToWGS84(int lowranceIntValue) { return lowranceIntValue / _earthWGS84PolarRadius * _radConversion; } /// - /// Converts double degrees value in WGS84 to int value in Lowrance(Spherical Mercator Projection) format + /// Converts double degrees value in WGS84 to int value in Lowrance(Spherical Mercator Projection) format. /// - /// Latitude double degrees value in WGS84 - /// Latitude int value in Lowrance format + /// Latitude double degrees value in WGS84. + /// Latitude int value in Lowrance format. private static int ConvertLatitudeToLowranceInt(double latitudeWGS84) { var temp = latitudeWGS84 / _radConversion; @@ -1028,10 +1049,10 @@ private static double ConvertLatitudeWGS84(int lowranceIntValue) } /// - /// Sets specific bit in ref byte + /// Sets specific bit in ref byte. /// - /// Byte ref - /// Bit position + /// Byte ref. + /// Bit position. private static void SetBitInByte(ref byte refByte, int position) { if (position > 7) throw new ArgumentOutOfRangeException(nameof(position)); @@ -1042,11 +1063,11 @@ private static void SetBitInByte(ref byte refByte, int position) } /// - /// Checks specific bit in byte set + /// Checks specific bit in byte set. /// /// Byte - /// Bit position - /// Is bit set or not + /// Bit position. + /// Is bit set or not. private static bool IsBitSet(byte b, int position) { if (position > 7) throw new ArgumentOutOfRangeException(nameof(position)); diff --git a/SonarLogAPI/Lowrance/Header.cs b/SonarLogAPI/Lowrance/Header.cs index cebbac3..65c2783 100644 --- a/SonarLogAPI/Lowrance/Header.cs +++ b/SonarLogAPI/Lowrance/Header.cs @@ -86,8 +86,8 @@ public static Header ReadHeader(BinaryReader reader, long headerFirstByteOffset) { if (reader.BaseStream.Length < headerFirstByteOffset + Lenght) throw new ArgumentException("Stream length less then " - + nameof(headerFirstByteOffset) + " + Header " + nameof(Lenght)); - + + nameof(headerFirstByteOffset) + "+ " + nameof(Header) + " " + nameof(Lenght)); + //seeking to header first byte reader.BaseStream.Seek(headerFirstByteOffset, SeekOrigin.Begin); @@ -106,7 +106,7 @@ public static Header ReadHeader(BinaryReader reader, long headerFirstByteOffset) /// /// . /// object to write. - /// Offset of first byte + /// Offset of first byte. public static void WriteHeader(BinaryWriter writer, Header headerToWrite, long headerFirstByteOffset) { //seeking to header first byte @@ -117,7 +117,7 @@ public static void WriteHeader(BinaryWriter writer, Header headerToWrite, long h writer.Write(headerToWrite.BlockSize); //write zero from current position to lenght position while (writer.BaseStream.Position < headerFirstByteOffset + Lenght) - writer.Write(new byte()); + writer.Write(new byte()); } public override string ToString() diff --git a/SonarLogAPI/Lowrance/SoundedData.cs b/SonarLogAPI/Lowrance/SoundedData.cs index fb715df..3edc8ad 100644 --- a/SonarLogAPI/Lowrance/SoundedData.cs +++ b/SonarLogAPI/Lowrance/SoundedData.cs @@ -6,37 +6,37 @@ using SonarLogAPI.Primitives; /// - /// Sounded data + /// Sounded data. /// public class SoundedData { /// - /// Inner byte array of data values + /// Inner byte array of data values. /// public byte[] Data { get; } /// - /// Type of channel + /// Type of channel. /// public ChannelType ChannelType { get; } /// - /// Upper limit of + /// Upper limit of . /// public LinearDimension UpperLimit { get; } /// - /// Lower limit of + /// Lower limit of . /// public LinearDimension LowerLimit { get; } /// /// Create instance of . /// - /// Sounded data - /// - /// - /// + /// Sounded data. + /// . + /// . + /// . public SoundedData(byte[] data, ChannelType channelType, LinearDimension upperLimit, LinearDimension lowerLimit) { Data = data; @@ -87,14 +87,14 @@ public static SoundedData FlipSoundedData(SoundedData soundedData) } /// - /// Create instance of with generated + /// Create instance of with generated . /// - /// - /// - /// - /// - /// - /// Instance of with generated + /// . + /// . + /// . + /// . + /// . + /// Instance of with generated . public static SoundedData GenerateData(short packetSize, ChannelType channelType, LinearDimension depth, LinearDimension upperLimit, LinearDimension lowerLimit) { diff --git a/SonarLogAPI/Primitives/Coordinate.cs b/SonarLogAPI/Primitives/Coordinate.cs index 94a0efc..63000ef 100644 --- a/SonarLogAPI/Primitives/Coordinate.cs +++ b/SonarLogAPI/Primitives/Coordinate.cs @@ -6,7 +6,7 @@ namespace SonarLogAPI.Primitives using System.Globalization; /// - /// Abstract class, representing geographical . + /// Abstract class, representing geographical . /// public abstract class Coordinate : IEquatable { @@ -14,13 +14,14 @@ public abstract class Coordinate : IEquatable private double _seconds; /// - /// Degrees part of geographical . + /// Degrees part of geographical . /// public double Degrees { get; set; } /// - /// Minutes part of geographical . + /// Minutes part of geographical . /// + /// public double Minutes { get => _minutes; @@ -34,8 +35,9 @@ public double Minutes } /// - /// Seconds part of geographical . + /// Seconds part of geographical . /// + /// public double Seconds { get => _seconds; @@ -49,9 +51,9 @@ public double Seconds } /// - /// Initializes a new instance of the class from value. + /// Initializes a new instance of the class from value. /// - /// value + /// value. protected Coordinate(double value) { var absValue = Math.Abs(value); @@ -63,10 +65,11 @@ protected Coordinate(double value) } /// - /// Initializes a new instance of the class from and value. + /// Initializes a new instance of the class from and value. /// /// value. /// value. + /// protected Coordinate(double degrees, double minutes) { Degrees = Math.Abs(degrees); @@ -79,11 +82,12 @@ protected Coordinate(double degrees, double minutes) } /// - /// Initializes a new instance of the class from , and value. + /// Initializes a new instance of the class from , and value. /// /// value. /// value. /// + /// protected Coordinate(double degrees, double minutes, double seconds) { Degrees = Math.Abs(degrees); @@ -100,12 +104,12 @@ protected Coordinate(double degrees, double minutes, double seconds) } /// - /// Split double value to integer part and fraction part, converted to 60 decimal calculus + /// Split double value to integer part and fraction part, converted to 60 decimal calculus. /// - /// Double value of Degrees or Minutes - /// fraction part, converted to 60 decimal calculus + /// Double value of Degrees or Minutes. + /// Fraction part, converted to 60 decimal calculus. /// Integer part if value - private static int FromDoubleToIntAndFractionIn60ThSystem (double value, out double fraction) + private static int FromDoubleToIntAndFractionIn60ThSystem(double value, out double fraction) { var integerPart = (int)value; fraction = (value - integerPart) * 60; @@ -155,7 +159,7 @@ public override int GetHashCode() public override string ToString() { - return string.Format(CultureInfo.InvariantCulture, "{0}º {1}' {2}\"", Degrees, Minutes,Seconds); + return string.Format(CultureInfo.InvariantCulture, "{0}º {1}' {2}\"", Degrees, Minutes, Seconds); //return $"{Degrees}º {Minutes}' {Seconds}\""; } } diff --git a/SonarLogAPI/Primitives/CoordinatePoint.cs b/SonarLogAPI/Primitives/CoordinatePoint.cs index 09a96d9..a4235ef 100644 --- a/SonarLogAPI/Primitives/CoordinatePoint.cs +++ b/SonarLogAPI/Primitives/CoordinatePoint.cs @@ -7,7 +7,7 @@ //? /// - /// Represents a geographical location point that is determined by and coordinates. + /// Represents a geographical location point that is determined by and coordinates. /// public class CoordinatePoint : IEquatable { @@ -36,10 +36,10 @@ public class CoordinatePoint : IEquatable public Longitude Longitude { get; } /// - /// Initializes a new instance of the class - /// from and objects. + /// Initializes a new instance of the class + /// from and objects. /// - /// + /// /// public CoordinatePoint(Latitude latitude, Longitude longitude) { @@ -48,24 +48,24 @@ public CoordinatePoint(Latitude latitude, Longitude longitude) } /// - /// Initializes a new instance of the class - /// from and degrees values. + /// Initializes a new instance of the class + /// from and degrees values. /// - /// degrees value. - /// degrees value. + /// degrees value. + /// degrees value. public CoordinatePoint(double latitude, double longitude) : this(new Latitude(latitude), new Longitude(longitude)) { } /// - /// Initializes a new instance of the class - /// from and degrees, minutes and seconds values. + /// Initializes a new instance of the class + /// from and degrees, minutes and seconds values. /// - /// Degrees - /// Minutes - /// Seconds - /// Degrees - /// Minutes - /// Seconds + /// Degrees + /// Minutes + /// Seconds + /// Degrees + /// Minutes + /// Seconds public CoordinatePoint(double latitudeDegrees, double latitudeMinutes, double latitudeSeconds, double longitudeDegrees, double longitudeMinutes, double longitudeSeconds) : this(new Latitude(latitudeDegrees, latitudeMinutes, latitudeSeconds), new Longitude(longitudeDegrees, longitudeMinutes, longitudeSeconds)) { } @@ -83,20 +83,20 @@ public bool Equals(CoordinatePoint other) } /// - /// Determines whether two objects refer to the same location. + /// Determines whether two objects refer to the same location. /// - /// The first to compare. - /// The second to compare. - /// true, if the objects are determined to be equivalent; otherwise, false. + /// The first to compare. + /// The second to compare. + /// true, if the objects are determined to be equivalent; otherwise, false. public static bool operator ==(CoordinatePoint left, CoordinatePoint right) { return (object)left != null && (object)right != null && left.Equals(right); } - /// Determines whether two objects correspond to different locations. - /// The first to compare. - /// The second to compare. - /// true, if the objects are determined to be different; otherwise, false. + /// Determines whether two objects correspond to different locations. + /// The first to compare. + /// The second to compare. + /// true, if the objects are determined to be different; otherwise, false. public static bool operator !=(CoordinatePoint left, CoordinatePoint right) { return !(left == right); @@ -104,11 +104,11 @@ public bool Equals(CoordinatePoint other) /// - /// Determines if a specified - /// is equal to the current . + /// Determines if a specified + /// is equal to the current . /// - /// The object to compare the to. - /// True, if the objects are equal; otherwise, false. + /// The object to compare the to. + /// True, if the objects are equal; otherwise, false. public override bool Equals(object obj) { var item = obj as CoordinatePoint; @@ -128,12 +128,12 @@ public override string ToString() #region Direct and inverse problem on the flat /// - /// Get at distance and direction on the flat. + /// Get at distance and direction on the flat. /// - /// Source + /// Source /// Distance to a new point. /// Direction from one point to another in radians. - /// at specified distance and direction from the given point. + /// at specified distance and direction from the given point. public static CoordinatePoint GetCoordinatePointAtDistanceAndDirectionOnTheFlat(CoordinatePoint basePoint, LinearDimension distance, double azimuth) { var deltaLatitudeGrad = distance.GetMeters() * Math.Cos(azimuth) / (_earthWgs84MeanRadius * _d2R); @@ -180,10 +180,10 @@ public static LinearDimension GetDistanceBetweenPointsOnTheFlat(CoordinatePoint #region Get distance (inverse problem) at sphere with Haversine /// - /// Returns the distance between two at sphere with WGS84 Mean Radius with Haversine formula. + /// Returns the distance between two at sphere with WGS84 Mean Radius with Haversine formula. /// - /// First point - /// Second point + /// First point. + /// Second point. /// Point altitude above surface. Zero by default. /// Distance between points. /// @@ -224,13 +224,13 @@ public static LinearDimension GetDistanceBetweenPointsWithHaversine(double lat1, #region Direct and inverse problems on an ellipsoid /// - /// Get at distance and direction on an ellipsoid. + /// Get at distance and direction on an ellipsoid. /// - /// Source + /// Source . /// Distance to a new point. /// Azimuth to a new point. /// Azimuth from a new point to base point. - /// at specified distance and direction from the base point. + /// at specified distance and direction from the base point. public static CoordinatePoint GetCoordinatePointAtDistanceAndDirectionOnAnEllipsoid(CoordinatePoint basePoint, LinearDimension distance, double azimuth, out double backAzimuth) { double deltaLatitude; @@ -265,12 +265,12 @@ public static CoordinatePoint GetCoordinatePointAtDistanceAndDirectionOnAnEllips } /// - /// Returns the distance between two on an ellipsoid. Inverse Geodesics problem. + /// Returns the distance between two on an ellipsoid. Inverse Geodesics problem. /// - /// First point - /// Second point + /// First point. + /// Second point. /// Point altitude above surface. Zero by default. - /// Distance between two on an ellipsoid + /// Distance between two on an ellipsoid. public static LinearDimension GetDistanceBetweenPointsOnAnEllipsoid(CoordinatePoint firstPoint, CoordinatePoint secondPoint, double altitude = 0) { return GetDistanceBetweenPointsOnAnEllipsoid(firstPoint.Latitude.ToDegrees(), @@ -278,14 +278,14 @@ public static LinearDimension GetDistanceBetweenPointsOnAnEllipsoid(CoordinatePo } /// - /// Returns the distance between two on an ellipsoid. Inverse Geodesics problem. + /// Returns the distance between two on an ellipsoid. Inverse Geodesics problem. /// - /// First point degrees double value. - /// First point degrees double value. - /// Second point degrees double value. - /// Second point degrees double value. + /// First point degrees double value. + /// First point degrees double value. + /// Second point degrees double value. + /// Second point degrees double value. /// Point altitude above surface(meters). Zero by default. - /// Distance between points + /// Distance between points. /// /// This method can return two azimuts to points. public static LinearDimension GetDistanceBetweenPointsOnAnEllipsoid(double lat1, double long1, double lat2, double long2, double altitude = 0) @@ -298,18 +298,18 @@ public static LinearDimension GetDistanceBetweenPointsOnAnEllipsoid(double lat1, double middleLongitudeRadians = (lat2 + lat1) * _d2R / 2; double meridional = GetMeridionalForLatitude(Latitude.FromRadians(middleLongitudeRadians)); double primeVertical = GetPrimeVerticalForLatitude(Latitude.FromRadians(middleLongitudeRadians)); - double q = deltaLatitudeRadians * meridional * + double q = deltaLatitudeRadians * meridional * (1 - (2 * Math.Pow(deltaLongitudeRadians, 2d) + Math.Pow(deltaLongitudeRadians, 2d) * SinPow2(meridional)) / 24); double p = deltaLongitudeRadians * primeVertical * Math.Cos(middleLongitudeRadians) * - (1 + (Math.Pow(deltaLatitudeRadians, 2d) - Math.Pow(deltaLongitudeRadians, 2d) * SinPow2(middleLongitudeRadians)) / 24); + (1 + (Math.Pow(deltaLatitudeRadians, 2d) - Math.Pow(deltaLongitudeRadians, 2d) * SinPow2(middleLongitudeRadians)) / 24); - return LinearDimension.FromMeters(Math.Sqrt(Math.Pow(q,2d)+ Math.Pow(p, 2d))); + return LinearDimension.FromMeters(Math.Sqrt(Math.Pow(q, 2d) + Math.Pow(p, 2d))); } /// /// Returns Meridional value for specified . /// - /// + /// . /// Meridional value for specified . /// private static double GetMeridionalForLatitude(Latitude latitude) @@ -321,7 +321,7 @@ private static double GetMeridionalForLatitude(Latitude latitude) /// /// Returns Prime vertical value for specified . /// - /// + /// . /// Prime vertical value for specified . /// private static double GetPrimeVerticalForLatitude(Latitude latitude) diff --git a/SonarLogAPI/Primitives/IDepthPointSource.cs b/SonarLogAPI/Primitives/IDepthPointSource.cs index d603159..9841bec 100644 --- a/SonarLogAPI/Primitives/IDepthPointSource.cs +++ b/SonarLogAPI/Primitives/IDepthPointSource.cs @@ -1,6 +1,9 @@ namespace SonarLogAPI.Primitives { - + /// + /// + /// Interface for source of geographical location point with water depth value. + /// public interface IDepthPointSource : ICoordinatePointSource { /// diff --git a/SonarLogAPI/Primitives/ITemperaturePointSource.cs b/SonarLogAPI/Primitives/ITemperaturePointSource.cs index 3094420..a331afd 100644 --- a/SonarLogAPI/Primitives/ITemperaturePointSource.cs +++ b/SonarLogAPI/Primitives/ITemperaturePointSource.cs @@ -1,7 +1,14 @@ namespace SonarLogAPI.Primitives { + /// + /// + /// Interface for source of geographical location point with temperature value. + /// public interface ITemperaturePointSource : ICoordinatePointSource { + /// + /// Temperature + /// float Temperature { get; set; } } } \ No newline at end of file diff --git a/SonarLogAPI/Primitives/Latitude.cs b/SonarLogAPI/Primitives/Latitude.cs index 2c30162..08b1405 100644 --- a/SonarLogAPI/Primitives/Latitude.cs +++ b/SonarLogAPI/Primitives/Latitude.cs @@ -2,6 +2,9 @@ { using System; + /// + /// Latitude position. South or North. + /// public enum LatitudePosition : byte { South, North @@ -17,11 +20,12 @@ public class Latitude : Coordinate, IEquatable /// public LatitudePosition Position { get; set; } + /// /// /// Initializes a new instance of the class from latitude data. /// /// The latitude of the location in deegrees. May range from -90.0 to 90.0. - /// + /// public Latitude(double degrees) : base(degrees) { if (degrees < -90 || degrees > 90) @@ -30,37 +34,39 @@ public Latitude(double degrees) : base(degrees) PositionSet(degrees); } + /// /// /// Initializes a new instance of the class from latitude data. /// /// Deegrees part of latitude. May range from -90.0 to 90.0. /// Minutes part of latitude. May range from 0 to 60.0. - /// + /// public Latitude(double degrees, double minutes) : base(degrees, minutes) { PositionSet(degrees); } + /// /// /// Initializes a new instance of the class from latitude data. /// /// Deegrees part of . May range from -90.0 to 90.0. /// Minutes part of . May range from 0 to 60.0. /// Seconds part of . May range from 0 to 60.0. - /// + /// public Latitude(double degrees, double minutes, double seconds) : base(degrees, minutes, seconds) { PositionSet(degrees); } /// - /// Returns coordinate with Position, converted to Degrees double value + /// Returns coordinate with Position, converted to Degrees double value. /// - /// Latitude degrees - /// Latitude minutes - /// Latitude seconds - /// Latitude position - /// Degrees double value + /// Latitude degrees. + /// Latitude minutes. + /// Latitude seconds. + /// Latitude position. + /// Degrees double value. public static double ToDegrees(double degrees, double minutes, double seconds, LatitudePosition position) { var toDouble = Math.Abs(degrees) + minutes / 60 + seconds / 3600; @@ -69,10 +75,11 @@ public static double ToDegrees(double degrees, double minutes, double seconds, L : toDouble * -1; } + /// /// - /// Returns coordinate, converted to Degrees double value + /// Returns coordinate, converted to Degrees double value /// - /// Degrees double value + /// Degrees double value. public override double ToDegrees() { return Position == LatitudePosition.North @@ -84,7 +91,7 @@ public override double ToDegrees() /// Initializes a new instance of the class from degrees value. /// /// Degrees value. - /// Instance of the + /// Instance of the . public static Latitude FromDegrees(double degreesValue) { return new Latitude(degreesValue); @@ -94,18 +101,18 @@ public static Latitude FromDegrees(double degreesValue) /// Initializes a new instance of the class from radians value. /// /// Radians value. - /// Instance of the + /// Instance of the . public static Latitude FromRadians(double radiansValue) { return new Latitude(radiansValue * 180d / Math.PI); } /// - /// Converts the string representation of degrees value to Latitude object + /// Converts the string representation of degrees value to Latitude object. /// - /// String representation of Latitude degrees value - /// object - /// Conversion successed or failed + /// String representation of Latitude degrees value. + /// object. + /// Conversion successed or failed. public static bool TryParse(string stringvalue, out Latitude latitude) { var isSuccessParse = double.TryParse(stringvalue, out var result); diff --git a/SonarLogAPI/Primitives/LinearDimension.cs b/SonarLogAPI/Primitives/LinearDimension.cs index 9604ebc..98a638d 100644 --- a/SonarLogAPI/Primitives/LinearDimension.cs +++ b/SonarLogAPI/Primitives/LinearDimension.cs @@ -3,6 +3,9 @@ using System; using System.Globalization; + /// + /// Linear dimension unit. + /// public enum LinearDimensionUnit : byte { Meter, @@ -14,7 +17,7 @@ public enum LinearDimensionUnit : byte } /// - /// LinearDimension + /// Linear dimension. /// public class LinearDimension : IEquatable { @@ -22,20 +25,20 @@ public class LinearDimension : IEquatable private const double _metersInOneFoot = 0.3048; /// - /// LinearDimension value + /// LinearDimension value. /// public double Value; /// - /// LinearDimension value unit + /// LinearDimension value unit. /// public LinearDimensionUnit Unit; /// - /// Create instance of + /// Create instance of . /// - /// value - /// unit + /// value. + /// unit. public LinearDimension(double value, LinearDimensionUnit unit) { Value = value; @@ -43,13 +46,14 @@ public LinearDimension(double value, LinearDimensionUnit unit) } /// - /// Get value in meters + /// Get value in meters. /// - /// - /// value in meters + /// . + /// value in meters. + /// public static double GetMeters(LinearDimension depth) { - if (depth == null) throw new NullReferenceException(nameof(depth)); + if (depth == null) throw new ArgumentNullException(nameof(depth)); return depth.Unit == LinearDimensionUnit.Meter ? depth.Value @@ -57,43 +61,47 @@ public static double GetMeters(LinearDimension depth) } /// - /// Get value in foots + /// Get value in foots. /// - /// - /// value in foots + /// . + /// value in foots. + /// public static double GetFoots(LinearDimension depth) { + if (depth == null) throw new ArgumentNullException(nameof(depth)); + return depth.Unit == LinearDimensionUnit.Foot ? depth.Value : depth.Value / _metersInOneFoot; } /// - /// Get value in foots + /// Get value in foots. /// - /// value in foots + /// value in foots. public double GetFoots() { return GetFoots(this); } /// - /// Get value in meters + /// Get value in meters. /// - /// value in meters + /// value in meters. public double GetMeters() { return GetMeters(this); } /// - /// Convert object to depth object with value in meters + /// Convert object to depth object with value in meters. /// - /// object - /// object with value in meters + /// object. + /// object with value in meters. + /// public static LinearDimension ToMeters(LinearDimension depth) { - if (depth == null) throw new NullReferenceException(nameof(depth)); + if (depth == null) throw new ArgumentNullException(nameof(depth)); return depth.Unit == LinearDimensionUnit.Meter ? depth @@ -107,7 +115,7 @@ public static LinearDimension ToMeters(LinearDimension depth) /// object public static LinearDimension FromMeters(double meters) { - return new LinearDimension(meters,LinearDimensionUnit.Meter); + return new LinearDimension(meters, LinearDimensionUnit.Meter); } /// @@ -147,11 +155,11 @@ public override bool Equals(object obj) } /// - /// Determines if a specified - /// is equal to the current . + /// Determines if a specified + /// is equal to the current . /// - /// The object to compare the to. - /// True, if the objects are equal; otherwise, false. + /// The object to compare the to. + /// True, if the objects are equal; otherwise, false. public bool Equals(LinearDimension other) { //Check whether the compared object is null. diff --git a/SonarLogAPI/Primitives/Longitude.cs b/SonarLogAPI/Primitives/Longitude.cs index a253fff..a38c499 100644 --- a/SonarLogAPI/Primitives/Longitude.cs +++ b/SonarLogAPI/Primitives/Longitude.cs @@ -2,26 +2,30 @@ { using System; + /// + /// Longitude position. West or East. + /// public enum LongitudePosition : byte { West, East } /// - /// Longitude coordinate. Between −180°(West) and +180°(East) + /// Longitude coordinate. Between −180°(West) and +180°(East). /// public class Longitude : Coordinate, IEquatable { /// - /// Position of Longitude + /// Position of Longitude. /// public LongitudePosition Position { get; set; } + /// /// - /// Initializes a new instance of the class from longitude data. + /// Initializes a new instance of the class from longitude data. /// /// The longitude of the location in deegrees. May range from -180.0 to 180.0. - /// + /// public Longitude(double degrees) : base(degrees) { @@ -31,25 +35,26 @@ public Longitude(double degrees) PositionSet(degrees); } + /// /// - /// Initializes a new instance of the class from longitude data. + /// Initializes a new instance of the class from longitude data. /// /// The longitude of the location in deegrees. May range from -180.0 to 180.0. /// Minutes part of latitude. May range from 0 to 60.0. - /// + /// public Longitude(double degrees, double minutes) : base(degrees, minutes) { PositionSet(degrees); } + /// /// - /// Initializes a new instance of the class from longitude data. + /// Initializes a new instance of the class from longitude data. /// /// The of the location in deegrees. May range from -180.0 to 180.0. /// Minutes part of . May range from 0 to 60.0. /// Seconds part of . May range from 0 to 60.0. - /// public Longitude(double degrees, double minutes, double seconds) : base(degrees, minutes, seconds) { @@ -57,14 +62,13 @@ public Longitude(double degrees, double minutes, double seconds) } /// - /// Returns coordinate with Position, converted to Degrees double value + /// Returns coordinate with Position, converted to Degrees double value. /// - /// Longitude degrees - /// Longitude minutes - /// Longitude seconds - /// Longitude position - /// Degrees double value - + /// Longitude degrees. + /// Longitude minutes. + /// Longitude seconds. + /// Longitude position. + /// Degrees double value. public static double ToDegrees(double degrees, double minutes, double seconds, LongitudePosition position) { var toDouble = Math.Abs(degrees) + minutes / 60 + seconds / 3600; @@ -73,10 +77,11 @@ public static double ToDegrees(double degrees, double minutes, double seconds, L : toDouble * -1; } + /// /// - /// Returns coordinate, converted to Degrees double value + /// Returns coordinate, converted to Degrees double value. /// - /// Degrees double value + /// Degrees double value. public override double ToDegrees() { return Position == LongitudePosition.East @@ -88,7 +93,7 @@ public override double ToDegrees() /// Initializes a new instance of the class from degrees value. /// /// Degrees value. - /// Instance of the + /// Instance of the . public static Longitude FromDegrees(double degreesValue) { return new Longitude(degreesValue); @@ -98,18 +103,18 @@ public static Longitude FromDegrees(double degreesValue) /// Initializes a new instance of the class from radians value. /// /// Radians value. - /// Instance of the + /// Instance of the . public static Longitude FromRadians(double radiansValue) { return new Longitude(radiansValue * 180d / Math.PI); } /// - /// Converts the string representation of Longitude degrees value to object + /// Converts the string representation of Longitude degrees value to object. /// - /// String representation of Longitude degrees value - /// Longitude object - /// Conversion successed or failed + /// String representation of Longitude degrees value. + /// Longitude object. + /// Conversion successed or failed. public static bool TryParse(string stringvalue, out Longitude latitude) { var isSuccessParse = double.TryParse(stringvalue, out var result);