Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.suo
*.user
*.sln.docstates
.idea

# Build results
[Dd]ebug/
Expand Down
22 changes: 11 additions & 11 deletions src/ProjNet/CoordinateSystems/Projection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// ProjNet is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public License
// along with ProjNet; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

using System;
using System.Collections.Generic;
Expand All @@ -30,11 +30,11 @@ namespace ProjNet.CoordinateSystems
/// interest, e.g., Transverse Mercator, Lambert, will be implemented as a class of
/// type Projection, supporting the IProjection interface.
/// </summary>
[Serializable]
[Serializable]
public class Projection : Info, IProjection
{
internal Projection(string className, List<ProjectionParameter> parameters,
string name, string authority, long code, string alias,
string name, string authority, long code, string alias,
string remarks, string abbreviation)
: base(name, authority, code, alias, abbreviation, remarks)
{
Expand Down Expand Up @@ -84,12 +84,12 @@ public ProjectionParameter GetParameter(int index)
/// <returns>parameter or null if not found</returns>
public ProjectionParameter GetParameter(string name)
{
foreach (ProjectionParameter par in _parameters)
foreach (var par in _parameters)
if (par.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
return par;
return null;
}

private string _ClassName;

/// <summary>
Expand All @@ -108,7 +108,7 @@ public override string WKT
{
get
{
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
sb.AppendFormat("PROJECTION[\"{0}\"", ClassName);
if (!string.IsNullOrWhiteSpace(Authority) && AuthorityCode > 0)
sb.AppendFormat(", AUTHORITY[\"{0}\", \"{1}\"]", Authority, AuthorityCode);
Expand All @@ -124,9 +124,9 @@ public override string XML
{
get
{
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
sb.AppendFormat(CultureInfo.InvariantCulture.NumberFormat, "<CS_Projection Classname=\"{0}\">{1}", ClassName, InfoXml);
foreach (ProjectionParameter param in Parameters)
foreach (var param in Parameters)
sb.Append(param.XML);
sb.Append("</CS_Projection>");
return sb.ToString();
Expand All @@ -144,12 +144,12 @@ public override bool EqualParams(object obj)
{
if (!(obj is Projection))
return false;
Projection proj = obj as Projection;
var proj = obj as Projection;
if (proj.NumParameters != this.NumParameters)
return false;
for (int i = 0; i < _parameters.Count; i++)
{
ProjectionParameter param = GetParameter(proj.GetParameter(i).Name);
var param = GetParameter(proj.GetParameter(i).Name);
if (param == null)
return false;
if (param.Value != proj.GetParameter(i).Value)
Expand Down
17 changes: 9 additions & 8 deletions src/ProjNet/IO/CoordinateSystems/CoordinateSystemWktReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// ProjNet is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public License
// along with ProjNet; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

// SOURCECODE IS MODIFIED FROM ANOTHER WORK AND IS ORIGINALLY BASED ON GeoTools.NET:
/*
* Copyright (C) 2002 Urban Science Applications, Inc.
* Copyright (C) 2002 Urban Science Applications, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -109,7 +109,7 @@ private static IUnit ReadUnit(WktStreamTokenizer tokenizer)
tokenizer.ReadAuthority(out authority, out authorityCode);
tokenizer.ReadCloser(bracket);
}
else
else
tokenizer.CheckCloser(bracket);

return new Unit(unitsPerUnit, unitName, authority, authorityCode, string.Empty, string.Empty, string.Empty);
Expand Down Expand Up @@ -387,8 +387,8 @@ private static ProjectedCoordinateSystem ReadProjectedCoordinateSystem(WktStream
//This is default axis values if not specified.
if (axisInfo.Count == 0)
{
axisInfo.Add(new AxisInfo("X", AxisOrientationEnum.East));
axisInfo.Add(new AxisInfo("Y", AxisOrientationEnum.North));
axisInfo.Add(new AxisInfo("X", AxisOrientationEnum.North));
axisInfo.Add(new AxisInfo("Y", AxisOrientationEnum.East));
}
var projectedCS = new ProjectedCoordinateSystem(geographicCS.HorizontalDatum, geographicCS, unit as LinearUnit, projection, axisInfo, name, authority, authorityCode, string.Empty, string.Empty, string.Empty);
return projectedCS;
Expand Down Expand Up @@ -524,6 +524,7 @@ private static GeographicCoordinateSystem ReadGeographicCoordinateSystem(WktStre
AXIS["Geodetic longitude","EAST"]
AUTHORITY["EPSG","4277"]
]

*/
var bracket = tokenizer.ReadOpener();
string name = tokenizer.ReadDoubleQuotedWord();
Expand Down Expand Up @@ -561,8 +562,8 @@ private static GeographicCoordinateSystem ReadGeographicCoordinateSystem(WktStre
//This is default axis values if not specified.
if (info.Count == 0)
{
info.Add(new AxisInfo("Lon", AxisOrientationEnum.East));
info.Add(new AxisInfo("Lat", AxisOrientationEnum.North));
info.Add(new AxisInfo("Easting", AxisOrientationEnum.East));
info.Add(new AxisInfo("Northing", AxisOrientationEnum.North));
}
var geographicCS = new GeographicCoordinateSystem(angularUnit, horizontalDatum,
primeMeridian, info, name, authority, authorityCode, string.Empty, string.Empty, string.Empty);
Expand Down
2 changes: 1 addition & 1 deletion test/ProjNet.Tests/CoordinateSystemServicesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static IEnumerable<KeyValuePair<int, string>> LoadXml(string xmlPath)
var sridElement = node.Element("SRID");
if (sridElement != null)
{
var srid = int.Parse(sridElement.Value);
int srid = int.Parse(sridElement.Value);
yield return new KeyValuePair<int, string>(srid, node.LastNode.ToString());
}
}
Expand Down