-
Notifications
You must be signed in to change notification settings - Fork 6
Add .editorconfig file to maintain consistent code style #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
43c37d0
Initial plan for issue
Copilot 4d4163f
Add .editorconfig file to repository root
Copilot 35fb6cf
Add dotnet-format check to CI workflow
Copilot 4f2cb93
Format all source files according to .editorconfig rules
Copilot f3809c2
Convert to file scoped namespaces.
lukaskabrt e21cf0f
Create initial plan to fix formatting issues
Copilot 723d08b
Partial formatting fixes from dotnet format
Copilot 8e40f05
Fix formatting issues and build errors
Copilot 422301c
Fix Assert.Equal assertions in OsmGeometryDatabaseTests.cs
Copilot 2382fab
Fix formatting issues
lukaskabrt 2ab3595
Fix formatting
lukaskabrt 4d07ad0
Fix formatting
lukaskabrt 8aacb5b
Fix formatting issues according to .editorconfig rules
Copilot 9280ef0
Add System.Globalization using and simplify CultureInfo access
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| using System.Reflection; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| // General Information about an assembly is controlled through the following | ||
| // set of attributes. Change these attribute values to modify the information | ||
| // associated with an assembly. | ||
| [assembly: AssemblyConfiguration("")] | ||
| [assembly: AssemblyCompany("")] | ||
| [assembly: AssemblyProduct("Benchmark.SpatialLite.Osm")] | ||
| [assembly: AssemblyTrademark("")] | ||
|
|
||
| // Setting ComVisible to false makes the types in this assembly not visible | ||
| // to COM components. If you need to access a type in this assembly from | ||
| // COM, set the ComVisible attribute to true on that type. | ||
| [assembly: ComVisible(false)] | ||
|
|
||
| // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
| [assembly: Guid("ebe5e8af-6eda-4967-ab80-df979d3dd720")] | ||
| using System.Reflection; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
| // General Information about an assembly is controlled through the following | ||
| // set of attributes. Change these attribute values to modify the information | ||
| // associated with an assembly. | ||
| [assembly: AssemblyConfiguration("")] | ||
| [assembly: AssemblyCompany("")] | ||
| [assembly: AssemblyProduct("Benchmark.SpatialLite.Osm")] | ||
| [assembly: AssemblyTrademark("")] | ||
| // Setting ComVisible to false makes the types in this assembly not visible | ||
| // to COM components. If you need to access a type in this assembly from | ||
| // COM, set the ComVisible attribute to true on that type. | ||
| [assembly: ComVisible(false)] | ||
| // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
| [assembly: Guid("ebe5e8af-6eda-4967-ab80-df979d3dd720")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,169 +1,185 @@ | ||
| using System; | ||
|
|
||
| namespace SpatialLite.Core.API { | ||
| namespace SpatialLite.Core.API; | ||
|
|
||
| /// <summary> | ||
| /// Represents a location in the coordinate space. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// A Coordinate may include a M value. The M value allows an application to associate some measure with the <c>Coordinate</c>. | ||
| /// </remarks> | ||
| public struct Coordinate : IEquatable<Coordinate> | ||
| { | ||
|
|
||
| /// <summary> | ||
| /// Represents a location in the coordinate space. | ||
| /// Represents an empty coordinate. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// A Coordinate may include a M value. The M value allows an application to associate some measure with the <c>Coordinate</c>. | ||
| /// The empty coordinate has all coordinates equal to NaN. | ||
| /// </remarks> | ||
| public struct Coordinate : IEquatable<Coordinate> { | ||
|
|
||
| /// <summary> | ||
| /// Represents an empty coordinate. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// The empty coordinate has all coordinates equal to NaN. | ||
| /// </remarks> | ||
| public static Coordinate Empty = new Coordinate(double.NaN, double.NaN, double.NaN, double.NaN); | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <c>Coordinate</c> struct with X, Y ordinates. | ||
| /// </summary> | ||
| /// <param name="x">X-coordinate value.</param> | ||
| /// <param name="y">Y-coordinate value.</param> | ||
| public Coordinate(double x, double y) { | ||
| X = x; | ||
| Y = y; | ||
| Z = double.NaN; | ||
| M = double.NaN; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <c>Coordinate</c> struct with X, Y, Z ordinates. | ||
| /// </summary> | ||
| /// <param name="x">X-coordinate value.</param> | ||
| /// <param name="y">Y-coordinate value.</param> | ||
| /// <param name="z">Z-coordinate value.</param> | ||
| public Coordinate(double x, double y, double z) { | ||
| X = x; | ||
| Y = y; | ||
| Z = z; | ||
| M = double.NaN; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <c>Coordinate</c> struct with X, Y, Z ordinates and M value. | ||
| /// </summary> | ||
| /// <param name="x">X-coordinate value.</param> | ||
| /// <param name="y">Y-coordinate value.</param> | ||
| /// <param name="z">Z-coordinate value.</param> | ||
| /// <param name="m">Measured value associated with the Coordinate.</param> | ||
| public Coordinate(double x, double y, double z, double m) { | ||
| X = x; | ||
| Y = y; | ||
| Z = z; | ||
| M = m; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the X-coordinate | ||
| /// </summary> | ||
| public double X { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the Y-coordinate | ||
| /// </summary> | ||
| public double Y { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the Z-coordinate | ||
| /// </summary> | ||
| public double Z { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the M value | ||
| /// </summary> | ||
| public double M { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets a value indicating whether this coordinate has assigned <see cref="Coordinate.Z"/> coordinate. | ||
| /// </summary> | ||
| public bool Is3D { | ||
| get { | ||
| return !double.IsNaN(this.Z); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets a value indicating whether this coordinate has assigned <see cref="Coordinate.M"/> value. | ||
| /// </summary> | ||
| public bool IsMeasured { | ||
| get { | ||
| return !double.IsNaN(this.M); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determiens whether specific Coordinates values are equal | ||
| /// </summary> | ||
| /// <param name="lhs">Coordinate to compare</param> | ||
| /// <param name="rhs">Coordinate to compare</param> | ||
| /// <returns>true if the specified <c>Coordinate</c> values are equal; otherwise, false.</returns> | ||
| public static bool operator ==(Coordinate lhs, Coordinate rhs) { | ||
| return lhs.Equals(rhs); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determiens whether specific Coordinate values are not equal | ||
| /// </summary> | ||
| /// <param name="lhs">Coordinate to compare</param> | ||
| /// <param name="rhs">Coordinate to compare</param> | ||
| /// <returns>true if the specified <c>Coordinate</c> values are not equal; otherwise, false.</returns> | ||
| public static bool operator !=(Coordinate lhs, Coordinate rhs) { | ||
| return !(lhs == rhs); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Returns a <c>string</c> that represents the current <c>Coordinate</c>. | ||
| /// </summary> | ||
| /// <returns>A <c>string</c> that represents the current <c>Coordinate</c></returns> | ||
| public override string ToString() { | ||
| return string.Format(System.Globalization.CultureInfo.InvariantCulture, "[{0}; {1}; {2}, {3}]", this.X, this.Y, this.Z, this.M); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determines whether specific <c>object</c> instance is equal to the current <c>Coordinate</c>. | ||
| /// </summary> | ||
| /// <param name="obj">The <c>object</c> to compare with the current <c>Coordinate</c></param> | ||
| /// <returns>true if the specified <c>object</c> is equal to the current <c>Coordinate</c>; otherwise, false.</returns> | ||
| public override bool Equals(object obj) { | ||
| Coordinate? other = obj as Coordinate?; | ||
| if (other == null) { | ||
| return false; | ||
| } | ||
|
|
||
| return this.Equals(other.Value); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determines whether two <c>Coordinate</c> values are equal. | ||
| /// </summary> | ||
| /// <param name="other">The <c>Coordinate</c> to compare with the current <c>Coordinate</c></param> | ||
| /// <returns>true if the specified <c>Coordinate</c> is equal to the current <c>Coordinate</c>; otherwise, false.</returns> | ||
| public bool Equals(Coordinate other) { | ||
| return ((this.X == other.X) || (double.IsNaN(this.X) && double.IsNaN(other.X))) && | ||
| ((this.Y == other.Y) || (double.IsNaN(this.Y) && double.IsNaN(other.Y))) && | ||
| ((this.Z == other.Z) || (double.IsNaN(this.Z) && double.IsNaN(other.Z))) && | ||
| ((this.M == other.M) || (double.IsNaN(this.M) && double.IsNaN(other.M))); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Serves as a hash function for the <c>Coordinate</c> structure. | ||
| /// </summary> | ||
| /// <returns>Hash code for current Coordinate value.</returns> | ||
| public override int GetHashCode() { | ||
| return X.GetHashCode() + 7 * Y.GetHashCode() + 13 * Z.GetHashCode() + 17 * M.GetHashCode(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determines whether two <c>Coordinate</c> are equal in 2D space. | ||
| /// </summary> | ||
| /// <param name="other">The <c>Coordinate</c> to compare with the current <c>Coordinate</c></param> | ||
| /// <returns>true if the specified <c>Coordinate</c> is equal to the current <c>Coordinate</c> in 2D space otherwise, false.</returns> | ||
| public bool Equals2D(Coordinate other) { | ||
| return ((this.X == other.X) || (double.IsNaN(this.X) && double.IsNaN(other.X))) && | ||
| ((this.Y == other.Y) || (double.IsNaN(this.Y) && double.IsNaN(other.Y))); | ||
| } | ||
| } | ||
| public static Coordinate Empty = new Coordinate(double.NaN, double.NaN, double.NaN, double.NaN); | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <c>Coordinate</c> struct with X, Y ordinates. | ||
| /// </summary> | ||
| /// <param name="x">X-coordinate value.</param> | ||
| /// <param name="y">Y-coordinate value.</param> | ||
| public Coordinate(double x, double y) | ||
| { | ||
| X = x; | ||
| Y = y; | ||
| Z = double.NaN; | ||
| M = double.NaN; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <c>Coordinate</c> struct with X, Y, Z ordinates. | ||
| /// </summary> | ||
| /// <param name="x">X-coordinate value.</param> | ||
| /// <param name="y">Y-coordinate value.</param> | ||
| /// <param name="z">Z-coordinate value.</param> | ||
| public Coordinate(double x, double y, double z) | ||
| { | ||
| X = x; | ||
| Y = y; | ||
| Z = z; | ||
| M = double.NaN; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <c>Coordinate</c> struct with X, Y, Z ordinates and M value. | ||
| /// </summary> | ||
| /// <param name="x">X-coordinate value.</param> | ||
| /// <param name="y">Y-coordinate value.</param> | ||
| /// <param name="z">Z-coordinate value.</param> | ||
| /// <param name="m">Measured value associated with the Coordinate.</param> | ||
| public Coordinate(double x, double y, double z, double m) | ||
| { | ||
| X = x; | ||
| Y = y; | ||
| Z = z; | ||
| M = m; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the X-coordinate | ||
| /// </summary> | ||
| public double X { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the Y-coordinate | ||
| /// </summary> | ||
| public double Y { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the Z-coordinate | ||
| /// </summary> | ||
| public double Z { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the M value | ||
| /// </summary> | ||
| public double M { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets a value indicating whether this coordinate has assigned <see cref="Coordinate.Z"/> coordinate. | ||
| /// </summary> | ||
| public bool Is3D | ||
| { | ||
| get | ||
| { | ||
| return !double.IsNaN(this.Z); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets a value indicating whether this coordinate has assigned <see cref="Coordinate.M"/> value. | ||
| /// </summary> | ||
| public bool IsMeasured | ||
| { | ||
| get | ||
| { | ||
| return !double.IsNaN(this.M); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determiens whether specific Coordinates values are equal | ||
| /// </summary> | ||
| /// <param name="lhs">Coordinate to compare</param> | ||
| /// <param name="rhs">Coordinate to compare</param> | ||
| /// <returns>true if the specified <c>Coordinate</c> values are equal; otherwise, false.</returns> | ||
| public static bool operator ==(Coordinate lhs, Coordinate rhs) | ||
| { | ||
| return lhs.Equals(rhs); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determiens whether specific Coordinate values are not equal | ||
| /// </summary> | ||
| /// <param name="lhs">Coordinate to compare</param> | ||
| /// <param name="rhs">Coordinate to compare</param> | ||
| /// <returns>true if the specified <c>Coordinate</c> values are not equal; otherwise, false.</returns> | ||
| public static bool operator !=(Coordinate lhs, Coordinate rhs) | ||
| { | ||
| return !(lhs == rhs); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Returns a <c>string</c> that represents the current <c>Coordinate</c>. | ||
| /// </summary> | ||
| /// <returns>A <c>string</c> that represents the current <c>Coordinate</c></returns> | ||
| public override string ToString() | ||
| { | ||
| return string.Format(System.Globalization.CultureInfo.InvariantCulture, "[{0}; {1}; {2}, {3}]", this.X, this.Y, this.Z, this.M); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determines whether specific <c>object</c> instance is equal to the current <c>Coordinate</c>. | ||
| /// </summary> | ||
| /// <param name="obj">The <c>object</c> to compare with the current <c>Coordinate</c></param> | ||
| /// <returns>true if the specified <c>object</c> is equal to the current <c>Coordinate</c>; otherwise, false.</returns> | ||
| public override bool Equals(object obj) | ||
| { | ||
| Coordinate? other = obj as Coordinate?; | ||
| if (other == null) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| return this.Equals(other.Value); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determines whether two <c>Coordinate</c> values are equal. | ||
| /// </summary> | ||
| /// <param name="other">The <c>Coordinate</c> to compare with the current <c>Coordinate</c></param> | ||
| /// <returns>true if the specified <c>Coordinate</c> is equal to the current <c>Coordinate</c>; otherwise, false.</returns> | ||
| public bool Equals(Coordinate other) | ||
| { | ||
| return ((this.X == other.X) || (double.IsNaN(this.X) && double.IsNaN(other.X))) && | ||
| ((this.Y == other.Y) || (double.IsNaN(this.Y) && double.IsNaN(other.Y))) && | ||
| ((this.Z == other.Z) || (double.IsNaN(this.Z) && double.IsNaN(other.Z))) && | ||
| ((this.M == other.M) || (double.IsNaN(this.M) && double.IsNaN(other.M))); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Serves as a hash function for the <c>Coordinate</c> structure. | ||
| /// </summary> | ||
| /// <returns>Hash code for current Coordinate value.</returns> | ||
| public override int GetHashCode() | ||
| { | ||
| return X.GetHashCode() + 7 * Y.GetHashCode() + 13 * Z.GetHashCode() + 17 * M.GetHashCode(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determines whether two <c>Coordinate</c> are equal in 2D space. | ||
| /// </summary> | ||
| /// <param name="other">The <c>Coordinate</c> to compare with the current <c>Coordinate</c></param> | ||
| /// <returns>true if the specified <c>Coordinate</c> is equal to the current <c>Coordinate</c> in 2D space otherwise, false.</returns> | ||
| public bool Equals2D(Coordinate other) | ||
| { | ||
| return ((this.X == other.X) || (double.IsNaN(this.X) && double.IsNaN(other.X))) && | ||
| ((this.Y == other.Y) || (double.IsNaN(this.Y) && double.IsNaN(other.Y))); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.