Skip to content

Commit

Permalink
Auto-fix all IDE0007 and IDE0008
Browse files Browse the repository at this point in the history
  • Loading branch information
airbreather committed Jun 14, 2018
1 parent 0539675 commit 59a9b53
Show file tree
Hide file tree
Showing 541 changed files with 3,803 additions and 3,803 deletions.
Expand Up @@ -25,14 +25,14 @@ public static Envelope TransformBox(Envelope box, IMathTransform transform)
{
if (box == null) return null;

var corners = new double[4][];
double[][] corners = new double[4][];
corners[0] = transform.Transform(ToArray(box.MinX, box.MinY)); //LL
corners[1] = transform.Transform(ToArray(box.MaxX, box.MaxY)); //UR
corners[2] = transform.Transform(ToArray(box.MinX, box.MaxY)); //UL
corners[3] = transform.Transform(ToArray(box.MaxX, box.MinY)); //LR

var result = new Envelope();
foreach (var p in corners)
foreach (double[] p in corners)
result.ExpandToInclude(p[0], p[1]);
return result;
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public static Envelope TransformBox(Envelope box, IMathTransform transform)
IPolygon p, IMathTransform transform)
{
var holes = new List<ILinearRing>(p.InteriorRings.Length);
for (var i = 0; i < p.InteriorRings.Length; i++)
for (int i = 0; i < p.InteriorRings.Length; i++)
{
var hole = TransformLinearRing(factory,
(ILinearRing) p.InteriorRings[i], transform);
Expand All @@ -159,7 +159,7 @@ public static Envelope TransformBox(Envelope box, IMathTransform transform)
var ordinates = OrdinatesUtility.ToOrdinateArray(ordinateFlags);
var coordSequence = factory.CoordinateSequenceFactory.Create(points.NumPoints, ordinateFlags);

for (var i = 0; i < points.NumGeometries; i++)
for (int i = 0; i < points.NumGeometries; i++)
{
var currPoint = (IPoint) points.GetGeometryN(i);
var seq = currPoint.CoordinateSequence;
Expand Down
6 changes: 3 additions & 3 deletions NetTopologySuite.Lab/Geometries/Utilities/GeometryEditorEx.cs
Expand Up @@ -165,7 +165,7 @@ private IGeometry EditInternal(IGeometry geometry)
return EditLineString((ILineString)geometry);
}

var err = string.Format("Unsupported Geometry class: {0}", geometry.GetType().Name);
string err = string.Format("Unsupported Geometry class: {0}", geometry.GetType().Name);
Assert.ShouldNeverReachHere(err);
return null;
}
Expand Down Expand Up @@ -242,7 +242,7 @@ private IPolygon EditPolygon(IPolygon polygon)
}

IList<ILinearRing> holes = new List<ILinearRing>(newPolygon.NumInteriorRings);
for (var i = 0; i < newPolygon.NumInteriorRings; i++)
for (int i = 0; i < newPolygon.NumInteriorRings; i++)
{
var hole = (ILinearRing)Edit(newPolygon.GetInteriorRingN(i));
if (hole == null || hole.IsEmpty)
Expand All @@ -267,7 +267,7 @@ private IGeometryCollection EditGeometryCollection(IGeometryCollection collectio

// edit the component geometries
var geometries = new List<IGeometry>(collectionForType.NumGeometries);
for (var i = 0; i < collectionForType.NumGeometries; i++)
for (int i = 0; i < collectionForType.NumGeometries; i++)
{
var geometry = Edit(collectionForType.GetGeometryN(i));
if (geometry == null || geometry.IsEmpty)
Expand Down
26 changes: 13 additions & 13 deletions NetTopologySuite.Lab/Operation/Buffer/VariableWidthBuffer.cs
Expand Up @@ -24,7 +24,7 @@ public class VariableWidthBuffer
public static IGeometry Buffer(ILineString line, double startWidth,
double endWidth)
{
var width = Interpolate(line, startWidth, endWidth);
double[] width = Interpolate(line, startWidth, endWidth);
var vb = new VariableWidthBuffer(line, width);
return vb.GetResult();
}
Expand All @@ -45,28 +45,28 @@ public class VariableWidthBuffer
{
start = Math.Abs(start);
end = Math.Abs(end);
var widths = new double[line.NumPoints];
double[] widths = new double[line.NumPoints];
widths[0] = start;
widths[widths.Length - 1] = end;

var totalLen = line.Length;
double totalLen = line.Length;
var pts = line.Coordinates;
var currLen = 0.0;
double currLen = 0.0;
for (int i = 1; i < widths.Length; i++)
{
var segLen = pts[i].Distance(pts[i - 1]);
double segLen = pts[i].Distance(pts[i - 1]);
currLen += segLen;
var lenFrac = currLen / totalLen;
var delta = lenFrac * (end - start);
double lenFrac = currLen / totalLen;
double delta = lenFrac * (end - start);
widths[i] = start + delta;
}
return widths;
}

private static double[] Abs(double[] v)
{
var a = new double[v.Length];
for (var i = 0; i < v.Length; i++)
double[] a = new double[v.Length];
for (int i = 0; i < v.Length; i++)
{
a[i] = Math.Abs(v[i]);
}
Expand Down Expand Up @@ -100,9 +100,9 @@ public IGeometry GetResult()
var parts = new List<IGeometry>();

var pts = _line.Coordinates;
for (var i = 0; i < _line.NumPoints; i++)
for (int i = 0; i < _line.NumPoints; i++)
{
var dist = _width[i] / 2;
double dist = _width[i] / 2;
var ptBuf = _line.GetPointN(i).Buffer(dist);
parts.Add(ptBuf);

Expand All @@ -125,8 +125,8 @@ public IGeometry GetResult()
{
var seg = new LineSegment(p0, p1);

var dist0 = width0 / 2;
var dist1 = width1 / 2;
double dist0 = width0 / 2;
double dist1 = width1 / 2;
var s0 = seg.PointAlongOffset(0, dist0);
var s1 = seg.PointAlongOffset(1, dist1);
var s2 = seg.PointAlongOffset(1, -dist1);
Expand Down
Expand Up @@ -19,7 +19,7 @@ public GeometryCoordinateReplacer(IDictionary<IGeometry, Coordinate[]> linesMap)
{
if (_geometryLinesMap.ContainsKey(geometry))
{
Coordinate[] pts = _geometryLinesMap[geometry];
var pts = _geometryLinesMap[geometry];
// Assert: pts should always have length > 0
bool isValidPts = IsValidSize(pts, geometry);
if (!isValidPts) return null;
Expand Down
6 changes: 3 additions & 3 deletions NetTopologySuite.Lab/SnapRound/GeometrySnapRounder.cs
Expand Up @@ -112,7 +112,7 @@ private void SnapRound(IList<ISegmentString> segStrings)
if (nss.Count < 2)
continue;
//Coordinate[] pts = getCoords(nss);
Coordinate[] pts = nss.NodeList.GetSplitCoordinates();
var pts = nss.NodeList.GetSplitCoordinates();

ptsMap.Add((IGeometry)nss.Context, pts);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ private static Coordinate[] Round(ICoordinateSequence seq, IPrecisionModel pm)
{
if (seq.Count == 0) return new Coordinate[0];

CoordinateList coordList = new CoordinateList();
var coordList = new CoordinateList();
// copy coordinates and reduce
for (int i = 0; i < seq.Count; i++)
{
Expand All @@ -153,7 +153,7 @@ private static Coordinate[] Round(ICoordinateSequence seq, IPrecisionModel pm)
pm.MakePrecise(coord);
coordList.Add(coord, false);
}
Coordinate[] coords = coordList.ToCoordinateArray();
var coords = coordList.ToCoordinateArray();

//TODO: what if seq is too short?
return coords;
Expand Down
2 changes: 1 addition & 1 deletion NetTopologySuite.Lab/SnapRound/SnapRoundFunctions.cs
Expand Up @@ -37,7 +37,7 @@ public static class SnapRoundFunctions
geom = geomA.Factory.CreateGeometryCollection(new IGeometry[] { geomA, geomB });
}

GeometrySnapRounder gsr = new GeometrySnapRounder(pm);
var gsr = new GeometrySnapRounder(pm);
var snapped = gsr.Execute(geom);
return snapped;
}
Expand Down
8 changes: 4 additions & 4 deletions NetTopologySuite.Lab/SnapRound/SnapRoundOverlayFunctions.cs
Expand Up @@ -11,7 +11,7 @@ public static IGeometry SnappedIntersection(this IGeometry geomA, IGeometry geom

public static IGeometry Intersection(IGeometry geomA, IGeometry geomB, double scaleFactor)
{
IGeometry[] geom = SnapClean(geomA, geomB, scaleFactor);
var geom = SnapClean(geomA, geomB, scaleFactor);
return geom[0].Intersection(geom[1]);
}

Expand All @@ -22,7 +22,7 @@ public static IGeometry SnappedDifference(this IGeometry geomA, IGeometry geomB,

public static IGeometry Difference(IGeometry geomA, IGeometry geomB, double scaleFactor)
{
IGeometry[] geom = SnapClean(geomA, geomB, scaleFactor);
var geom = SnapClean(geomA, geomB, scaleFactor);
return geom[0].Difference(geom[1]);
}

Expand All @@ -33,7 +33,7 @@ public static IGeometry SnappedSymmetricDifference(this IGeometry geomA, IGeomet

public static IGeometry SymmetricDifference(IGeometry geomA, IGeometry geomB, double scaleFactor)
{
IGeometry[] geom = SnapClean(geomA, geomB, scaleFactor);
var geom = SnapClean(geomA, geomB, scaleFactor);
return geom[0].SymmetricDifference(geom[1]);
}

Expand All @@ -44,7 +44,7 @@ public static IGeometry SnappedUnion(this IGeometry geomA, IGeometry geomB, doub

public static IGeometry Union(IGeometry geomA, IGeometry geomB, double scaleFactor)
{
IGeometry[] geom = SnapClean(geomA, geomB, scaleFactor);
var geom = SnapClean(geomA, geomB, scaleFactor);
return geom[0].Union(geom[1]);
}

Expand Down
Expand Up @@ -12,7 +12,7 @@ public class CreateOrientationDistanceMesh
[Test]
public void BuildGeometries()
{
Coordinate coord = new Coordinate(3412805, 5320858);
var coord = new Coordinate(3412805, 5320858);

var orientation =
new List<string>(new[]
Expand All @@ -25,11 +25,11 @@ public void BuildGeometries()

var slices = BuildSlices(coord);
int distance = 0;
foreach (IGeometry geometry in BuildConcentricBuffers(coord))
foreach (var geometry in BuildConcentricBuffers(coord))
{
distance += 5;
var orIt = orientation.GetEnumerator();
foreach (IGeometry slice in slices)
foreach (var slice in slices)
{
orIt.MoveNext();
var geom = geometry.Intersection(slice);
Expand All @@ -41,9 +41,9 @@ public void BuildGeometries()

public IEnumerable<IGeometry> BuildConcentricBuffers(Coordinate coord)
{
IPoint center = GeometryFactory.Floating.CreatePoint(coord);
var center = GeometryFactory.Floating.CreatePoint(coord);
IPolygon lastPolygon = null;
var distance = 0;
int distance = 0;
while (distance <= 100000)
{
distance += 5000;
Expand Down
4 changes: 2 additions & 2 deletions NetTopologySuite.Samples.Console/Geometries/basicexample.cs
Expand Up @@ -14,7 +14,7 @@ public class BasicExample
public static void main(string[] args)
{
// read a point from a WKT string (using the default point factory)
IGeometry g1 = new WKTReader().Read("LINESTRING (0 0, 10 10, 20 20)");
var g1 = new WKTReader().Read("LINESTRING (0 0, 10 10, 20 20)");
Console.WriteLine("Geometry 1: " + g1);

// create a point by specifying the coordinates directly
Expand All @@ -25,7 +25,7 @@ public static void main(string[] args)
Console.WriteLine("Geometry 2: " + g2);

// compute the intersection of the two geometries
IGeometry g3 = g1.Intersection(g2);
var g3 = g1.Intersection(g2);
Console.WriteLine("G1 intersection G2: " + g3);
}
}
Expand Down
Expand Up @@ -19,15 +19,15 @@ public class ConstructionExample
public static void main(string[] args)
{
// create a factory using default values (e.g. floating precision)
GeometryFactory fact = new GeometryFactory();
var fact = new GeometryFactory();

IPoint p1 = fact.CreatePoint(new Coordinate(0, 0));
var p1 = fact.CreatePoint(new Coordinate(0, 0));
Console.WriteLine(p1);

IPoint p2 = fact.CreatePoint(new Coordinate(1, 1));
var p2 = fact.CreatePoint(new Coordinate(1, 1));
Console.WriteLine(p1);

IMultiPoint mpt = fact.CreateMultiPoint(new Coordinate[]{ new Coordinate(0, 0), new Coordinate(1, 1), });
var mpt = fact.CreateMultiPoint(new Coordinate[]{ new Coordinate(0, 0), new Coordinate(1, 1), });
Console.WriteLine(mpt);
}
}
Expand Down
Expand Up @@ -9,18 +9,18 @@ public class ExtendedCoordinateExample
[STAThread]
public static void main(string[] args)
{
ExtendedCoordinateSequenceFactory seqFact = ExtendedCoordinateSequenceFactory.Instance();
var seqFact = ExtendedCoordinateSequenceFactory.Instance();

ExtendedCoordinate[] array1 = new ExtendedCoordinate[] { new ExtendedCoordinate(0, 0, 0, 91),
var array1 = new ExtendedCoordinate[] { new ExtendedCoordinate(0, 0, 0, 91),
new ExtendedCoordinate(10, 0, 0, 92), new ExtendedCoordinate(10, 10, 0, 93),
new ExtendedCoordinate(0, 10, 0, 94), new ExtendedCoordinate(0, 0, 0, 91)};
ICoordinateSequence seq1 = seqFact.Create(array1);
var seq1 = seqFact.Create(array1);

ICoordinateSequence seq2 = seqFact.Create(new ExtendedCoordinate[] { new ExtendedCoordinate(5, 5, 0, 91),
var seq2 = seqFact.Create(new ExtendedCoordinate[] { new ExtendedCoordinate(5, 5, 0, 91),
new ExtendedCoordinate(15, 5, 0, 92), new ExtendedCoordinate(15, 15, 0, 93),
new ExtendedCoordinate(5, 15, 0, 94), new ExtendedCoordinate(5, 5, 0, 91)});

GeometryFactory fact = new GeometryFactory(ExtendedCoordinateSequenceFactory.Instance());
var fact = new GeometryFactory(ExtendedCoordinateSequenceFactory.Instance());

IGeometry g1 = fact.CreatePolygon(fact.CreateLinearRing(seq1), null);
IGeometry g2 = fact.CreatePolygon(fact.CreateLinearRing(seq2), null);
Expand All @@ -31,7 +31,7 @@ public static void main(string[] args)
Console.WriteLine("WKT for g2: " + g2);
Console.WriteLine("Internal rep for g2: " + ((IPolygon)g2).ExteriorRing.CoordinateSequence);

IGeometry gInt = g1.Intersection(g2);
var gInt = g1.Intersection(g2);

Console.WriteLine("WKT for gInt: " + gInt);
Console.WriteLine("Internal rep for gInt: " + ((IPolygon)gInt).ExteriorRing.CoordinateSequence);
Expand Down
Expand Up @@ -24,7 +24,7 @@ public static ExtendedCoordinate[] Copy(Coordinate[] coordinates)
private static Coordinate[] CopyInternal(Coordinate[] coordinates)
{
var copy = new Coordinate[coordinates.Length];
for (var i = 0; i < coordinates.Length; i++)
for (int i = 0; i < coordinates.Length; i++)
copy[i] = new ExtendedCoordinate(coordinates[i]);
return copy;

Expand Down Expand Up @@ -85,7 +85,7 @@ public object Clone()
public ICoordinateSequence Copy()
{
var cloneCoordinates = new ExtendedCoordinate[Count];
for (var i = 0; i < _coordinates.Length; i++)
for (int i = 0; i < _coordinates.Length; i++)
{
cloneCoordinates[i] = (ExtendedCoordinate) _coordinates[i].Copy();
}
Expand Down Expand Up @@ -124,7 +124,7 @@ public virtual Coordinate[] ToCoordinateArray()
/// </returns>
public override string ToString()
{
StringBuilder strBuf = new StringBuilder();
var strBuf = new StringBuilder();
strBuf.Append("ExtendedCoordinateSequence [");
for (int i = 0; i < _coordinates.Length; i++)
{
Expand Down Expand Up @@ -261,7 +261,7 @@ public Envelope ExpandEnvelope(Envelope env)
public ICoordinateSequence Reversed()
{
var coordinates = new ExtendedCoordinate[Count];
for (var i = 0; i < Count; i++)
for (int i = 0; i < Count; i++)
{
coordinates[Count - i - 1] = new ExtendedCoordinate(coordinates[i]);
}
Expand Down
Expand Up @@ -19,7 +19,7 @@ public class PrecisionModelExample
[STAThread]
public static void main(string[] args)
{
PrecisionModelExample example = new PrecisionModelExample();
var example = new PrecisionModelExample();
try
{
example.Run();
Expand Down Expand Up @@ -68,12 +68,12 @@ public virtual void Example2()
public virtual void Intersection(string wktA, string wktB, PrecisionModel pm)
{
Console.WriteLine("Running example using Precision Model = " + pm);
GeometryFactory fact = new GeometryFactory(pm);
WKTReader wktRdr = new WKTReader(fact);
var fact = new GeometryFactory(pm);
var wktRdr = new WKTReader(fact);

IGeometry A = wktRdr.Read(wktA);
IGeometry B = wktRdr.Read(wktB);
IGeometry C = A.Intersection(B);
var A = wktRdr.Read(wktA);
var B = wktRdr.Read(wktB);
var C = A.Intersection(B);

Console.WriteLine("A intersection B = " + C);
}
Expand All @@ -82,12 +82,12 @@ public virtual void Difference(string wktA, string wktB, PrecisionModel pm)
{
Console.WriteLine("-------------------------------------------");
Console.WriteLine("Running example using Precision Model = " + pm);
GeometryFactory fact = new GeometryFactory(pm);
WKTReader wktRdr = new WKTReader(fact);
var fact = new GeometryFactory(pm);
var wktRdr = new WKTReader(fact);

IGeometry A = wktRdr.Read(wktA);
IGeometry B = wktRdr.Read(wktB);
IGeometry C = A.Difference(B);
var A = wktRdr.Read(wktA);
var B = wktRdr.Read(wktB);
var C = A.Difference(B);

Console.WriteLine("A intersection B = " + C);
}
Expand Down

0 comments on commit 59a9b53

Please sign in to comment.