-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP/Draft/Spike] First time running UnitTests
- WktTextReader with underlying WktParser now working - Followed spec WKT 1 and looked at existing Unit Tests. - WKT now has its own AST for multiple reasons. - Still need to integrate the new WKT AST with rest of PROJ4Net.
- Loading branch information
Showing
46 changed files
with
3,489 additions
and
483 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace ProjNet.Wkt.Builders | ||
{ | ||
/// <summary> | ||
/// Base for Builder(s). | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
public abstract class Builder<T> | ||
{ | ||
/// <summary> | ||
/// The final Build action. | ||
/// </summary> | ||
/// <returns></returns> | ||
public abstract T Build(); | ||
} | ||
} |
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace ProjNet.Wkt.v1.tree | ||
{ | ||
/// <summary> | ||
/// Extent attribute | ||
/// </summary> | ||
public abstract class Extent : IWktAttribute | ||
{ | ||
/// <summary> | ||
/// Convert (back) to WKT. | ||
/// </summary> | ||
/// <returns></returns> | ||
public abstract string ToWKT(); | ||
|
||
} | ||
} |
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace ProjNet.Wkt.Tree | ||
{ | ||
/// <summary> | ||
/// Base interface for all WKT CRS Objects. | ||
/// </summary> | ||
public interface IWktCrsObject : IWktObject | ||
{ | ||
|
||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace ProjNet.Wkt.Tree | ||
{ | ||
|
||
/// <summary> | ||
/// Base interface for all WKT Objects | ||
/// </summary> | ||
public interface IWktObject | ||
{ | ||
/// <summary> | ||
/// Set Left Delimiter. (For semantic checking). | ||
/// </summary> | ||
/// <param name="leftDelimiter"></param> | ||
/// <returns></returns> | ||
IWktObject SetLeftDelimiter(char leftDelimiter); | ||
|
||
/// <summary> | ||
/// Set Right Delimiter. (For semantic checking). | ||
/// </summary> | ||
/// <param name="rightDelimiter"></param> | ||
/// <returns></returns> | ||
IWktObject SetRightDelimiter(char rightDelimiter); | ||
|
||
|
||
/// <summary> | ||
/// Cast function to reach the "lower" interfaces. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <returns></returns> | ||
T As<T>() where T : IWktObject; | ||
} | ||
} |
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Text; | ||
|
||
namespace ProjNet.Wkt.v1.tree | ||
{ | ||
/// <summary> | ||
/// Remark a simple wkt Attribute. | ||
/// </summary> | ||
public class Remark: IWktAttribute | ||
{ | ||
/// <summary> | ||
/// Text property. | ||
/// </summary> | ||
public string Text { get; set; } | ||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
/// <param name="text"></param> | ||
public Remark(string text) | ||
{ | ||
Text = text; | ||
} | ||
|
||
/// <summary> | ||
/// ToWKT version of this WKT Remark. | ||
/// </summary> | ||
/// <returns></returns> | ||
public string ToWKT() | ||
{ | ||
var sb = new StringBuilder(); | ||
|
||
sb.Append($@"REMARK["""); | ||
sb.Append(Text); | ||
sb.Append($@"""]"); | ||
|
||
return sb.ToString(); | ||
} | ||
|
||
/// <summary> | ||
/// ToString version of this WKT Uri. | ||
/// </summary> | ||
/// <returns></returns> | ||
public override string ToString() | ||
{ | ||
return Text; | ||
} | ||
|
||
} | ||
} |
File renamed without changes.
83 changes: 83 additions & 0 deletions
83
src/ProjNet/Wkt/Tree/ScopeExtentIdentifierRemarkElement.cs
This file contains 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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace ProjNet.Wkt.v1.tree | ||
{ | ||
/// <summary> | ||
/// WktScopeExtentIdentifierRemarkElement class. | ||
/// </summary> | ||
public class ScopeExtentIdentifierRemarkElement : IWktAttribute | ||
{ | ||
/// <summary> | ||
/// Optional Scope attribute. | ||
/// </summary> | ||
public Scope Scope { get; set; } | ||
|
||
/// <summary> | ||
/// Zero or more Extent attribute(s). | ||
/// </summary> | ||
public IList<Extent> Extents { get; set; } = new List<Extent>(); | ||
|
||
/// <summary> | ||
/// Zero or more Identifier attribute(s). | ||
/// </summary> | ||
public IList<Identifier> Identifiers { get; set; } = new List<Identifier>(); | ||
|
||
/// <summary> | ||
/// Optional Remark attrbiute. | ||
/// </summary> | ||
public Remark Remark { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
/// <param name="scope"></param> | ||
/// <param name="extents"></param> | ||
/// <param name="identifiers"></param> | ||
/// <param name="remark"></param> | ||
public ScopeExtentIdentifierRemarkElement( | ||
Scope scope = null, | ||
IList<Extent> extents = null, | ||
IList<Identifier> identifiers = null, | ||
Remark remark = null) | ||
{ | ||
Scope = scope; | ||
Extents = extents ?? Extents; | ||
Identifiers = identifiers ?? Identifiers; | ||
Remark = remark; | ||
} | ||
|
||
public string ToWKT() | ||
{ | ||
var sb = new StringBuilder(); | ||
|
||
if (Scope != null) | ||
{ | ||
sb.Append($",{Scope.ToWKT()}"); | ||
} | ||
|
||
if (Extents != null) | ||
{ | ||
foreach (var extent in Extents) | ||
{ | ||
sb.Append($",{extent.ToWKT()})"); | ||
} | ||
} | ||
if (Identifiers != null) | ||
{ | ||
foreach (var identifier in Identifiers) | ||
{ | ||
sb.Append($",{identifier.ToWKT()})"); | ||
} | ||
} | ||
|
||
if (Remark != null) | ||
{ | ||
sb.Append($",{Remark.ToWKT()}"); | ||
} | ||
|
||
return sb.ToString(); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace ProjNet.Wkt.Tree | ||
{ | ||
/// <summary> | ||
/// WktAngularUnit class. | ||
/// </summary> | ||
public class WktAngularUnit : WktUnit | ||
{ | ||
/// <summary> | ||
/// Constructor for WKT AngularUnit. | ||
/// </summary> | ||
/// <param name="name"></param> | ||
public WktAngularUnit(string name) : base(name) | ||
{ | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.