diff --git a/NetTopologySuite.IO.ShapeFile.sln b/NetTopologySuite.IO.ShapeFile.sln index 3b72122..3f4b4f8 100644 --- a/NetTopologySuite.IO.ShapeFile.sln +++ b/NetTopologySuite.IO.ShapeFile.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2009 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31321.278 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B0923F22-AF00-46DA-B5CE-73F4D398DE37}" ProjectSection(SolutionItems) = preProject diff --git a/PerfApp/Perf.cs b/PerfApp/Perf.cs new file mode 100644 index 0000000..9770d5b --- /dev/null +++ b/PerfApp/Perf.cs @@ -0,0 +1,46 @@ +using BenchmarkDotNet.Attributes; +using NetTopologySuite.Geometries; +using NetTopologySuite.IO; +using System.Linq; + +namespace PerfApp +{ + public class Perf + { + private const int Count = 50000; + private const int Step = 10; + + private static readonly GeometryFactory Fac = GeometryFactory.Default; + + private readonly string fname; + + public Perf() + { + var features = Utils.CreateFeatures(Fac, Count, Step).ToList(); + fname = Utils.WriteFeatures(features); + } + + private int InternalRead() + { + int i = 0; + var reader = Shapefile.CreateDataReader(fname, Fac); + while (reader.Read()) + i++; + return i; + } + + [Benchmark] + public int ReadWithFlagDisabled() + { + Shapefile.ExperimentalPolygonBuilderEnabled = false; + return InternalRead(); + } + + [Benchmark] + public int ReadWithFlagEnabled() + { + Shapefile.ExperimentalPolygonBuilderEnabled = true; + return InternalRead(); + } + } +} diff --git a/PerfApp/PerfApp.csproj b/PerfApp/PerfApp.csproj new file mode 100644 index 0000000..2867534 --- /dev/null +++ b/PerfApp/PerfApp.csproj @@ -0,0 +1,36 @@ + + + + Exe + net5.0 + + + + + + + + + + + + + + + + + + + + + nts_patch_595\NetTopologySuite.dll + + + nts_features\NetTopologySuite.Features.dll + + + nts_shapefile\NetTopologySuite.IO.ShapeFile.dll + + + + diff --git a/PerfApp/PerfApp.sln b/PerfApp/PerfApp.sln new file mode 100644 index 0000000..977bb26 --- /dev/null +++ b/PerfApp/PerfApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31321.278 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfApp", "PerfApp.csproj", "{64DBD7B8-EE86-40F3-81BF-4D1E0049662F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64DBD7B8-EE86-40F3-81BF-4D1E0049662F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64DBD7B8-EE86-40F3-81BF-4D1E0049662F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64DBD7B8-EE86-40F3-81BF-4D1E0049662F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64DBD7B8-EE86-40F3-81BF-4D1E0049662F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4FC81A8C-F367-4B21-9955-39FFAE513605} + EndGlobalSection +EndGlobal diff --git a/PerfApp/Program.cs b/PerfApp/Program.cs new file mode 100644 index 0000000..230dd97 --- /dev/null +++ b/PerfApp/Program.cs @@ -0,0 +1,12 @@ +using BenchmarkDotNet.Running; + +namespace PerfApp +{ + class Program + { + static void Main(string[] args) + { + var summary = BenchmarkRunner.Run(); + } + } +} diff --git a/PerfApp/Utils.cs b/PerfApp/Utils.cs new file mode 100644 index 0000000..5a0fc8e --- /dev/null +++ b/PerfApp/Utils.cs @@ -0,0 +1,71 @@ +using NetTopologySuite.Features; +using NetTopologySuite.Geometries; +using NetTopologySuite.IO; +using System.Collections.Generic; +using System.IO; + +namespace PerfApp +{ + internal static class Utils + { + internal static IEnumerable CreateFeatures(GeometryFactory fac, uint count, uint step) + { + var list = new List(); + int counter = 0; + int indexer = 0; + for (uint i = 1; i < count * 10; i += step) + { + var shell = fac.CreateLinearRing(new Coordinate[] + { + new Coordinate(1 * i, 1 * i), + new Coordinate(9 * i, 1 * i), + new Coordinate(9 * i, 9* i), + new Coordinate(1 * i, 9* i), + new Coordinate(1 * i, 1* i), + }); + var hole1 = fac.CreateLinearRing(new Coordinate[] + { + new Coordinate(2* i, 2* i), + new Coordinate(3* i, 3* i), + new Coordinate(4* i, 2* i), + new Coordinate(2* i, 2* i), + }); + var hole2 = fac.CreateLinearRing(new Coordinate[] + { + new Coordinate(6* i, 6* i), + new Coordinate(8* i, 8* i), + new Coordinate(7* i, 6* i), + new Coordinate(6* i, 6* i), + }); + var poly = fac.CreatePolygon(shell, new[] { hole1, hole2 }); + list.Add(poly); + if (++counter >= 100) + { + var mpoly = fac.CreateMultiPolygon(list.ToArray()); + var attrs = new AttributesTable { { "id", ++indexer } }; + yield return new Feature(mpoly, attrs); + + list.Clear(); + counter = 0; + } + } + if (list.Count != 0) + { + var mpoly1 = fac.CreateMultiPolygon(list.ToArray()); + var attrs1 = new AttributesTable { { "id", ++indexer } }; + yield return new Feature(mpoly1, attrs1); + } + } + + internal static string WriteFeatures(IList features) + { + string fname = Path.ChangeExtension(Path.GetTempFileName(), ".shp"); + var header = ShapefileDataWriter.GetHeader(features[0], features.Count); + var writer = new ShapefileDataWriter(fname) { Header = header }; + writer.Write(features); + return Path.Combine( + Path.GetDirectoryName(fname), + Path.GetFileNameWithoutExtension(fname)); + } + } +} diff --git a/PerfApp/nts_develop/NetTopologySuite.deps.json b/PerfApp/nts_develop/NetTopologySuite.deps.json new file mode 100644 index 0000000..e2f9d2b --- /dev/null +++ b/PerfApp/nts_develop/NetTopologySuite.deps.json @@ -0,0 +1,152 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "NetTopologySuite/2.5.0-pre.190390493+local": { + "dependencies": { + "Microsoft.DotNet.ApiCompat": "6.0.0-beta.21159.11", + "Microsoft.SourceLink.GitHub": "1.1.1", + "NETStandard.Library": "2.0.3", + "System.Memory": "4.5.4" + }, + "runtime": { + "NetTopologySuite.dll": {} + } + }, + "Microsoft.Build.Tasks.Git/1.1.1": {}, + "Microsoft.DotNet.ApiCompat/6.0.0-beta.21159.11": {}, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "Microsoft.SourceLink.Common/1.1.1": {}, + "Microsoft.SourceLink.GitHub/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "System.Buffers/4.5.1": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Memory/4.5.4": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.4.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Numerics.Vectors/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.3.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.3": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.4.1", + "fileVersion": "4.6.28619.1" + } + } + } + } + }, + "libraries": { + "NetTopologySuite/2.5.0-pre.190390493+local": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.Build.Tasks.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==", + "path": "microsoft.build.tasks.git/1.1.1", + "hashPath": "microsoft.build.tasks.git.1.1.1.nupkg.sha512" + }, + "Microsoft.DotNet.ApiCompat/6.0.0-beta.21159.11": { + "type": "package", + "serviceable": true, + "sha512": "sha512-SVX3OOq+Jx+DbPETmOjZO4OlHtrJBkAK7+O99crSJYFndveqTLiIIPMI6v5E2xOBEnWQQPwtiFxaVhEtuqHwtA==", + "path": "microsoft.dotnet.apicompat/6.0.0-beta.21159.11", + "hashPath": "microsoft.dotnet.apicompat.6.0.0-beta.21159.11.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "Microsoft.SourceLink.Common/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==", + "path": "microsoft.sourcelink.common/1.1.1", + "hashPath": "microsoft.sourcelink.common.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.GitHub/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", + "path": "microsoft.sourcelink.github/1.1.1", + "hashPath": "microsoft.sourcelink.github.1.1.1.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "System.Buffers/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "path": "system.buffers/4.5.1", + "hashPath": "system.buffers.4.5.1.nupkg.sha512" + }, + "System.Memory/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "path": "system.memory/4.5.4", + "hashPath": "system.memory.4.5.4.nupkg.sha512" + }, + "System.Numerics.Vectors/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", + "path": "system.numerics.vectors/4.4.0", + "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3TIsJhD1EiiT0w2CcDMN/iSSwnNnsrnbzeVHSKkaEgV85txMprmuO+Yq2AdSbeVGcg28pdNDTPK87tJhX7VFHw==", + "path": "system.runtime.compilerservices.unsafe/4.5.3", + "hashPath": "system.runtime.compilerservices.unsafe.4.5.3.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/PerfApp/nts_develop/NetTopologySuite.dll b/PerfApp/nts_develop/NetTopologySuite.dll new file mode 100644 index 0000000..b20f03a Binary files /dev/null and b/PerfApp/nts_develop/NetTopologySuite.dll differ diff --git a/PerfApp/nts_develop/NetTopologySuite.xml b/PerfApp/nts_develop/NetTopologySuite.xml new file mode 100644 index 0000000..d1e0f34 --- /dev/null +++ b/PerfApp/nts_develop/NetTopologySuite.xml @@ -0,0 +1,47789 @@ + + + + NetTopologySuite + + + + + Utility functions for working with angles. + Unless otherwise noted, methods in this class express angles in radians. + + + + + Value of 2 * Pi + + + + + Value of Pi / 2 + + + + + Value of Pi / 4 + + + + + Converts from radians to degrees. + + An angle in radians + The angle in degrees + + + + Converts from degrees to radians. + + An angle in degrees + The angle in radians + + + + Returns the angle of the vector from p0 to p1, relative to the positive X-axis. + + The angle is normalized to be in the range [ -Pi, Pi ]. + The initial point of the vector. + The terminal point of the vector. + The normalized angle (in radians) that p0-p1 makes with the positive X-axis + + + + Returns the angle of the vector from (0,0) to p, relative to the positive X-axis. + + + The angle is normalized to be in the range ( -Pi, Pi ]. + + The terminal point of the vector. + The normalized angle (in radians) that (0,0)-p makes with the positive X-axis. + + + + Tests whether the angle between p0-p1-p2 is acute. + + + An angle is acute if it is less than 90 degrees. + Note: this implementation is not precise (deterministic) for angles very close to 90 degrees. + + An endpoint of the angle + The base of the angle + Another endpoint of the angle + if the angle is acute. + + + + Tests whether the angle between p0-p1-p2 is obtuse + + + An angle is obtuse if it is greater than 90 degrees. + Note: this implementation is not precise (deterministic) for angles very close to 90 degrees. + + An endpoint of the angle + The base of the angle + Another endpoint of the angle + if the angle is obtuse. + + + + Returns the unoriented smallest angle between two vectors. + + + The computed angle will be in the range [0, Pi). + + The tip of one vector + The tail of each vector + The tip of the other vector + + + + Returns the oriented smallest angle between two vectors. + The computed angle will be in the range (-Pi, Pi]. + A positive result corresponds to a rotation (CCW) from v1 to v2; + a negative result corresponds to a (CW) rotation; + a zero result corresponds to no rotation. + + The tip of v1 + The tail of each vector + The tip of v2 + The angle between v1 and v2, relative to v1 + + + + Computes the angle of the unoriented bisector + of the smallest angle between two vectors. + + The computed angle will be in the range (-Pi, Pi]. + The tip of v1 + The tail of each vector + The tip of v2 + The angle of the bisector between v1 and v2 + + + + Computes the interior angle between two segments of a ring. + The ring is assumed to be oriented in a clockwise direction. + + The computed angle will be in the range [0, 2Pi] + A point of the ring + The next point of the ring + The next point of the ring + The interior angle based at + + + + Returns whether an angle must turn clockwise or counterclockwise to overlap another angle. + + An angle (in radians) + An angle (in radians) + Whether a1 must turn , or to overlap a2. + + + + Computes the normalized value of an angle, which is the equivalent angle in the range ( -Pi, Pi ]. + + The angle to normalize + An equivalent angle in the range (-Pi, Pi] + + + + Computes the normalized positive value of an angle, which is the equivalent angle in the range [ 0, 2*Pi ). + + E.g. + + Function callResult + NormalizePositive(0.0)0.0 + NormalizePositive(-PI) + NormalizePositive(-2PI)0.0 + NormalizePositive(-3PI) + NormalizePositive(-4PI)0.0 + NormalizePositive(PI) + NormalizePositive(2PI)0.0 + NormalizePositive(3PI) + NormalizePositive(4PI)0.0 + + + + The angle to normalize, in radians. + An equivalent positive angle + + + + Computes the unoriented smallest difference between two angles. + + + + The angles are assumed to be normalized to the range [-Pi, Pi]. + The result will be in the range [0, Pi]. + + + The angle of one vector (in [-Pi, Pi] ) + The angle of the other vector (in range [-Pi, Pi] ) + The angle (in radians) between the two vectors (in range [0, Pi] ) + + + + Projects a point by a given angle and distance. + + The point to project + The angle at which to project + The distance to project + The projected point + + + + Functions for computing area. + + Martin Davis + + + + Computes the area for a ring. + + The coordinates forming the ring + The area of the ring + + + + Computes the area for a ring. + + The coordinates forming the ring + The area of the ring + + + + Computes the signed area for a ring. The signed area is positive if the + ring is oriented CW, negative if the ring is oriented CCW, and zero if the + ring is degenerate or flat. + + The coordinates forming the ring + The signed area of the ring + + + + Computes the signed area for a ring. The signed area is positive if the + + + value + meaning + + > 0 + The ring is oriented clockwise (CW) + < 0 + The ring is oriented counter clockwise (CCW) + == 0 + The ring is degenerate or flat + + ring is oriented CW, negative if the ring is oriented CCW, and zero if the + ring is degenerate or flat. + + The coordinates forming the ring + The signed area of the ring + + + + An interface for rules which determine whether node points + which are in boundaries of geometry components + are in the boundary of the parent geometry collection. + The SFS specifies a single kind of boundary node rule, + the rule. + However, other kinds of Boundary Node Rules are appropriate + in specific situations (for instance, linear network topology + usually follows the .) + Some JTS operations + (such as , and ) + allow the BoundaryNodeRule to be specified, + and respect the supplied rule when computing the results of the operation. + + An example use case for a non-SFS-standard Boundary Node Rule is + that of checking that a set of s have + valid linear network topology, when turn-arounds are represented + as closed rings. In this situation, the entry road to the + turn-around is only valid when it touches the turn-around ring + at the single (common) endpoint. This is equivalent + to requiring the set of LineStrings to be + simple under the . + The SFS-standard is not + sufficient to perform this test, since it + states that closed rings have no boundary points. + + This interface and its subclasses follow the Strategy design pattern. + + Martin Davis + + + + + + + + Tests whether a point that lies in boundaryCount + geometry component boundaries is considered to form part of the boundary + of the parent geometry. + + boundaryCount the number of component boundaries that this point occurs in + true if points in this number of boundaries lie in the parent boundary + + + + Provides access to static instances of common s. + + + + + The Mod-2 Boundary Node Rule (which is the rule specified in the OGC SFS). + + + + + The Endpoint Boundary Node Rule. + + + + The MultiValent Endpoint Boundary Node Rule. + + + + The Monovalent Endpoint Boundary Node Rule. + + + + + The Boundary Node Rule specified by the OGC Simple Features Specification, + which is the same as the Mod-2 rule. + + + + + + A specifies that points are in the + boundary of a lineal geometry if + the point lies on the boundary of an odd number + of components. + Under this rule s and closed + s have an empty boundary. + + + This is the rule specified by the OGC SFS, + and is the default rule used in JTS. + + Martin Davis + + + + A which specifies that any points which are endpoints + of lineal components are in the boundary of the + parent geometry. + This corresponds to the "intuitive" topological definition + of boundary. + Under this rule s have a non-empty boundary + (the common endpoint of the underlying LineString). + + + This rule is useful when dealing with linear networks. + For example, it can be used to check + whether linear networks are correctly noded. + The usual network topology constraint is that linear segments may touch only at endpoints. + In the case of a segment touching a closed segment (ring) at one point, + the Mod2 rule cannot distinguish between the permitted case of touching at the + node point and the invalid case of touching at some other interior (non-node) point. + The EndPoint rule does distinguish between these cases, + so is more appropriate for use. + + Martin Davis + + + + A which determines that only + endpoints with valency greater than 1 are on the boundary. + This corresponds to the boundary of a + being all the "attached" endpoints, but not + the "unattached" ones. + + Martin Davis + + + + A which determines that only + endpoints with valency of exactly 1 are on the boundary. + This corresponds to the boundary of a + being all the "unattached" endpoints. + + Martin Davis + + + + Computes the centroid of a of any dimension. + For collections the centroid is computed for the collection of + non-empty elements of highest dimension. + The centroid of an empty geometry is null + + +

Algorithm

+ + Dimension 2 - the centroid ic computed + as a weighted sum of the centroids + of a decomposition of the area into (possibly overlapping) triangles. + Holes and multipolygons are handled correctly. + See http://www.faqs.org/faqs/graphics/algorithms-faq/ + for further details of the basic approach. + Dimension 1 - Computes the average of the midpoints + of all line segments weighted by the segment length. + Zero-length lines are treated as points. + + Dimension 0 - Compute the average coordinate over all points. + Repeated points are all included in the average + + + If the input geometries are empty, a null Coordinate is returned. +
+ + + + 1.7 +
+ + + Computes the centroid point of a geometry. + + The geometry to use + + The centroid point, or null if the geometry is empty + + + + + the point all triangles are based at + + + + + temporary variable to hold centroid of triangle + + + + + Partial area sum + + + + + partial centroid sum + + + + + Creates a new instance for computing the centroid of a geometry + + + + + Adds a to the centroid total. + + >The to add. + + + + Gets the computed centroid. + + The computed centroid, or null if the input is empty + + + + Computes three times the centroid of the triangle p1-p2-p3. + The factor of 3 is + left in to permit division to be avoided until later. + + + + + Returns twice the signed area of the triangle p1-p2-p3. + The area is positive if the triangle is oriented CCW, and negative if CW. + + + + + Adds the line segments defined by an array of coordinates + to the linear centroid accumulators. + + An array of s + + + + Adds a point to the point centroid accumulator. + + A + + + + Basic computational geometry algorithms + for geometry and coordinates defined in 3-dimensional Cartesian space. + + Martin Davis + + + + Computes the distance between the points and + in 3D space + + The first point + The second point + The distance between the two points + + + + Computes the distance between the point and the + segment from to in 3D space + + The point + The start point of the segment + The end point of the segment + + + + Computes the distance between two 3D segments. + The start point of the first segment + The end point of the first segment + The start point of the second segment + The end point of the second segment + The distance between the segments + + + + Implements basic computational geometry algorithms using arithmetic. + + Martin Davis + + + + Returns the index of the direction of the point q relative to + a vector specified by p1-p2. + + The origin point of the vector + The final point of the vector + the point to compute the direction to + + + 1 if q is counter-clockwise (left) from p1-p2 + -1 if q is clockwise (right) from p1-p2 + 0 if q is collinear with p1-p2 + + + + + Returns the index of the direction of the point q relative to + a vector specified by p1-p2. + + The x-ordinate of the origin point of the vector + The y-ordinate of the origin point of the vector + The x-ordinate of the final point of the vector + The y-ordinate of the final point of the vector + The x-ordinate of the point to compute the direction to + The y-ordinate of the point to compute the direction to + + + 1 if q is counter-clockwise (left) from p1-p2 + -1 if q is clockwise (right) from p1-p2 + 0 if q is collinear with p1-p2 + + + + + Computes the sign of the determinant of the 2x2 matrix + with the given entries. + + + + + + + + -1 if the determinant is negative, + 1 if the determinant is positive, + 0 if the determinant is 0. + + + + + + A value which is safely greater than the + relative round-off error in double-precision numbers + + + + + A filter for computing the orientation index of three coordinates. + + If the orientation can be computed safely using standard DP + arithmetic, this routine returns the orientation index. + Otherwise, a value i > 1 is returned. + In this case the orientation index must + be computed using some other more robust method. + The filter is fast to compute, so can be used to + avoid the use of slower robust methods except when they are really needed, + thus providing better average performance. + + Uses an approach due to Jonathan Shewchuk, which is in the public domain. + + The x-ordinate of point A + The y-ordinate of point A + The x-ordinate of point B + The y-ordinate of point B + The x-ordinate of point C + The y-ordinate of point C + + + The orientation index if it can be computed safely + > 1 if the orientation index cannot be computed safely> + + + + + + Computes an intersection point between two lines + using DD arithmetic. + If the lines are parallel (either identical + or separate) a null value is returned. + + An endpoint of line segment 1 + An endpoint of line segment 1 + An endpoint of line segment 2 + An endpoint of line segment 2 + An intersection point if one exists, or null if lines are parallel. + + + + Constructs the Largest Empty Circle for a set + of obstacle geometries, up to a specified tolerance. + The obstacles are point and line geometries. + + The Largest Empty Circle is the largest circle which + has its center in the convex hull of the obstacles (the boundary), + and whose interior does not intersect with any obstacle. + The circle center is the point in the interior of the boundary + which has the farthest distance from the obstacles (up to tolerance). + The circle is determined by the center point + and a point lying on an obstacle indicating the circle radius. + + The implementation uses a successive-approximation technique + over a grid of square cells covering the obstacles and boundary. + The grid is refined using a branch-and-bound algorithm. + Point containment and distance are computed in a performant + way by using spatial indexes. + +

Future Enhancements

+ + Support polygons as obstacles + Support a client-defined boundary polygon + +
+ Martin Davis + + + +
+ + + Computes the center point of the Largest Empty Circle + within a set of obstacles, up to a given tolerance distance. + + A geometry representing the obstacles (points and lines) + The distance tolerance for computing the center point + The center point of the Largest Empty Circle + + + + Computes a radius line of the Largest Empty Circle + within a set of obstacles, up to a given distance tolerance. + + A geometry representing the obstacles (points and lines) + The distance tolerance for computing the center point + A line from the center of the circle to a point on the edge + + + + Creates a new instance of a Largest Empty Circle construction. + + A geometry representing the obstacles (points and lines) + The distance tolerance for computing the center point + + + + Sets the area boundary as the convex hull + of the obstacles. + + + + + Gets the center point of the Largest Empty Circle + (up to the tolerance distance). + + The center point of the Largest Empty Circle + + + + Gets a point defining the radius of the Largest Empty Circle. + This is a point on the obstacles which is + nearest to the computed center of the Largest Empty Circle. + The line segment from the center to this point + is a radius of the constructed circle, and this point + lies on the boundary of the circle. + + A point defining the radius of the Largest Empty Circle + + + + Gets a line representing a radius of the Largest Empty Circle. + + A line from the center of the circle to a point on the edge + + + + Computes the signed distance from a point to the constraints + (obstacles and boundary). + Points outside the boundary polygon are assigned a negative distance. + Their containing cells will be last in the priority queue + (but will still end up being tested since they may be refined). + + The point to compute the distance for + The signed distance to the constraints (negative indicates outside the boundary) + + + + Tests whether a cell may contain the circle center, + and thus should be refined (split into subcells + to be investigated further.) + + The cell to test + true if the cell might contain the circle center + + + + Initializes the queue with a grid of cells covering + the extent of the area. + + The area extent to cover + The queue to initialize + + + + A square grid cell centered on a given point + with a given side half-length, + and having a given distance from the center point to the constraints. + The maximum possible distance from any point in the cell to the + constraints can be computed. + This is used as the ordering and upper-bound function in + the branch-and-bound algorithm. + + + + + Constructs the Maximum Inscribed Circle for a + polygonal , up to a specified tolerance. + The Maximum Inscribed Circle is determined by a point in the interior of the area + which has the farthest distance from the area boundary, + along with a boundary point at that distance. + + In the context of geography the center of the Maximum Inscribed Circle + is known as the Pole of Inaccessibility. + A cartographic use case is to determine a suitable point + to place a map label within a polygon. + + The radius length of the Maximum Inscribed Circle is a + measure of how "narrow" a polygon is. It is the + distance at which the negative buffer becomes empty. + + The class supports polygons with holes and multipolygons. + + The implementation uses a successive-approximation technique + over a grid of square cells covering the area geometry. + The grid is refined using a branch-and-bound algorithm. + Point containment and distance are computed in a performant + way by using spatial indexes. +

Future Enhancements

+ + Support a polygonal constraint on placement of center + +
+ Martin Davis + + + +
+ + + Computes the center point of the Maximum Inscribed Circle + of a polygonal geometry, up to a given tolerance distance. + + A polygonal geometry + The distance tolerance for computing the center point + The center point of the maximum inscribed circle + + + + Computes a radius line of the Maximum Inscribed Circle + of a polygonal geometry, up to a given tolerance distance. + + A polygonal geometry + The distance tolerance for computing the center point + A line from the center to a point on the circle + + + + Creates a new instance of a Maximum Inscribed Circle computation. + + An areal geometry + The distance tolerance for computing the centre point + (must be positive) + Thrown if the tolerance is non-positive + Thrown if the input geometry is non-polygonal or empty + + + + Gets the center point of the maximum inscribed circle + (up to the tolerance distance). + The center point of the maximum inscribed circle + + + + Gets a point defining the radius of the Maximum Inscribed Circle. + This is a point on the boundary which is + nearest to the computed center of the Maximum Inscribed Circle. + The line segment from the center to this point + is a radius of the constructed circle, and this point + lies on the boundary of the circle. + + A point defining the radius of the Maximum Inscribed Circle + + + + Gets a line representing a radius of the Largest Empty Circle. + + A line from the center of the circle to a point on the edge + + + + Computes the signed distance from a point to the area boundary. + Points outside the polygon are assigned a negative distance. + Their containing cells will be last in the priority queue + (but may still end up being tested since they may need to be refined). + + The point to compute the distance for + The signed distance to the area boundary (negative indicates outside the area) + + + + Initializes the queue with a grid of cells covering + the extent of the area. + + The area extent to cover + The queue to initialize + + + + A square grid cell centered on a given point + with a given side half-length, + and having a given distance from the center point to the constraints. + The maximum possible distance from any point in the cell to the + constraints can be computed. + This is used as the ordering and upper-bound function in + the branch-and-bound algorithm. + + + + + Computes the convex hull of a . + The convex hull is the smallest convex Geometry that contains all the + points in the input Geometry. + Uses the Graham Scan algorithm. + + + + + Computes the convex hull for the given sequence of instances. + + + The instances whose convex hull to compute. + + + The convex hull of . + + + + + Create a new convex hull construction for the input Geometry. + + + + + + Create a new convex hull construction for the input array. + + + + + + + Returns a Geometry that represents the convex hull of the input point. + The point will contain the minimal number of points needed to + represent the convex hull. In particular, no more than two consecutive + points will be collinear. + + + If the convex hull contains 3 or more points, a Polygon; + 2 points, a LineString; + 1 point, a Point; + 0 points, an empty GeometryCollection. + + + + + Uses a heuristic to reduce the number of points scanned to compute the hull. + The heuristic is to find a polygon guaranteed to + be in (or on) the hull, and eliminate all points inside it. + A quadrilateral defined by the extremal points + in the four orthogonal directions + can be used, but even more inclusive is + to use an octilateral defined by the points in the 8 cardinal directions. + Note that even if the method used to determine the polygon vertices + is not 100% robust, this does not affect the robustness of the convex hull. + + To satisfy the requirements of the Graham Scan algorithm, + the returned array has at least 3 entries. + + + The coordinates to reduce + The reduced array of coordinates + + + + Pre sorts the coordinates + + + + + + + + + + + + + + + + + + + + Whether the three coordinates are collinear + and c2 lies between c1 and c3 inclusive. + + + + + + + + + + + + + + + + + + + + + The vertices of a linear ring, which may or may not be flattened (i.e. vertices collinear). + A 2-vertex LineString if the vertices are collinear; + otherwise, a Polygon with unnecessary (collinear) vertices removed. + + + + + + The vertices of a linear ring, which may or may not be flattened (i.e. vertices collinear). + The coordinates with unnecessary (collinear) vertices removed. + + + + Compares s for their angle and distance + relative to an origin. + + + + + Initializes a new instance of the class. + + + + + + + + + + + + + + + + + + + + + + + Functions to compute distance between basic geometric structures. + + Martin Davis + + + + Computes the distance from a line segment AB to a line segment CD + + Note: NON-ROBUST! + + The first point of the first line + The second point of the first line (must be different to A) + The first point of the second line + The second point of the second line (must be different to C) + The distance from a line segment AB to a line segment CD + + + + Computes the distance from a point to a sequence of line segments. + + A point + A sequence of contiguous line segments defined by their vertices + The minimum distance between the point and the line segments + + + + Computes the distance from a point to a sequence of line segments. + + A point + A sequence of contiguous line segments defined by their vertices + The minimum distance between the point and the line segments + + + + Computes the distance from a point p to a line segment AB + + Note: NON-ROBUST! + + The point to compute the distance for + The first point of the first line + The second point of the first line (must be different to A) + The distance from p to line segment AB + + + + Computes the perpendicular distance from a point p to the (infinite) line + containing the points AB + + The point to compute the distance for + The first point of the first line + The second point of the first line (must be different to A) + The perpendicular distance from p to line segment AB + + + + + Computes the Discrete Fréchet Distance between two s + using a cartesian distance computation function. + + The 1st geometry + The 2nd geometry + The cartesian distance between and + + + + Creates an instance of this class using the provided geometries. + + A geometry + A geometry + + + + Computes the Discrete Fréchet Distance between the input geometries + + The Discrete Fréchet Distance + + + + Creates a matrix to store the computed distances + + The number of rows + The number of cols + A matrix storage + + + + Gets the pair of s at which the distance is obtained. + + The pair of Coordinates at which the distance is obtained + + + + Computes the Fréchet Distance for the given distance matrix. + + An array of Coordinates + An array of Coordinates + An array of alternating col/row index values for the diagonal of the distance matrix + The distance matrix + A lookup for coordinate pairs based on a distance + + + + + Returns the minimum distance at the corner (, }). + + A (sparse) matrix + The row index + The column index + The minimum distance + + + + Computes relevant distances between pairs of s for the + computation of the Discrete Fréchet Distance. + + An array of Coordinates + An array of Coordinates + An array of alternating col/row index values for the diagonal of the distance matrix + The distance matrix + A lookup for coordinate pairs based on a distance + + + + Computes the indices for the diagonal of a numCols x numRows grid + using the + Bresenham's line algorithm. + + The number of columns + The number of rows + A packed array of column and row indices. + + + + Abstract base class for storing 2d matrix data + + + + + Gets a value indicating the number of rows + + + + + Gets a value indicating the number of columns + + + + + Gets a value indicating the default value + + + + Creates an instance of this class + The number of rows + The number of columns + A default value + + + + Gets or sets a value for the cell , + + The row index + The column index + The value of the cell , + + + + Gets a flag indicating if the matrix has a set value, e.g. one that is different + than . + + A flag indicating if the matrix has a set value + + + Straight forward implementation of a rectangular matrix + + + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified. + + The number of rows + The number of columns + A default value + + + + A matrix implementation that adheres to the + + Compressed sparse row format.
+ Note: Unfortunately not as fast as expected. +
+
+ + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified. + + The number of rows + The number of columns + A default value + + + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified as well as the number of values expected. + + The number of rows + The number of columns + A default value + The amount of expected values + + + + Computes an initial value for the number of expected values + + The number of rows + The number of columns + The expected number of values in the sparse matrix + + + + Ensures that the column index vector (ci) and value vector (v) are sufficiently large. + + The number of items to store in the matrix + + + + A sparse matrix based on . + + + + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified. + + The number of rows + The number of columns + A default value + + + + An algorithm for computing a distance metric + which is an approximation to the Hausdorff Distance + based on a discretization of the input . + + + + The algorithm computes the Hausdorff distance restricted to discrete points + for one of the geometries. + The points can be either the vertices of the geometries (the default), + or the geometries with line segments densified by a given fraction. + Also determines two points of the Geometries which are separated by the computed distance. + + + This algorithm is an approximation to the standard Hausdorff distance. + Specifically, + + for all geometries a, b: DHD(a, b) <= HD(a, b) + + The approximation can be made as close as needed by densifying the input geometries. + In the limit, this value will approach the true Hausdorff distance: + + DHD(A, B, densifyFactor) -> HD(A, B) as densifyFactor -> 0.0 + + The default approximation is exact or close enough for a large subset of useful cases. + + + Examples of these are: + + + computing distance between Linestrings that are roughly parallel to each other, + and roughly equal in length. This occurs in matching linear networks. + + Testing similarity of geometries. + + + + An example where the default approximation is not close is: + + A = LINESTRING (0 0, 100 0, 10 100, 10 100) + B = LINESTRING (0 100, 0 10, 80 10) + + DHD(A, B) = 22.360679774997898 + HD(A, B) ~= 47.8 + + + + + + + Computes the Discrete Hausdorff Distance of two s. + + A geometry + A geometry + The Discrete Hausdorff Distance + + + + Computes the Discrete Hausdorff Distance of two s. + + A geometry + A geometry + The densify fraction. A value of 0 indicates, that no densification should take place + The Discrete Hausdorff Distance + + + + Value of 0.0 indicates that no densification should take place + + + + + Creates an instance of this class using the provided geometries + + A geometry + Another geometry + + + + Gets or sets the fraction by which to densify each segment. + + + Each segment will be (virtually) split into a number of equal-length + sub-segments, whose fraction of the total length is closest + to the given fraction. + + + + + Computes the discrete hausdorff distance between the two assigned geometries. + + The discrete hausdorff distance + + + + Computes the discrete hausdorff distance between the 1st and the 2nd assigned geometry + + The discrete hausdorff distance. + + + + Gets a value indicating the + + + + + A coordinate filter that computes the maximum between points of + an assigned Geometry and all filtered geometries. + + + + + Creates an instance of this class + + A geometry + + + + + + + Gets a value indicating the maximum distance between + an assigned Geometry and the filtered one. + + + + + A coordinate filter that computes the maximum between points of + an assigned Geometry and all filtered geometries. The filtered geometries' line segments + are + + + + + Creates an instance of this filter class + + The geometry to densify + The densification fraction + + + + + + + As this filter does not change the geometry, the return value is always false + + + + As this filter does not end prematurely, the return value is always false + + + + Gets a value indicating the maximum distance between p + + + + + Computes the Euclidean distance (L2 metric) from a to a . + + + Also computes two points on the geometry which are separated by the distance found. + + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The geometry + The Point + The PointPairDistance + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The LineString + The Point + The PointPairDistance + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The LineSegment + The Point + The PointPairDistance + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The Polygon + The Point + The PointPairDistance + + + + Contains a pair of points and the distance between them. + + + Provides methods to update with a new point pair with either maximum or minimum distance. + + + + + Initializes this instance to null. + + + + + Initializes the points, computing the distance between them. + + 1st coordinate + 2nd coordinate + + + + Initializes the points, avoiding recomputing the distance. + + 1st coordinate + 2nd coordinate + the distance between and + + + + The distance between the paired coordinates + + The distance between the paired coordinates + + + + Gets a value indicating the paired coordinates. + + An array containing the paired points + + + + Gets the value of one of the paired points + + An index, valid are [0, 1]. + The Coordinate at index i. + + + + Updates this PointPairDistance if + has greater than this instance. + + The PointPairDistance to test. + + + + Updates this PointPairDistance if the distance between + and is greater than the + of this instance. + + The 1st point's coordinate + The 2nd point's coordinate + + + + Updates this PointPairDistance if + has a smaller than this instance. + + The PointPairDistance to test. + + + + Updates this PointPairDistance if the distance between + and is smaller than the + of this instance. + + The 1st point's coordinate + The 2nd point's coordinate + + + + + + + Represents a homogeneous coordinate in a 2-D coordinate space. + In NTS s are used as a clean way + of computing intersections between line segments. + + David Skea + + + + Computes the (approximate) intersection point between two line segments using homogeneous coordinates. + + + Note that this algorithm is + not numerically stable; i.e. it can produce intersection points which + lie outside the envelope of the line segments themselves. In order + to increase the precision of the calculation input points should be normalized + before passing them to this routine. + + 1st Coordinate of 1st linesegment + 2nd Coordinate of 1st linesegment + 1st Coordinate of 2nd linesegment + 2nd Coordinate of 2nd linesegment + + + + Computes the (approximate) intersection point between two line segments + using homogeneous coordinates. + Note that this algorithm is + not numerically stable; i.e. it can produce intersection points which + lie outside the envelope of the line segments themselves. In order + to increase the precision of the calculation input points should be normalized + before passing them to this routine. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Constructs a homogeneous coordinate which is the intersection of the lines s. + define by the homogeneous coordinates represented by two + + A coordinate + A coordinate + + + + Creates an instance of this + + + + + + + + + Constructs a concave hull of a set of points. + The hull is constructed by removing the longest outer edges + of the Delaunay Triangulation of the points + until a target criterion is reached. + + The target criteria are: + + Maximum Edge Length Ratiothe length of the longest edge of the hull is no larger + than this value. + Maximum Edge Length Factordetermine the Maximum Edge Length + as a fraction of the difference between the longest and shortest edge lengths + in the Delaunay Triangulation. + This normalizes the Maximum Edge Length to be scale-free. + A value of 1 produces the convex hull; a value of 0 produces maximum concaveness. + + The preferred criterion is the Maximum Edge Length Ratio, since it is + scale-free and local(so that no assumption needs to be made about the + total amount of concaveness present). + Other length criteria can be used by setting the Maximum Edge Length directly. + For example, use a length relative to the longest edge length + in the Minimum Spanning Tree of the point set. + Or, use a length derived from the value. + + The computed hull is always a single connected + (unless it is degenerate, in which case it will be a or a ). + This constraint may cause the concave hull to fail to meet the target criteria. + + Optionally the concave hull can be allowed to contain holes. + Note that when using the area-based criterion + this may result in substantially slower computation. + + Martin Davis + + + + Computes the approximate edge length of + a uniform square grid having the same number of + points as a geometry and the same area as its convex hull. + This value can be used to determine a suitable length threshold value + for computing a concave hull. + A value from 2 to 4 times the uniform grid length + seems to produce reasonable results. + + A geometry + The approximate uniform grid length + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length. + + The input geometry + The target maximum edge length + The concave hull + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length, + and optionally allowing holes. + + The input geometry + The target maximum edge length + A flag whether holes are allowed in the result + The concave hull + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length ratio. + The edge length ratio is a fraction of the length difference + between the longest and shortest edges + in the Delaunay Triangulation of the input points. + + The input geometry + The target edge length ratio + The concave hull + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length ratio, + and optionally allowing holes. + The edge length factor is a fraction of the length difference + between the longest and shortest edges + in the Delaunay Triangulation of the input points. + + The input geometry + The target edge length ratio + A flag whether holes are allowed in the result + The concave hull + + + + Creates a new instance for a given geometry. + + The input geometry + + + Gets or sets the target maximum edge length for the concave hull. + The length value must be zero or greater. + + The value 0.0 produces the concave hull of smallest area + that is still connected. + Larger values produce less concave results. + A value equal or greater than the longest Delaunay Triangulation edge length + produces the convex hull. + + The value may be used as + the basis for estimating an appropriate target maximum edge length. + + + The target maximum edge length for the concave hull + + + + Gets or sets the target maximum edge length ratio for the concave hull. + The edge length ratio is a fraction of the difference + between the longest and shortest edge lengths + in the Delaunay Triangulation of the input points. + It is a value in the range 0 to 1. + + The value 0.0 produces a concave hull of minimum area + that is still connected. + The value 1.0 produces the convex hull. + + + The target maximum edge length factor for the concave hull + + + + Gets or sets whether holes are allowed in the concave hull polygon. + + + + + Gets the computed concave hull. + + The concave hull + + + Computes the concave hull using edge length as the target criteria. + + + The erosion is done in two phases: first the border, then any + internal holes (if required). + This allows an fast connection check to be used + when eroding holes, + which makes this much more efficient than the area-based algorithm. + + The triangulation + + + + Adds a Tri to the queue. + Only add tris with a single border edge, + sice otherwise that would risk isolating a vertex. + Sets the ordering size to the length of the border edge. + + The Tri to add + The priority queue to add to + + + + Finds tris which may be the start of holes. + + + Only tris which have a long enough edge and which do not touch the current hull + boundary are included.
+ This avoids the risk of disconnecting the result polygon. + The list is sorted in decreasing order of edge length. +
+ The triangulation + The minimum length of edges to consider + A list of candidate tris that may start a hole +
+ + + Erodes a hole starting at a given triangle, + and eroding all adjacent triangles with boundary edge length above target. + + The triangulation + A tri which is a hole + + + + Tris which are used to form a concave hull. + If a Tri has an edge (or edges) with no adjacent tri + the tri is on the boundary of the triangulation. + The edge is a boundary edge. + The union of those edges + forms the (linear) boundary of the triangulation. + The triangulation area may be a Polygon or MultiPolygon, and may or may not contain holes. + + Martin Davis + + + + Sets the size to be the length of the boundary edges. + This is used when constructing hull without holes, + by erosion from the triangulation boundary. + + + + + Gets an index of a boundary edge, if there is one. + + A boundary edge index, or -1 + + + + Gets the most CCW boundary edge index. + This assumes there is at least one non-boundary edge. + + The CCW boundary edge index + + + + Gets the most CW boundary edge index. + This assumes there is at least one non-boundary edge. + + The CW boundary edge index + + + + Tests if this tri is the only one connecting its 2 adjacents. + Assumes that the tri is on the boundary of the triangulation + and that the triangulation does not contain holes + + true if the tri is the only connection + + + + Gets the index of a vertex which is adjacent to two other tris (if any). + + The vertex index or -1 + + + + Tests whether some vertex of this Tri has degree = 1. + In this case it is not in any other Tris. + + The triangulation + true if any vertex of this tri has a degree of 1 + + + + PriorityQueues sort in ascending order. + To sort with the largest at the head, + smaller sizes must compare as greater than larger sizes. + (i.e. the normal numeric comparison is reversed). + If the sizes are identical (which should be an infrequent case), + the areas are compared, with larger areas sorting before smaller. + (The rationale is that larger areas indicate an area of lower point density, + which is more likely to be in the exterior of the computed shape.) + This improves the determinism of the queue ordering. + + + + + Tests if this tri has a vertex which is in the boundary, + but not in a boundary edge. + + true if the tri touches the boundary at a vertex + + + + Tests if a triangulation is edge-connected, if a triangle is removed.
+ NOTE: this is a relatively slow operation. +
+ The triangulation + The triangle to remove + true if the triangulation is still connected +
+ + + Functions to operate on triangulations represented as + lists of s. + + + + + Creates a polygonal geometry representing the area of a triangulation + which may be disconnected or contain holes. + + The triangulation + The geometry factory + The area polygonal geometry + + + + Creates a Polygon representing the area of a triangulation + which is connected and contains no holes. + + The triangulation + The geometry factory to use + The area polygon + + + + Extracts the coordinates of the edgees along the boundary of a triangulation, + by tracing CW around the border triangles.
+ Assumption: there are at least 2 tris, they are connected, + and there are no holes. + So each tri has at least one non-border edge, and there is only one border. +
+ The triangulation + The border of the triangulation +
+ + + Computes an interior point of a . + An interior point is guaranteed to lie in the interior of the Geometry, + if it possible to calculate such a point exactly. + For collections the interior point is computed for the collection of + non-empty elements of highest dimension. + Otherwise, the point may lie on the boundary of the geometry. + + The interior point of an empty geometry is POINT EMPTY. +

Algorithm

+ The point is chosen to be "close to the center" of the geometry. + The location depends on the dimension of the input: + + Dimension 2the interior point is constructed in the middle of the longest interior segment + of a line bisecting the area. + Dimension 1the interior point is the interior or boundary vertex closest to the centroid. + Dimension 0the point is the point closest to the centroid. + + + + +
+
+ + + Computes a location of an interior point in a . + + Handles all geometry types. + + A geometry in which to find an interior point + the location of an interior point, or POINT EMPTY if the input is empty + + + + + Computes a location of an interior point in a . + + Handles all geometry types. + + + This function is called GetInteriorPoint in JTS. + It has been renamed to GetInteriorCoord to prevent a breaking change. + A geometry in which to find an interior point + the location of an interior point, or null if the input is empty + + + + + Computes a point in the interior of an areal geometry. + The point will lie in the geometry interior + in all except certain pathological cases. + + +

Algorithm:

+ For each input polygon: + + + Determine a horizontal scan line on which the interior + point will be located. + To increase the chance of the scan line + having non-zero-width intersection with the polygon + the scan line Y ordinate is chosen to be near the centre of the polygon's + Y extent but distinct from all of vertex Y ordinates. + + + Compute the sections of the scan line + which lie in the interior of the polygon. + + + Choose the widest interior section + and take its midpoint as the interior point. + + + The final interior point is chosen as + the one occurring in the widest interior section. + + This algorithm is a tradeoff between performance + and point quality (where points further from the geometry + boundary are considered to be higher quality) + Priority is given to performance. + This means that the computed interior point + may not be suitable for some uses + (such as label positioning). + + + The algorithm handles some kinds of invalid/degenerate geometry, + including zero-area and self-intersecting polygons. + + + Empty geometry is handled by returning a point. + +

KNOWN BUGS

+ + + If a fixed precision model is used, + in some cases this method may return a point + which does not lie in the interior. + + + If the input polygon is extremely narrow the computed point + may not lie in the interior of the polygon. + + +
+
+ + + Computes an interior point for the + polygonal components of a Geometry. + + The geometry to compute. + + The computed interior point, + or if the geometry has no polygonal components. + + + + + + + + + + + + + Creates a new interior point finder + for an areal geometry. + + An areal geometry + + + + Gets the computed interior point + or if the input geometry is empty. + + + + + Processes a geometry to determine + the best interior point for + all component polygons. + + The geometry to process. + + + + Computes an interior point of a component Polygon + and updates current best interior point + if appropriate. + + The polygon to process. + + + + Computes an interior point in a single , + as well as the width of the scan-line section it occurs in + to allow choosing the widest section occurrence. + + + + + Initializes a new instance of the class. + + The polygon to test. + + + + Gets the computed interior point, + or if the input geometry is empty. + + + + + Gets the width of the scanline section containing the interior point. + Used to determine the best point to use. + + + + + Compute the interior point. + + + + + Finds the midpoint of the widest interior section. + Sets the location and the + + + The list of scan-line X ordinates + + + + Tests if an edge intersection contributes to the crossing count. + Some crossing situations are not counted, + to ensure that the list of crossings + captures strict inside/outside topology. + + An endpoint of the segment. + An endpoint of the segment. + The Y-ordinate of the horizontal line. + if the edge crossing is counted. + + + + Computes the intersection of a segment with a horizontal line. + The segment is expected to cross the horizontal line + - this condition is not checked. + Computation uses regular double-precision arithmetic. + Test seems to indicate this is as good as using DD arithmetic. + + An endpoint of the segment. + An endpoint of the segment. + The Y-ordinate of the horizontal line + + + + + Tests if an envelope intersects a horizontal line. + + The envelope to test. + The Y-ordinate of the horizontal line. + if the envelope and line intersect. + + + + Tests if a line segment intersects a horizontal line. + + A segment endpoint. + A segment endpoint. + The Y-ordinate of the horizontal line. + if the segment and line intersect. + + + + Finds a safe scan line Y ordinate by projecting + the polygon segments + to the Y axis and finding the + Y-axis interval which contains the centre of the Y extent. + The centre of + this interval is returned as the scan line Y-ordinate. + + Note that in the case of (degenerate, invalid) + zero-area polygons the computed Y value + may be equal to a vertex Y-ordinate. + + + Martin Davis + + + + Computes a point in the interior of an linear point. + Algorithm: + Find an interior vertex which is closest to + the centroid of the linestring. + If there is no interior vertex, find the endpoint which is + closest to the centroid. + + + + + Computes an interior point for the + linear components of a Geometry. + + The geometry to compute. + + The computed interior point, + or if the geometry has no linear components. + + + + + + + + + + + + + + + + Tests the interior vertices (if any) + defined by a linear Geometry for the best inside point. + If a Geometry is not of dimension 1 it is not tested. + + The point to add. + + + + + + + + + + Tests the endpoint vertices + defined by a linear Geometry for the best inside point. + If a Geometry is not of dimension 1 it is not tested. + + The point to add. + + + + + + + + + + + + + + + + Computes a point in the interior of an point point. + Algorithm: + Find a point which is closest to the centroid of the point. + + + + + Computes an interior point for the + puntal components of a Geometry. + + The geometry to compute. + + The computed interior point, + or if the geometry has no puntal components. + + + + + + + + + + + Tests the point(s) defined by a Geometry for the best inside point. + If a Geometry is not of dimension 0 it is not tested. + + The point to add. + + + + + + + + + + + + + + + Functions to compute intersection points between lines and line segments. + + In general it is not possible to compute + the intersection point of two lines exactly, due to numerical roundoff. + This is particularly true when the lines are nearly parallel. + These routines uses numerical conditioning on the input values + to ensure that the computed value is very close to the correct value. + + The Z-ordinate is ignored, and not populated. + + mdavis + + + + Computes the intersection point of two lines. + If the lines are parallel or collinear this case is detected + and null is returned. + + An endpoint of line 1 + An endpoint of line 1 + An endpoint of line 2 + An endpoint of line 2 + + + NOTE: In JTS this function is called Intersection. + + The intersection point between the lines, if there is one, + or null if the lines are parallel or collinear + + + + + Computes the intersection point of a line and a line segment (if any). + There will be no intersection point if: + + the segment does not intersect the line + the line or the segment are degenerate (have zero length) + + If the segment is collinear with the line the first segment endpoint is returned. + + The intersection point, or null if it is not possible to find an intersection + + + + An interface for classes which determine the of points in a + + Martin Davis + + + + Determines the of a point in the . + + The point to test + the location of the point in the geometry + + + + Functions for computing length. + + + Martin Davis + + + + + Computes the length of a LineString specified by a sequence of points. + + The points specifying the LineString + The length of the LineString + + + + A LineIntersector is an algorithm that can both test whether + two line segments intersect and compute the intersection point(s) + if they do. + + There are three possible outcomes when determining whether two line segments intersect: + + - the segments do not intersect + - the segments intersect in a single point + - the segments are collinear and they intersect in a line segment + + + + For segments which intersect in a single point, the point may be either an endpoint + or in the interior of each segment. + If the point lies in the interior of both segments, + this is termed a proper intersection. + The property test for this situation. + + The intersection point(s) may be computed in a precise or non-precise manner. + Computing an intersection point precisely involves rounding it + via a supplied . + + LineIntersectors do not perform an initial envelope intersection test + to determine if the segments are disjoint. + This is because this class is likely to be used in a context where + envelope overlap is already known to occur (or be likely). + + + + + + Indicates that line segments do not intersect + + + + + Indicates that line segments intersect in a single point + + + + + Indicates that line segments intersect in a line segment + + + + + Computes the "edge distance" of an intersection point p along a segment. + The edge distance is a metric of the point along the edge. + The metric used is a robust and easy to compute metric function. + It is not equivalent to the usual Euclidean metric. + It relies on the fact that either the x or the y ordinates of the + points in the edge are unique, depending on whether the edge is longer in + the horizontal or vertical direction. + NOTE: This function may produce incorrect distances + for inputs where p is not precisely on p1-p2 + (E.g. p = (139,9) p1 = (139,10), p2 = (280,1) produces distance 0.0, which is incorrect. + My hypothesis is that the function is safe to use for points which are the + result of rounding points which lie on the line, but not safe to use for truncated points. + + + + + This function is non-robust, since it may compute the square of large numbers. + Currently not sure how to improve this. + + + + + A value indicating the intersection result + + Possible values are: + + + + + + + + + + Array of coordinate arrays forming the lines + + + + + Array of + + + + + The indexes of the endpoints of the intersection lines, in order along + the corresponding line + + + + + Alias the [0] for ease of reference + + + + + Alias the [1] for ease of reference + + + + + If MakePrecise is true, computed intersection coordinates will be made precise + using Coordinate.MakePrecise. + + + + + Creates an instance of this class + + + + + Force computed intersection to be rounded to a given precision model. + No getter is provided, because the precision model is not required to be specified. + + + + + Gets an endpoint of an input segment. + + the index of the input segment (0 or 1) + the index of the endpoint (0 or 1) + The specified endpoint + + + + Compute the intersection of a point p and the line p1-p2. + This function computes the bool value of the hasIntersection test. + The actual value of the intersection (if there is one) + is equal to the value of p. + + + + + Gets a value indicating if the computed intersection is collinear + + + + + Computes the intersection of the lines p1-p2 and p3-p4. + This function computes both the bool value of the hasIntersection test + and the (approximate) value of the intersection point itself (if there is one). + + The 1st point of the 1st segment + The 2nd point of the 1st segment + The 1st point of the 2nd segment + The 2nd point of the 2nd segment + + + + Computes the intersection of two line segments, one defined by and , + the other by and . + + The 1st point of the 1st segment + The 2nd point of the 1st segment + The 1st point of the 2nd segment + The 2nd point of the 2nd segment + + + Don't use this function directly, it is not meant for public use. + Please call + and test or along with and + . + + + + + + + + Gets a value indicating if the intersection is an end-point intersection + + + + + Tests whether the input geometries intersect. + + true if the input geometries intersect. + + + + Returns the number of intersection points found. This will be either 0, 1 or 2. + + The number of intersection points found (0, 1, or 2) + + + + Returns the intIndex'th intersection point. + + is 0 or 1. + The intIndex'th intersection point. + + + + Computes the values. + + + + + Test whether a point is a intersection point of two line segments. + Note that if the intersection is a line segment, this method only tests for + equality with the endpoints of the intersection segment. + It does not return true if the input point is internal to the intersection segment. + + true if the input point is one of the intersection points. + + + + Tests whether either intersection point is an interior point of one of the input segments. + + + true if either intersection point is in the interior of one of the input segment. + + + + + Tests whether either intersection point is an interior point of the specified input segment. + + + true if either intersection point is in the interior of the input segment. + + + + + Tests whether an intersection is proper. + The intersection between two line segments is considered proper if + they intersect in a single point in the interior of both segments + (e.g. the intersection is a single point and is not equal to any of the endpoints). + The intersection between a point and a line segment is considered proper + if the point lies in the interior of the segment (e.g. is not equal to either of the endpoints). + + true if the intersection is proper. + + + + Computes the intIndex'th intersection point in the direction of + a specified input line segment. + + is 0 or 1. + is 0 or 1. + + The intIndex'th intersection point in the direction of the specified input line segment. + + + + + Computes the index (order) of the intIndex'th intersection point in the direction of + a specified input line segment. + + is 0 or 1. + is 0 or 1. + + The index of the intersection point along the segment (0 or 1). + + + + + Computes the intersection line index + + The segment index + + + + Computes the "edge distance" of an intersection point along the specified input line segment. + + is 0 or 1. + is 0 or 1. + The edge distance of the intersection point. + + + + Determines the of s relative to + an areal geometry, using indexing for efficiency. + This algorithm is suitable for use in cases where + many points will be tested against a given area. + + The Location is computed precisely, th that points + located on the geometry boundary or segments will + return . + + and geometries are supported. + + The index is lazy-loaded, which allows + creating instances even if they are not used. + + Thread-safe and immutable. + + Martin Davis + + + + Creates a new locator for a given . + and geometries are supported + + The Geometry to locate in + + + + Determines the of a point in an areal . + + The point to test + The location of the point in the geometry + + + + + Creates the indexed geometry, creating it if necessary. + + + + + An interface for classes which determine the of + points in areal geometries. + + Martin Davis + + + + Determines the of a point in an areal . + + The point to test + The location of the point in the geometry + + + + Static methods for classes + + + + + Convenience method to test a point for intersection with a geometry + + The geometry is wrapped in a class. + + The locator to use. + The coordinate to test. + true if the point is in the interior or boundary of the geometry. + + + + Computes the location of points + relative to an areal , + using a simple O(n) algorithm. + + The algorithm used reports + if a point lies in the interior, exterior, + or exactly on the boundary of the Geometry. + + + Instance methods are provided to implement + the interface . + However, they provide no performance + advantage over the class methods. + + + This algorithm is suitable for use in cases where + only a few points will be tested. + If many points will be tested, + may provide better performance. + + + The algorithm used is only guaranteed to return correct results for points which are not on the boundary of the Geometry. + + + + Determines the of a point in an areal . + The return value is one of: + + if the point is in the geometry interior + if the point lies exactly on the boundary + if the point is outside the geometry + + + The point to test + The areal geometry to test + The Location of the point in the geometry + + + + Determines whether a point is contained in a , + or lies on its boundary. + This is a convenience method for + + Location.Exterior != Locate(p, geom) + + + The point to test. + The geometry to test. + if the point lies in or on the geometry. + + + + Determines whether a point lies in a . + If the point lies on the polygon boundary it is + considered to be inside. + + The point to test + The areal geometry to test + true if the point lies in the polygon + + + + Determines whether a point lies in a LinearRing, using the ring envelope to short-circuit if possible. + + The point to test + A linear ring + true if the point lies inside the ring + + + + Initializes a new instance of the class, + using the provided areal geometry. + + The areal geometry to locate in. + + + + Determines the of a point in an areal . + The return value is one of: + + if the point is in the geometry interior + if the point lies exactly on the boundary + if the point is outside the geometry + + + The point to test + The Location of the point in the geometry. + + + + Measures the degree of similarity between two s + using the area of intersection between the geometries. + The measure is normalized to lie in the range [0, 1]. + Higher measures indicate a great degree of similarity. + + + NOTE: Currently experimental and incomplete. + + mbdavis + + + + Computes the similarity measure between two geometries + + A geometry. + A geometry. + + The value of the similarity measure, in [0.0, 1.0]. + + + + + Measures the degree of similarity between two + s using the Fréchet distance metric. + The measure is normalized to lie in the range [0, 1]. + Higher measures indicate a great degree of similarity. + + The measure is computed by computing the Fréchet distance + between the input geometries, and then normalizing + this by dividing it by the diagonal distance across + the envelope of the combined geometries. + + Note: the input should be normalized, especially when + measuring geometries because for the + Fréchet distance the order of {@link Coordinate}s is + important. + + Felix Obermaier + + + + Creates an instance of this class + + + + + + + + Measures the degree of similarity between two s using the Hausdorff distance metric. + + + + The measure is normalized to lie in the range [0, 1]. Higher measures indicate a great degree of similarity. + + + The measure is computed by computing the Hausdorff distance between the input geometries, and then normalizing + this by dividing it by the diagonal distance across the envelope of the combined geometries. + + + mbdavis + + + + + + + + + + + An interface for classes which measures the degree of similarity between two {@link Geometry}s. + + + The computed measure lies in the range [0, 1]. + Higher measures indicate a great degree of similarity. + A measure of 1.0 indicates that the input geometries are identical + A measure of 0.0 indicates that the geometries have essentially no similarity. + The precise definition of "identical" and "no similarity" may depend on the exact algorithm being used. + + mbdavis + + + + Function to measure the similarity between two s. + + A geometry + A geometry + The similarity value between two s + + + + Provides methods to mathematically combine values. + + Martin Davis + + + + + + + + + + + + Computes the Minimum Bounding Circle (MBC) for the points in a . + The MBC is the smallest circle which covers all the input points + (this is also sometimes known as the Smallest Enclosing Circle). + This is equivalent to computing the Maximum Diameter of the input point set. + + + + The computed circle can be specified in two equivalent ways, + both of which are provide as output by this class: + + As a centre point and a radius + By the set of points defining the circle. + Depending on the number of points in the input + and their relative positions, this set + contains from 0 to 3 points. + + 0 or 1 points indicate an empty or trivial input point arrangement. + 2 points define the diameter of the minimum bounding circle. + 3 points define an inscribed triangle of the minimum bounding circle. + + + + The class can also output a which approximates the + shape of the Minimum Bounding Circle (although as an approximation + it is not guaranteed to cover all the input points.) + + The Maximum Diameter of the input point set can + be computed as well. The Maximum Diameter is + defined by the pair of input points with maximum distance between them. + The points of the maximum diameter are two of the extremal points of the Minimum Bounding Circle. + They lie on the convex hull of the input. + However, that the maximum diameter is not a diameter + of the Minimum Bounding Circle in the case where the MBC is + defined by an inscribed triangle. + + Martin Davis + + + + Creates a new object for computing the minimum bounding circle for the + point set defined by the vertices of the given geometry. + + The geometry to use to obtain the point set + + + + Gets a geometry which represents the Minimum Bounding Circle. + + + + If the input is degenerate (empty or a single unique point), + this method will return an empty geometry or a single Point geometry. + Otherwise, a Polygon will be returned which approximates the + Minimum Bounding Circle. (Note that because the computed polygon is only an approximation, it may not precisely contain all the input points.) + + + A Geometry representing the Minimum Bounding Circle. + + + Gets a geometry representing the maximum diameter of the + input. The maximum diameter is the longest line segment + between any two points of the input. + + The points are two of the extremal points of the Minimum Bounding Circle. + They lie on the convex hull of the input. + + + The result is + + a LineString between the two farthest points of the input + a empty LineString if the input is empty + a Point if the input is a point + + + + + + Gets a geometry representing a line between the two farthest points + in the input. + + These points are two of the extremal points of the Minimum Bounding Circle + They lie on the convex hull of the input. + + A LineString between the two farthest points of the input + An empty LineString if the input is empty + A Point if the input is a point + + + + Finds the farthest pair out of 3 extremal points + + The array of extremal points + The pair of farthest points + + + + Gets a geometry representing the diameter of the computed Minimum Bounding Circle. + + + + the diameter line of the Minimum Bounding Circle + an empty line if the input is empty + a Point if the input is a point + + + + + + Gets the extremal points which define the computed Minimum Bounding Circle. + There may be zero, one, two or three of these points, depending on the number + of points in the input and the geometry of those points. + + 0 or 1 points indicate an empty or trivial input point arrangement. + 2 points define the diameter of the Minimum Bounding Circle. + 3 points define an inscribed triangle of which the Minimum Bounding Circle is the circumcircle. + The longest chords of the circle are the line segments [0-1] and[1 - 2] + + + The points defining the Minimum Bounding Circle + + + + Gets the centre point of the computed Minimum Bounding Circle. + + + + The centre point of the Minimum Bounding Circle or + null if the input is empty + + + + + + Gets the radius of the computed Minimum Bounding Circle. + + The radius of the Minimum Bounding Circle + + + + Computes the minimum diameter of a . + + + + The minimum diameter is defined to be the + width of the smallest band that contains the point, + where a band is a strip of the plane defined + by two parallel lines. + This can be thought of as the smallest hole that the point can be + moved through, with a single rotation. + + + The first step in the algorithm is computing the convex hull of the Geometry. + If the input Geometry is known to be convex, a hint can be supplied to + avoid this computation. + + + This class can also be used to compute a line segment representing + the minimum diameter, the supporting line segment of the minimum diameter, + and a minimum rectangle enclosing the input geometry. + This rectangle will + have width equal to the minimum diameter, and have one side + parallel to the supporting segment. + + + + + + + Gets the minimum rectangle enclosing a geometry. + + The geometry + The minimum rectangle enclosing the geometry + + + + Gets the minimum diameter enclosing a geometry. + + The geometry + The length of the minimum diameter of the geometry + + + + Compute a minimum diameter for a given . + + a Geometry. + + + + Compute a minimum diameter for a giver Geometry, + with a hint if + the Geometry is convex + (e.g. a convex Polygon or LinearRing, + or a two-point LineString, or a Point). + + a Geometry which is convex. + true if the input point is convex. + + + + Gets the length of the minimum diameter of the input Geometry. + + The length of the minimum diameter. + + + + Gets the Coordinate forming one end of the minimum diameter. + + A coordinate forming one end of the minimum diameter. + + + + Gets the segment forming the base of the minimum diameter. + + The segment forming the base of the minimum diameter. + + + + Gets a LineString which is a minimum diameter. + + A LineString which is a minimum diameter. + + + + + + + + + + + + + + + Compute the width information for a ring of Coordinates. + Leaves the width information in the instance variables. + + + + + + + + + + + + + + + + + + + + + + + Gets the minimum rectangular which encloses the input geometry. + + + + The rectangle has width equal to the minimum diameter, and a longer length. + If the convex hull of the input is degenerate (a line or point) a or is returned. + + + The minimum rectangle can be used as an extremely generalized representation for the given geometry. + + + The minimum rectangle enclosing the input (or a line or point if degenerate) + + + + + + + + + + + + + + Functions to compute the orientation of basic geometric structures + including point triplets(triangles) and rings. + Orientation is a fundamental property of planar geometries + (and more generally geometry on two-dimensional manifolds). + + Determining triangle orientation + is notoriously subject to numerical precision errors + in the case of collinear or nearly collinear points. + NTS uses extended-precision arithmetic to increase + the robustness of the computation. + + + Martin Davis + + + + + Returns the orientation index of the direction of the point relative to + a directed infinite line specified by p1->p2. + The index indicates whether the point lies to the + or of the line, or lies on it . + The index also indicates the orientation of the triangle formed by the three points + (, , or + ) + + The origin point of the line vector + The final point of the line vector + The point to compute the direction to + + The of q in regard to the vector p1->p2 + + + ValueDescription + + + , + is collinear with p1->p2 + + + , + is clockwise (right) from p1->p2 + + + , + is counter-clockwise (left) from p1->p2 + + + + + + + Tests if a ring defined by an array of s is + oriented counter-clockwise. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments (in particular, along the top of the ring). + + This algorithm is guaranteed to work with valid rings. + It also works with "mildly invalid" rings + which contain collapsed(coincident) flat segments along the top of the ring. + If the ring is "more" invalid (e.g.self-crosses or touches), + the computed result may not be correct. + + An array of Coordinates forming a ring (with first and last point identical) + true if the ring is oriented counter-clockwise. + + + + Tests if a ring defined by a is + oriented counter-clockwise. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments (in particular, along the top of the ring). + + This algorithm is guaranteed to work with valid rings. + It also works with "mildly invalid" rings + which contain collapsed(coincident) flat segments along the top of the ring. + If the ring is "more" invalid (e.g.self-crosses or touches), + the computed result may not be correct. + + A CoordinateSequences forming a ring (with first and last point identical). + true if the ring is oriented counter-clockwise. + + + + Tests if a ring defined by an array of s is + oriented counter-clockwise, using the signed area of the ring. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments + (in particular, along the top of the ring). + This handles rings which are invalid due to self-intersection + + This algorithm is guaranteed to work with valid rings. + For invalid rings (containing self-intersections), + the algorithm determines the orientation of + the largest enclosed area (including overlaps). + This provides a more useful result in some situations, such as buffering. + + However, this approach may be less accurate in the case of + rings with almost zero area. + (Note that the orientation of rings with zero area is essentially + undefined, and hence non-deterministic.) + + An array of Coordinates forming a ring (with first and last point identical) + true if the ring is oriented counter-clockwise. + + + + Tests if a ring defined by a is + oriented counter-clockwise, using the signed area of the ring. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments + (in particular, along the top of the ring). + This handles rings which are invalid due to self-intersection + + This algorithm is guaranteed to work with valid rings. + For invalid rings (containing self-intersections), + the algorithm determines the orientation of + the largest enclosed area (including overlaps). + This provides a more useful result in some situations, such as buffering. + + However, this approach may be less accurate in the case of + rings with almost zero area. + (Note that the orientation of rings with zero area is essentially + undefined, and hence non-deterministic.) + + An array of Coordinates forming a ring (with first and last point identical) + true if the ring is oriented counter-clockwise. + + + + Re-orients an orientation. + + The orientation + + + + + Angle orientation + + + + A value that indicates an orientation of collinear, or no turn (straight) + + + A value that indicates an orientation of collinear, or no turn (straight) + + + A value that indicates an orientation of collinear, or no turn (straight) + + + A value that indicates an orientation of counterclockwise, or a left turn. + + + A value that indicates an orientation of counterclockwise, or a left turn. + + + A value that indicates an orientation of clockwise or a right turn. + + + A value that indicates an orientation of clockwise or a right turn. + + + + Functions for locating points within basic geometric + structures such as lines and rings. + + Martin Davis + + + + Tests whether a point lies on the line defined by a list of + coordinates. + + The point to test + The line coordinates + + true if the point is a vertex of the line or lies in the interior + of a line segment in the line + + + + + Tests whether a point lies on the line defined by a list of + coordinates. + + The point to test + The line coordinates + + true if the point is a vertex of the line or lies in the interior + of a line segment in the line + + + + + Tests whether a point lies inside or on a ring. The ring may be oriented in + either direction. A point lying exactly on the ring boundary is considered + to be inside the ring. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + An array of coordinates representing the ring (which must have + first point identical to last point) + true if p is inside ring + + + + + Tests whether a point lies inside or on a ring. The ring may be oriented in + either direction. A point lying exactly on the ring boundary is considered + to be inside the ring. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + A CoordinateSequence representing the ring (which must have + first point identical to last point) + true if p is inside ring + + + + Determines whether a point lies in the interior, on the boundary, or in the + exterior of a ring.The ring may be oriented in either direction. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + A CoordinateSequence representing the ring (which must have + first point identical to last point) + the of p relative to the ring + + + + Determines whether a point lies in the interior, on the boundary, or in the + exterior of a ring.The ring may be oriented in either direction. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + A CoordinateSequence representing the ring (which must have + first point identical to last point) + + + + Computes the topological relationship () of a single point to a Geometry. + + + A may be specified to control the evaluation of whether the point lies on the boundary or not + The default rule is to use the SFS Boundary Determination Rule + + Notes: + + s do not enclose any area - points inside the ring are still in the EXTERIOR of the ring. + + Instances of this class are not reentrant. + + + + + + Initializes a new instance of the class. + The default boundary rule is . + + + + + Initializes a new instance of the class using the provided + boundary rule. + + The boundary rule to use. + + + + Convenience method to test a point for intersection with a Geometry + + The coordinate to test. + The Geometry to test. + true if the point is in the interior or boundary of the Geometry. + + + + Computes the topological relationship ({Location}) of a single point to a Geometry. + It handles both single-element and multi-element Geometries. + The algorithm for multi-part Geometries takes into account the boundaryDetermination rule. + + The Location of the point relative to the input Geometry. + + + + Counts the number of segments crossed by a horizontal ray extending to the right + from a given point, in an incremental fashion. + This can be used to determine whether a point lies in a geometry. + The class determines the situation where the point lies exactly on a segment. + When being used for Point-In-Polygon determination, this case allows short-circuiting the evaluation. + + + This class handles polygonal geometries with any number of shells and holes. + The orientation of the shell and hole rings is unimportant. + In order to compute a correct location for a given polygonal geometry, + it is essential that all segments are counted which + + touch the ray + lie in in any ring which may contain the point + + + The only exception is when the point-on-segment situation is detected, in which + case no further processing is required. + The implication of the above rule is that segments which can be a priori determined to not touch the ray + (i.e. by a test of their bounding box or Y-extent) do not need to be counted. This allows for optimization by indexing. + + + This implementation uses the extended-precision orientation test, + to provide maximum robustness and consistency within + other algorithms. + + + Martin Davis + + + + Determines the of a point in a ring. + This method is an exemplar of how to use this class. + + The point to test + An array of Coordinates forming a ring + The location of the point in the ring + + + + Determines the of a point in a ring. + + The point to test + A coordinate sequence forming a ring + The location of the point in the ring + + + + Creates an instance of this class + + A coordinate. + + + + Counts a segment + + An endpoint of the segment + Another endpoint of the segment + + + + Reports whether the point lies exactly on one of the supplied segments. + + + This method may be called at any time as segments are processed. If the result of this method is true, + no further segments need be supplied, since the result will never change again. + + + + + Gets the of the point relative to the ring, polygon + or multipolygon from which the processed segments were provided. + + + This property only determines the correct location + if all relevant segments have been processed. + + + + + Tests whether the point lies in or on + the ring, polygon or multipolygon from which the processed + segments were provided. + + + This property only determines the correct location + if all relevant segments have been processed + + + + + Computes whether a rectangle intersects line segments. + + + Rectangles contain a large amount of inherent symmetry + (or to put it another way, although they contain four + coordinates they only actually contain 4 ordinates + worth of information). + The algorithm used takes advantage of the symmetry of + the geometric situation + to optimize performance by minimizing the number + of line intersection tests. + + Martin Davis + + + + Creates a new intersector for the given query rectangle, + specified as an . + + The query rectangle, specified as an Envelope + + + + Tests whether the query rectangle intersects a given line segment. + + The first endpoint of the segment + The second endpoint of the segment + true if the rectangle intersects the segment + + + + Implements an algorithm to compute the + sign of a 2x2 determinant for double precision values robustly. + It is a direct translation of code developed by Olivier Devillers. + + The original code carries the following copyright notice: + ************************************************************************ + Author : Olivier Devillers + Olivier.Devillers@sophia.inria.fr + http:/www.inria.fr:/prisme/personnel/devillers/anglais/determinant.html + + Olivier Devillers has allowed the code to be distributed under + the LGPL (2012-02-16) saying "It is ok for LGPL distribution." + + ************************************************************************* + ************************************************************************* + Copyright (c) 1995 by INRIA Prisme Project + BP 93 06902 Sophia Antipolis Cedex, France. + All rights reserved + ************************************************************************* + + + + + Computes the sign of the determinant of the 2x2 matrix with the given entries, in a robust way. + + + + + + + + -1 if the determinant is negative, + 1 if the determinant is positive, + 0 if the determinant is null. + + + + + + Returns the index of the direction of the point q relative to + a vector specified by p1-p2. + + The origin point of the vector + The final point of the vector + the point to compute the direction to + + + 1 if q is counter-clockwise (left) from p1-p2 + -1 if q is clockwise (right) from p1-p2 + 0 if q is collinear with p1-p2 + + + + + A robust version of . + + + + + + + + + + + + + + + + This method computes the actual value of the intersection point. + To obtain the maximum precision from the intersection calculation, + the coordinates are normalized by subtracting the minimum + ordinate values (in absolute value). This has the effect of + removing common significant digits from the calculation to + maintain more bits of precision. + + + + + + + + + + Computes a segment intersection using homogeneous coordinates. + Round-off error can cause the raw computation to fail, + (usually due to the segments being approximately parallel). + If this happens, a reasonable approximation is computed instead. + + + + + Tests whether a point lies in the envelopes of both input segments. + A correctly computed intersection point should return true + for this test. + Since this test is for debugging purposes only, no attempt is + made to optimize the envelope test. + + + true if the input point lies within both input segment envelopes. + + + + Finds the endpoint of the segments P and Q which + is closest to the other segment. + This is a reasonable surrogate for the true + intersection points in ill-conditioned cases + (e.g. where two segments are nearly coincident, + or where the endpoint of one segment lies almost on the other segment). + + + This replaces the older CentralEndpoint heuristic, + which chose the wrong endpoint in some cases + where the segments had very distinct slopes + and one endpoint lay almost on the other segment. + + an endpoint of segment P + an endpoint of segment P + an endpoint of segment Q + an endpoint of segment Q + the nearest endpoint to the other segment + + + + Gets the Z value of a coordinate if present, or + interpolates it from the segment it lies on. + If the segment Z values are not fully populate + NaN is returned. + + A coordinate, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + The extracted or interpolated Z value (may be NaN) + + + + Interpolates a Z value for a point along + a line segment between two points. + The Z value of the interpolation point (if any) is ignored. + If either segment point is missing Z, + returns NaN. + + A coordinate, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + The extracted or interpolated Z value (may be NaN) + + + + Interpolates a Z value for a point along + two line segments and computes their average. + The Z value of the interpolation point (if any) is ignored. + If one segment point is missing Z that segment is ignored + if both segments are missing Z, returns NaN. + + A coordinate + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + The averaged interpolated Z value (may be NaN) + + + + Structure for a closed 1-dimensional ℝ-interval + + + + + The lower bound of the interval + + + + + The upper bound of the interval + + + + + Initializes this structure with = = + + The value for min and max + + + + Initializes this structure with and values + + The minimum interval values + The maximum interval values + + + + Method to expand + + + + + + + Gets a value if this interval is empty/undefined + + + + + + + + + + + + + + + + + Gets a value indicating the width of the + + + + + Gets a value indicating the centre of the interval (Min + Width * 0.5) + + + + + Function to compute an interval that contains this and + + The interval + An interval + + + + Function to test if this overlaps . + + The interval to test + true if this interval overlaps + + + + Function to test if this overlaps the interval ℝ[, ]. + + The minimum value of the interval + The maximum value of the interval + true if this interval overlaps the interval ℝ[, ] + + + + Function to test if this contains . + + This is more rigid than + The interval to test + true if this interval contains + + + + Function to test if this contains the interval ℝ[, ]. + + This is more rigid than + The minimum value of the interval + The maximum value of the interval + true if this interval contains the interval ℝ[, ] + + + + Function to test if this contains the value . + + The value to test + true if this interval contains the value + + + + Function to test if this intersects the interval . + + + + true if this interval intersects + + + + Function to test if this intersects the interval ℝ[, ]. + + The minimum value of the interval + The maximum value of the interval + true if this interval intersects the interval ℝ[, ]. + + + + Creates an empty or uninitialized Interval + + An empty or uninitialized + + + + Creates an interval with the range ℝ[,] + + The value + An + + + + Creates an interval with the range ℝ[,].
+ If necessary, val1 and val2 are exchanged. +
+ The minimum value + The maximum value + An +
+ + + Creates an interval with the range ℝ[,]. + + The template interval + An + + + + Equality operator for s + + The left-hand-side + The right-hand-side + true if the s are equal. + + + + Inequality operator for s + + The left-hand-side + The right-hand-side + true if the s are not equal. + + + + Densifies a geometry by inserting extra vertices along the line segments + contained in the geometry. + All segments in the created densified geometry will be no longer + than the given distance tolerance + (that is, all segments in the output will have length less than or equal to + the distance tolerance). + + + Densified polygonal geometries are guaranteed to be topologically correct. + + The coordinates created during densification respect the input geometry's . + + By default polygonal results are processed to ensure they are valid. + This processing is costly, and it is very rare for results to be invalid. + Validation processing can be disabled by setting the property to false. + + Note: At some future point this class will offer a variety of densification strategies. + + Martin Davis + + + + Densifies a geometry using a given distance tolerance, and respecting the input geometry's . + + The geometry densify + The distance tolerance () + The densified geometry + + + + Densifies a list of coordinates. + + The coordinate list + The densify tolerance + The precision model to apply on the new coordinates + The densified coordinate sequence + + + + Indicates whether areas should be topologically validated. +
Note: JTS name _isValidated +
+
+ + Creates a new densifier instance + The geometry to densify + + + + Gets or sets the distance tolerance for the densification. All line segments + in the densified geometry will be no longer than the distance tolerance. + The distance tolerance must be positive. + + + + + Gets or sets whether polygonal results are processed to ensure they are valid. + + true if polygonal input is validated. + + + + Gets the densified geometry. + + The densified geometry + + + + Indicates whether areas should be topologically validated. +
Note: JTS name _isValidated +
+
+ + + Creates a valid area geometry from one that possibly has bad topology + (i.e. self-intersections). Since buffer can handle invalid topology, but + always returns valid geometry, constructing a 0-width buffer "corrects" + the topology. Note this only works for area geometries, since buffer + always returns areas. This also may return empty geometries, if the input + has no actual area. + + An area geometry possibly containing self-intersections + A valid area geometry + + + + A graph containing s. + + + + + A HalfEdge which carries information + required to support . + + + + + Tests whether this edge is the starting segment + in a LineString being dissolved. + + true if this edge is a start segment + + + + Sets this edge to be the start segment of an input LineString. + + + + + Dissolves the linear components + from a collection of s. + into a set of maximal-length s + in which every unique segment appears once only. + The output linestrings run between node vertices + of the input, which are vertices which have + either degree 1, or degree 3 or greater. + + + Use cases for dissolving linear components + include generalization + (in particular, simplifying polygonal coverages), + and visualization + (in particular, avoiding symbology conflicts when + depicting shared polygon boundaries). + + + This class does NOT node the input lines. + If there are line segments crossing in the input, + they will still cross in the output. + + + + + Dissolves the linear components in a geometry. + + the geometry to dissolve + the dissolved lines + + + + Creates an instance of this class + + + + + Adds a to be dissolved. + Any number of geometries may be added by calling this method multiple times. + Any type of Geometry may be added. The constituent linework will be + extracted to be dissolved. + + geometry to be line-merged + + + + Adds a collection of Geometries to be processed. May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be + extracted. + + the geometries to be line-merged + + + + Gets the dissolved result as a . + + the dissolved lines + + + + For each edge in stack + (which must originate at a node) + extracts the line it initiates. + + + + + Updates the tracked ringStartEdge + if the given edge has a lower origin + (using the standard ordering). + + + Identifying the lowest starting node meets two goals: + * It ensures that isolated input rings are created using the original node and orientation. + * For isolated rings formed from multiple input linestrings, + it provides a canonical node and orientation for the output + (rather than essentially random, and thus hard to test). + + + + + + Builds a line starting from the given edge. + The start edge origin is a node (valence = 1 or >= 3), + unless it is part of a pure ring. + + + A pure ring has no other incident lines. + In this case the start edge may occur anywhere on the ring. + + + The line is built up to the next node encountered, + or until the start edge is re-encountered + (which happens if the edges form a ring). + + + + + + Adds edges around this node to the stack. + + + + + + A graph comprised of s. + It supports tracking the vertices in the graph + via edges incident on them, + to allow efficient lookup of edges and vertices. + + + This class may be subclassed to use a + different subclass of HalfEdge, + by overriding . + If additional logic is required to initialize + edges then + can be overridden as well. + + + + + Creates a single HalfEdge. + Override to use a different HalfEdge subclass. + + the origin location + a new with the given origin + + + + Creates a pair, using the HalfEdge type of the graph subclass + + + + A pair + + + + Adds an edge between the coordinates orig and dest + to this graph. + + + Only valid edges can be added (in particular, zero-length segments cannot be added) + + the edge origin location + the edge destination location + The created edge + null if the edge was invalid and not added + + + + + Test if an the coordinates for an edge form a valid edge (with non-zero length) + + The start coordinate + The end coordinate + true of the edge formed is valid + + + + Inserts an edge not already present into the graph. + + the edge origin location + the edge destination location + an existing edge with same orig (if any) + the created edge + + + + Gets all s in the graph. + Both edges of edge pairs are included. + + An enumeration of the graph edges + + + + Finds an edge in this graph with the given origin + and destination, if one exists. + + the origin location + the destination location + an edge with the given orig and dest, or null if none exists + + + + Builds an edge graph from geometries containing edges. + + + + + Adds the edges of a Geometry to the graph. + May be called multiple times. + Any dimension of Geometry may be added; the constituent edges are extracted. + + geometry to be added + + + + Adds the edges in a collection of s to the graph. + May be called multiple times. + Any dimension of may be added. + + the geometries to be added + + + + Represents a directed component of an edge in an . + HalfEdges link vertices whose locations are defined by s. + HalfEdges start at an origin vertex, + and terminate at a destination vertex. + HalfEdges always occur in symmetric pairs, with the method + giving access to the oppositely-oriented component. + HalfEdges and the methods on them form an edge algebra, + which can be used to traverse and query the topology + of the graph formed by the edges. + + To support graphs where the edges are sequences of coordinates + each edge may also have a direction point supplied. + This is used to determine the ordering + of the edges around the origin. + HalfEdges with the same origin are ordered + so that the ring of edges formed by them is oriented CCW. + + By design HalfEdges carry minimal information + about the actual usage of the graph they represent. + They can be subclassed to carry more information if required. + + HalfEdges form a complete and consistent data structure by themselves, + but an is useful to allow retrieving edges + by vertex and edge location, as well as ensuring + edges are created and linked appropriately. + + Martin Davis + + + + Creates a HalfEdge pair representing an edge + between two vertices located at coordinates p0 and p1. + + a vertex coordinate + a vertex coordinate + the HalfEdge with origin at p0 + + + + Initialize a symmetric pair of halfedges. + Intended for use by + subclasses. + + The edges are initialized to have each other + as the edge, and to have + pointers which point to edge other. + This effectively creates a graph containing a single edge. + + A halfedge + A symmetric halfedge + The initialized edge e0 + + + + Creates an edge originating from a given coordinate. + + the origin coordinate + + + + Links this edge with its sym (opposite) edge. + This must be done for each pair of edges created. + + The sym edge to link. + + + + Initializes this edge with as edge. + + A symmetric half edge. + + + + Gets the origin coordinate of this edge. + + + + + Gets the destination coordinate of this edge. + + + + + Gets a value indicating the X component of the direction vector. + + The X component of the direction vector + + + + Gets a value indicating the Y component of the direction vector. + + The Y component of the direction vector + + + + Gets a value indicating the direction point of this edge. + In the base case this is the dest coordinate + of the edge. + + Subclasses may override to + allow a HalfEdge to represent an edge with more than two coordinates. + + The direction point for the edge + + + + Gets or sets the symmetric (opposite) edge of this edge. + + + + + Gets the next edge CCW around the destination vertex of this edge. + If the destination vertex has degree 1 then this is the Sym edge. + + The next outgoing edge CCW around the destination vertex + + + + Gets the previous edge CW around the origin + vertex of this edge, + with that vertex being its destination. + + It is always true that e.Next.Prev == e + + Note that this requires a scan of the origin edges, + so may not be efficient for some uses. + + The previous edge CW around the origin vertex + + + + Gets the next edge CCW around the origin of this edge, + with the same origin.
+ If the origin vertex has degree 1 then this is the edge itself. + + e.ONext is equal to e.Sym.Next() +
+ The next edge around the origin +
+ + + Finds the edge starting at the origin of this edge + with the given dest vertex, if any. + + the dest vertex to search for + + the edge with the required dest vertex, + if it exists, or null + + + + + Tests whether this edge has the given orig and dest vertices. + + the origin vertex to test + the destination vertex to test + true if the vertices are equal to the ones of this edge + + + + Inserts an edge + into the ring of edges around the origin vertex of this edge, + ensuring that the edges remain ordered CCW. + The inserted edge must have the same origin as this edge. + + the edge to insert + + + + Finds the insertion edge for a edge + being added to this origin, + ensuring that the star of edges + around the origin remains fully CCW. + + The edge being added + The edge to insert after + + + + Insert an edge with the same origin after this one. + Assumes that the inserted edge is in the correct + position around the ring. + + the edge to insert (with same origin) + + + + Tests whether the edges around the origin + are sorted correctly. + Note that edges must be strictly increasing, + which implies no two edges can have the same direction point. + + true if the origin edges are sorted correctly + + + + + Finds the lowest edge around the origin, + using the standard edge ordering. + + The lowest edge around the origin + + + + Compares edges which originate at the same vertex + based on the angle they make at their origin vertex with the positive X-axis. + This allows sorting edges around their origin vertex in CCW order. + + + + + Implements the total order relation. + The angle of edge a is greater than the angle of edge b, + where the angle of an edge is the angle made by + the first segment of the edge with the positive x-axis. + When applied to a list of edges originating at the same point, + this produces a CCW ordering of the edges around the point. + Using the obvious algorithm of computing the angle is not robust, + since the angle calculation is susceptible to round off error. + + + A robust algorithm is: + 1. compare the quadrants the edge vectors lie in. + If the quadrants are different, + it is trivial to determine which edge has a greater angle. + 2. If the vectors lie in the same quadrant, the + function + can be used to determine the relative orientation of the vectors. + + + + + The X component of the distance between the orig and dest vertices. + + + + + The Y component of the distance between the orig and dest vertices. + + + + + Computes a string representation of a HalfEdge. + + + + + Provides a string representation of the edges around + the origin node of this edge. + + + Uses the subclass representation for each edge. + + A string showing the edges around the origin + + + + Computes the degree of the origin vertex. + The degree is the number of edges + originating from the vertex. + + the degree of the origin vertex + + + + Finds the first node previous to this edge, if any. + If no such node exists (i.e. the edge is part of a ring) + then null is returned. + + + an edge originating at the node prior to this edge, if any, + or null if no node exists + + + + + A which supports + marking edges with a boolean flag. + Useful for algorithms which perform graph traversals. + + + + + Sets the mark for the given edge pair to a boolean value. + + an edge of the pair to update + the mark value to set + + + + Marks the edges in a pair. + + an edge of the pair to mark + + + + Creates a new marked edge. + + the coordinate of the edge origin + + + + Marks this edge. + + + + + A Depth object records the topological depth of the sides + of an Edge for up to two Geometries. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Calls GetDepth and SetDepth. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A Depth object is null (has never been initialized) if all depths are null. + + true if depth is null (has never been initialized) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Normalize the depths for each point, if they are non-null. + A normalized depth + has depth values in the set { 0, 1 }. + Normalizing the depths + involves reducing the depths by the same amount so that at least + one of them is 0. If the remaining value is > 0, it is set to 1. + + + + + + + + + + + + + + + + Computes the factor for the change in depth when moving from one location to another. + E.g. if crossing from the to the + the depth decreases, so the factor is -1. + + The current location + The next location + Change of depth moving from to + + + + The depth of each side (position) of this edge. + The 0 element of the array is never used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set depth for a position + + The position to update + The depth at the provided position + + + + + + + + + Gets or sets a value indicating if both Visited + and Sym.Visited are true. + + Setting the property marks both DirectedEdges attached to a given Edge. + + This is used for edges corresponding to lines, which will only + appear oriented in a single direction in the result. + + + + + + + + + + + + + + + + + + + + + + + + + + Gets a value indicating if this edge is a line edge. + It is if + + at least one of the labels is a line label + any labels which are not line labels have all Location = Exterior. + + + true if edge is a line edge + + + + This is an interior Area edge if + its label is an Area label for both Geometries + and for each Geometry both sides are in the interior. + + true if this is an interior Area edge. + + + + Compute the label in the appropriate orientation for this DirEdge. + + + + + Set both edge depths. + One depth for a given side is provided. + The other is computed depending on the Location + transition and the depthDelta of the edge. + + The position to update + The depth at the provided position + + + + Set both edge depths. + One depth for a given side is provided. + The other is computed depending on the Location + transition and the depthDelta of the edge. + + The position to update + The depth at the provided position + + + + + + + + + + + + + + + + A DirectedEdgeStar is an ordered list of outgoing DirectedEdges around a node. + It supports labelling the edges as well as linking the edges to form both + MaximalEdgeRings and MinimalEdgeRings. + + + + + A list of all outgoing edges in the result, in CCW order. + + + + + Insert a directed edge in the list. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compute the labelling for all dirEdges in this star, as well + as the overall labelling. + + + + + + For each dirEdge in the star, merge the label . + + + + + Update incomplete dirEdge labels from the labeling for the node. + + The label to apply + + + + + + + + + + Traverse the star of DirectedEdges, linking the included edges together. + To link two dirEdges, the next pointer for an incoming dirEdge + is set to the next outgoing edge. + DirEdges are only linked if: + they belong to an area (i.e. they have sides) + they are marked as being in the result + Edges are linked in CCW order (the order they are stored). + This means that rings have their face on the Right + (in other words, the topological location of the face is given by the RHS label of the DirectedEdge). + PRECONDITION: No pair of dirEdges are both marked as being in the result. + + + + + + + + + + + + + + + + Traverse the star of edges, maintaining the current location in the result + area at this node (if any). + If any L edges are found in the interior of the result, mark them as covered. + + + + + + + + + + + Compute the DirectedEdge depths for a subsequence of the edge array. + + The last depth assigned (from the R side of the last edge visited). + + + + + + + + + + + + + + + Updates an IM from the label for an edge. + Handles edges from both L and A geometries. + + An intersection matrix + A label + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The depthDelta is the change in depth as an edge is crossed from R to L. + + The change in depth as the edge is crossed from R to L. + + + + + + + + + + + + + + + + + + + + + + + + An Edge is collapsed if it is an Area edge and it consists of + two segments which are equal and opposite (eg a zero-width V). + + true if edge is consisting of two segments + which are equal and of oppose orientation (Zero-width V area edge) + + + + + + + + + + + + + + + + + + + + Adds EdgeIntersections for one or both + intersections found for a segment of an edge to the edge intersection list. + + A line intersector + A segment index + A geometry index + + + + Add an EdgeIntersection for intersection intIndex. + An intersection that falls exactly on a vertex of the edge is normalized + to use the higher of the two possible segmentIndexes. + + A line intersector + A segment index + A geometry index + The intersection index (0 or 1) + + + + Update the IM with the contribution for this component. + A component only contributes if it has a labelling for both parent geometries. + + + + + + Equals is defined to be: + e1 equals e2 + if + the coordinates of e1 are the same or the reverse of the coordinates in e2. + + + + + + + + + Equals is defined to be: + e1 equals e2 + if + the coordinates of e1 are the same or the reverse of the coordinates in e2. + + + + + + + + + + + + + + + + + + + + + + Check if coordinate sequences of the Edges are identical. + + The edge to test + + true if the coordinate sequences of the Edges are identical. + + + + > + + + + + + + + + + + + + + + + Models the end of an edge incident on a node. + + + + EdgeEnds have a direction determined by the direction of the ray from the initial + point to the next point. + + + EdgeEnds are IComparable under the ordering "a has a greater angle with the x-axis than b". + This ordering is used to sort EdgeEnds around a node. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Implements the total order relation: + a has a greater angle with the positive x-axis than b. + + Using the obvious algorithm of simply computing the angle is not robust, + since the angle calculation is obviously susceptible to round off. + + A robust algorithm is: + + first compare the quadrant. If the quadrants + are different, it it trivial to determine which vector is "greater". + if the vectors lie in the same quadrant, the computeOrientation function + can be used to decide the relative orientation of the vectors. + + + An EdgeEnd + The of compared to this . + + + + Subclasses should override this if they are using labels + + + + + + + + + + + + + + + A EdgeEndStar is an ordered list of EdgeEnds around a node. + They are maintained in CCW order (starting with the positive x-axis) around the node + for efficient lookup and topology building. + + + + + A map which maintains the edges in sorted order around the node. + + + + + A list of all outgoing edges in the result, in CCW order. + + + + + The location of the point for this star in Geometry i Areas. + + + + + Insert a EdgeEnd into this EdgeEndStar. + + An EdgeEnd + + + + Insert an EdgeEnd into the map, and clear the edgeList cache, + since the list of edges has now changed. + + An EdgeEnd + An EdgeEnd + + + + The coordinate for the node this star is based at. + + + + + + + + + + Iterator access to the ordered list of edges is optimized by + copying the map collection to a list. (This assumes that + once an iterator is requested, it is likely that insertion into + the map is complete). + + Access to ordered list of edges. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + An EdgeIntersection represents a point on an + edge which intersects with another edge. + The intersection may either be a single point, or a line segment + (in which case this point is the start of the line segment) + The label attached to this intersection point applies to + the edge from this point forwards, until the next + intersection or the end of the edge. + The intersection point must be precise. + + + + + The point of intersection. + + + + + The index of the containing line segment in the parent edge. + + + + + The edge distance of this point along the containing line segment. + + + + + Creates an instance of this class + + The point of intersection + The index of the containing line segment in the parent edge + The edge distance or this point along the containing line segment + + + + + + + Comparison with segment and distance. + + The index of the containing line segment + The distance of this point along the containing line segment + + -1 this EdgeIntersection is located before the argument location, + 0 this EdgeIntersection is at the argument location, + 1 this EdgeIntersection is located after the argument location. + + + + + + + + + + + + + + + + + + + + + A list of edge intersections along an Edge. + + + + + + + + + + + + + + + + Adds an intersection into the list, if it isn't already there. + The input segmentIndex and dist are expected to be normalized. + + The point of intersection + The index of the containing line segment in the parent edge + The edge distance of this point along the containing line segment + The EdgeIntersection found or added. + + + + Returns an iterator of EdgeIntersections. + + + + + + + + + + + + Adds entries for the first and last points of the edge to the list. + + + + + Creates new edges for all the edges that the intersections in this + list split the parent edge into. + Adds the edges to the input list (this is so a single list + can be used to accumulate all split edges for a Geometry). + + + + + + Create a new "split edge" with the section of points between + (and including) the two intersections. + The label for the new edge is the same as the label for the parent edge. + + + + + + + + + + + + + A EdgeList is a list of Edges. It supports locating edges + that are point-wise equals to a target edge. + + + + + An index of the edges, for fast lookup. + + + + + Remove the selected Edge element from the list if present. + + Edge element to remove from list + + + + Insert an edge unless it is already in the list. + + An Edge + + + + + + + + + + + + + + + If there is an edge equal to e already in the list, return it. + Otherwise return null. + + An Edge + + The equal edge, if there is one already in the list, + null otherwise. + + + + + + + + + + + + + + + + + + + + + + + + + If the edge e is already in the list, return its index. + + An Edge + + The index, if e is already in the list, + -1 otherwise. + + + + + + + + + + + Validates that a collection of is correctly noded. + Throws an appropriate exception if an noding error is found. + + Uses to perform the validation. + + + + + + Checks whether the supplied s are correctly noded. + + an enumeration of Edges. + If the SegmentStrings are not correctly noded + + + + Creates a new validator for the given collection of s. + + + + + Checks whether the supplied edges are correctly noded. + + If the SegmentStrings are not correctly noded + + + + + + + + + The directed edge which starts the list of edges for this EdgeRing. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compute a LinearRing from the point list previously collected. + Test if the ring is a hole (i.e. if it is CCW) and set the hole flag + accordingly. + + + + + + + + + + + + + + + + + + + Returns the list of DirectedEdges that make up this EdgeRing. + + A list of DirectedEdges + + + + Collect all the points from the DirectedEdges of this ring into a contiguous list. + + + + + + + + + + + + + + + + + + + + + + + + + + + Merge the RHS label from a DirectedEdge into the label for this EdgeRing. + The DirectedEdge label may be null. This is acceptable - it results + from a node which is NOT an intersection node between the Geometries + (e.g. the end node of a LinearRing). In this case the DirectedEdge label + does not contribute any information to the overall labelling, and is simply skipped. + + + + + + + + + + + + + + + This method will cause the ring to be computed. + It will also check any holes, if they have been assigned. + + The point to test + true if the ring contains point + + + + A GeometryGraph is a graph that models a given Geometry. + + + + + Determine boundary + + The boundary node rule to apply for determination of the boundary + The number of component boundaries that a point occurs in. + or + + + + The lineEdgeMap is a map of the linestring components of the + parentGeometry to the edges which are derived from them. + This is used to efficiently perform findEdge queries + + + + + If this flag is true, the Boundary Determination Rule will used when deciding + whether nodes are in the boundary or not + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the used with this geometry graph. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add a Point to the graph. + + + + + + Adds a polygon ring to the graph. Empty rings are ignored. + The left and right topological location arguments assume that the ring is oriented CW. + If the ring is in the opposite orientation, + the left and right locations must be interchanged. + + + + + + + + + + + + + + + + + + + + Add an Edge computed externally. The label on the Edge is assumed + to be correct. + + An Edge + + + + Add a point computed externally. The point is assumed to be a + Point Geometry part, which has a location of INTERIOR. + + A Coordinate + + + + Compute self-nodes, taking advantage of the Geometry type to + minimize the number of intersection tests. (E.g. rings are + not tested for self-intersection, since they are assumed to be valid). + + The LineIntersector to use. + If false, intersection checks are optimized to not test rings for self-intersection. + The computed SegmentIntersector, containing information about the intersections found. + + + + Compute self-nodes, taking advantage of the Geometry type to + minimize the number of intersection tests. (E.g.rings are + not tested for self-intersection, since they are assumed to be valid). + + The LineIntersector to use + If false, intersection checks are optimized to not test rings for self-intersection + Short-circuit the intersection computation if a proper intersection is found + + + + + + + + + + + + + + + + + + + + + Adds candidate boundary points using the current . + This is used to add the boundary + points of dim-1 geometries (Curves/MultiCurves). + + + + + + + + + + + + + Add a node for a self-intersection. + If the node is a potential boundary node (e.g. came from an edge which + is a boundary) then insert it as a potential boundary node. + Otherwise, just add it as a regular node. + + + + + + + + Determines the of the given in this geometry. + + The point to test + + The location of the point in the geometry + + + + + A GraphComponent is the parent class for the objects' + that form a graph. Each GraphComponent can carry a + Label. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsInResult indicates if this component has already been included in the result. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A coordinate in this component (or null, if there are none). + + + + + Compute the contribution to an IM for this component. + + An IntersectionMatrix + + + + An isolated component is one that does not intersect or touch any other + component. This is the case if the label has valid locations for + only a single Geometry. + + true if this component is isolated. + + + + Update the IM with the contribution for this component. + A component only contributes if it has a labelling for both parent geometries. + + An IntersectionMatrix + + + + An EdgeSetIntersector computes all the intersections between the + edges in the set. It adds the computed intersections to each edge + they are found on. It may be used in two scenarios: + determining the internal intersections between a single set of edges + determining the mutual intersections between two different sets of edges + It uses a SegmentIntersector to compute the intersections between + segments and to record statistics about what kinds of intersections were found. + + + + + Computes all self-intersections between edges in a set of edges, + allowing client to choose whether self-intersections are computed. + + A list of edges to test for intersections. + The SegmentIntersector to use + true if self-intersections are to be tested as well. + + + + Computes all mutual intersections between two sets of edges. + + A set of edges + A set of edges + The SegmentIntersector to use + + + + + + + + + + + + + + + + + + + + + + + MonotoneChains are a way of partitioning the segments of an edge to + allow for fast searching of intersections. + They have the following properties: + the segments within a monotone chain will never intersect each other, and + the envelope of any contiguous subset of the segments in a monotone chain + is simply the envelope of the endpoints of the subset. + Property 1 means that there is no need to test pairs of segments from within + the same monotone chain for intersection. + Property 2 allows + binary search to be used to find the intersection points of two monotone chains. + For many types of real-world data, these properties eliminate a large number of + segment comparisons, producing substantial speed gains. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests whether the envelopes of two chain sections overlap (intersect). + + true if the section envelopes overlap + + + + MonotoneChains are a way of partitioning the segments of an edge to + allow for fast searching of intersections. + + Specifically, a sequence of contiguous line segments + is a monotone chain if all the vectors defined by the oriented segments + lies in the same quadrant. + + Monotone Chains have the following useful properties: + the segments within a monotone chain will never intersect each other, and + the envelope of any contiguous subset of the segments in a monotone chain + is simply the envelope of the endpoints of the subset. + Property 1 means that there is no need to test pairs of segments from within + the same monotone chain for intersection. + Property 2 allows + binary search to be used to find the intersection points of two monotone chains. + For many types of real-world data, these properties eliminate a large number of + segment comparisons, producing substantial speed gains. + + + Note that due to the efficient intersection test, there is no need to limit the size + of chains to obtain fast performance. + + + + + + + + + + + + + The index of the last point in the monotone chain. + + + + + + Computes the intersection of line segments, + and adds the intersection to the edges containing the segments. + + + + + + + + + + + + + Testing only. + + + + + + + + + + + + + + + + + + + + The proper intersection point, or null if none was found. + + + + + + + + + + A proper intersection is an intersection which is interior to at least two + line segments. Note that a proper intersection is not necessarily + in the interior of the entire Geometry, since another edge may have + an endpoint equal to the intersection, which according to SFS semantics + can result in the point being on the Boundary of the Geometry. + + Indicates a proper intersection with an interior to at least two line segments + + + + A proper interior intersection is a proper intersection which is not + contained in the set of boundary nodes set for this SegmentIntersector. + + Indicates a proper interior intersection + + + + A trivial intersection is an apparent self-intersection which in fact + is simply the point shared by adjacent line segments. + Note that closed edges require a special check for the point shared by the beginning + and end segments. + + An Edge + The segment index of + Another Edge + The segment index of + + + + This method is called by clients of the EdgeIntersector class to test for and add + intersections for two segments of the edges being intersected. + Note that clients (such as MonotoneChainEdges) may choose not to intersect + certain pairs of segments for efficiency reasons. + + + + + + + + + + + + + + + + + + + + + + + + + Finds all intersections in one or two sets of edges, + using the straightforward method of + comparing all segments. + This algorithm is too slow for production use, but is useful for testing purposes. + + + + + + + + + + + + + + + + + + + + + Performs a brute-force comparison of every segment in each Edge. + This has n^2 performance, and is about 100 times slower than using + monotone chains. + + + + + + + + Finds all intersections in one or two sets of edges, + using an x-axis sweepline algorithm in conjunction with Monotone Chains. + While still O(n^2) in the worst case, this algorithm + drastically improves the average-case time. + The use of MonotoneChains as the items in the index + seems to offer an improvement in performance over a sweep-line alone. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Because Delete Events have a link to their corresponding Insert event, + it is possible to compute exactly the range of events which must be + compared to a given Insert event object. + + + + + + + + + + + + + + + + + + + + Finds all intersections in one or two sets of edges, + using a simple x-axis sweepline algorithm. + While still O(n^2) in the worst case, this algorithm + drastically improves the average-case time. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Because DELETE events have a link to their corresponding INSERT event, + it is possible to compute exactly the range of events which must be + compared to a given INSERT event object. + + + + + + + + + + + + + + + + + + + + + + + + + Creates an INSERT event. + + The edge set label for this object. + The event location + the object being inserted + + + + Creates a DELETE event. + + The event location + The corresponding INSERT event + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Events are ordered first by their x-value, and then by their eventType. + Insert events are sorted before Delete events, so that + items whose Insert and Delete events occur at the same x-value will be + correctly handled. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A Label indicates the topological relationship of a component + of a topology graph to a given Geometry. + This class supports labels for relationships to two Geometrys, + which is sufficient for algorithms for binary operations. + Topology graphs support the concept of labeling nodes and edges in the graph. + The label of a node or edge specifies its topological relationship to one or + more geometries. (In fact, since NTS operations have only two arguments labels + are required for only two geometries). A label for a node or edge has one or + two elements, depending on whether the node or edge occurs in one or both of the + input Geometrys. Elements contain attributes which categorize the + topological location of the node or edge relative to the parent + Geometry; that is, whether the node or edge is in the interior, + boundary or exterior of the Geometry. Attributes have a value + from the set {Interior, Boundary, Exterior}. In a node each + element has a single attribute On. For an edge each element has a + triplet of attributes Left, On, Right. + It is up to the client code to associate the 0 and 1 TopologyLocations + with specific geometries. + + + + + Converts a Label to a Line label (that is, one with no side Location). + + Label to convert. + Label as Line label. + + + + Construct a Label with a single location for both Geometries. + Initialize the locations to Null. + + A location value + + + + Construct a Label with a single location for both Geometries. + Initialize the location for the Geometry index. + + A geometry index, 0, or 1. + A location value for On + + + + Construct a Label with On, Left and Right locations for both Geometries. + Initialize the locations for both Geometries to the given values. + + A location value for On + A location value for Left + A location value for Right + + + + Construct a Label with On, Left and Right locations for both Geometries. + Initialize the locations for the given Geometry index. + + A geometry index, 0, or 1. + A location value for On + A location value for Left + A location value for Right + + + + Construct a Label with the same values as the argument Label. + + A Label + + + + Performs on both + s of this Label + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Merge this label with another one. + Merging updates any null attributes of this label with the attributes from . + + The Label to merge + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Converts one GeometryLocation to a Line location. + + The index of the TopologyLocation to convert (0 or 1) + + + + + + + + + + + + + + + Only non-null if this node is precise. + + + + + + + + + + + + Gets a value indicating the position of this + + The position of this Node + + + + Gets a value indicating the EdgeEndStar of this Node + + The EdgeEndStar of this Node + + + + Tests whether any incident edge is flagged as + being in the result. + This test can be used to determine if the node is in the result, + since if any incident edge is in the result, the node must be in the result as well. + + true if any incident edge in the in the result + + + + + + + + + Basic nodes do not compute IMs. + + + + + Add the edge to the list of edges at this node. + + An EdgeEnd + + + + Merges 's with this Node's Label. + + A Node + + + + To merge labels for two nodes, + the merged location for each LabelElement is computed. + The location for the corresponding node LabelElement is set to the result, + as long as the location is non-null. + + The Label to merge + + + + + + + + + + + Updates the label of a node to BOUNDARY, + obeying the mod-2 boundaryDetermination rule. + + An index for a (0 or 1) + + + + The location for a given eltIndex for a node will be one + of { Null, Interior, Boundary }. + A node may be on both the boundary and the interior of a point; + in this case, the rule is that the node is considered to be in the boundary. + The merged location is the maximum of the two input values. + + + + + + + + + + + + + + + + + + + A Factory to create s. + + + + + The basic node constructor does not allow for incident edges. + + A Coordinate + The created Node + + + + A map of nodes, indexed by the coordinate of the node. + + + + + Creates an instance of this class using the provided . + + A factory to create Nodes + + + + This method expects that a node has a coordinate value. + + A Coordinate + The Node for the provided Coordinate + + + + Adds a Node to this NodeMap. + If a Node with the same + is already present in this NodeMap, + their s are merged. + + The Node to add + Either or a Node with merged Labels + + + + Adds a node for the start point of this EdgeEnd + (if one does not already exist in this map). + Adds the EdgeEnd to the (possibly new) node. + + An EdgeEnd + + + + Searches for a Node at position. + + A Coordinate + + The node if found; null otherwise. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The computation of the IntersectionMatrix relies on the use of a structure + called a "topology graph". The topology graph contains nodes and edges + corresponding to the nodes and line segments of a Geometry. Each + node and edge in the graph is labeled with its topological location relative to + the source point. + Note that there is no requirement that points of self-intersection be a vertex. + Thus to obtain a correct topology graph, Geometrys must be + self-noded before constructing their graphs. + Two fundamental operations are supported by topology graphs: + Computing the intersections between all the edges and nodes of a single graph + Computing the intersections between the edges and nodes of two different graphs + + + + + For nodes in the Collection, link the DirectedEdges at the node that are in the result. + This allows clients to link only a subset of nodes in the graph, for + efficiency (because they know that only a subset is of interest). + + A collection of Nodes + + + + + + + + + + + + + + + + + + + Creates an instance of this class using the provided + + A factory to create Nodes + + + + Creates an instance of this class using the default . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Searches for a Node at Coordinate position + + A Coordinate position + + The node if found; null otherwise + + + + + Add a set of edges to the graph. For each edge two DirectedEdges + will be created. DirectedEdges are NOT linked by this method. + + A set of Edges to add. + + + + Link the DirectedEdges at the nodes of the graph. + This allows clients to link only a subset of nodes in the graph, for + efficiency (because they know that only a subset is of interest). + + + + + Link the DirectedEdges at the nodes of the graph. + This allows clients to link only a subset of nodes in the graph, for + efficiency (because they know that only a subset is of interest). + + + + + Returns the EdgeEnd which has edge e as its base edge + (MD 18 Feb 2002 - this should return a pair of edges). + + An Edge + The edge, if found null if the edge was not found. + + + + Returns the edge whose first two coordinates are p0 and p1. + + The 1st Coordinate + The 2nd Coordinate + The edge, if found null if the edge was not found. + + + + Returns the edge which starts at p0 and whose first segment is + parallel to p1. + + Starting Coordinate + Coordinate used to establish direction + The matching edge, if found null if the edge was not found. + + + + The coordinate pairs match if they define line segments lying in the same direction. + E.g. the segments are parallel and in the same quadrant + (as opposed to parallel and opposite!). + + + + + + + + + + + + + + + + + + + + An indicator that a Location is on a GraphComponent (0) + + + + + An indicator that a Location is to the left of a GraphComponent (1) + + + + + An indicator that a Location is to the right of a GraphComponent (2) + + + + + An indicator that a Location is is parallel to x-axis of a GraphComponent (-1) + /// + + + + A Position indicates the position of a Location relative to a graph component + (Node, Edge, or Area). + + + + + Returns Positions.Left if the position is Positions.Right, + Positions.Right if the position is Left, or the position + otherwise. + + + + + + Utility functions for working with quadrants, which are numbered as follows: + + 1 | 0 + --+-- + 2 | 3 + + + + + + North-East + + + + + North-West + + + + + South-West + + + + + South-East + + + + + Only static methods! + + + + + Returns the quadrant of a directed line segment (specified as x and y + displacements, which cannot both be 0). + + + + If the displacements are both 0 + + + + Returns the quadrant of a directed line segment from p0 to p1. + + + + if the points are equal + + + + Returns true if the quadrants are 1 and 3, or 2 and 4. + + + + + + + Returns the right-hand quadrant of the halfplane defined by the two quadrants, + or -1 if the quadrants are opposite, or the quadrant if they are identical. + + + + + + + Returns whether the given quadrant lies within the given halfplane (specified + by its right-hand quadrant). + + + + + + + Returns true if the given quadrant is 0 or 1. + + + + + + A TopologyLocation is the labelling of a + GraphComponent's topological relationship to a single Geometry. + + + If the parent component is an area edge, each side and the edge itself + have a topological location. These locations are named: + + Onon the edge + Leftleft-hand side of the edge + Rightright-hand side + + + If the parent component is a line edge or node, there is a single + topological relationship attribute, On. + + The possible values of a topological location are + { , , , } + + The labelling is stored in an array _location[j] where + where j has the values On, Left, Right. + + + + + + + + + + + + Constructs a TopologyLocation specifying how points on, to the left of, and to the + right of some GraphComponent relate to some Geometry. Possible values for the + parameters are Location.Null, Location.Exterior, Location.Boundary, + and Location.Interior. + + Location for On position + Location for Left position + Location for Right position + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get calls Get(Positions posIndex), + Set calls SetLocation(Positions locIndex, Location locValue) + + + + + + + Get calls Get(Positions posIndex), + Set calls SetLocation(Positions locIndex, Location locValue) + + + + + + + true if all locations are Null. + + + + + true if any locations are Null. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Merge updates only the Null attributes of this object + with the attributes of another. + + + + + + + + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane. + + The base data object is suitable for use with coordinate sequences with + dimension = 2 and measures = 0. + + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a Coordinate only contains ordinate values + and properties. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + The value used to indicate a null or missing ordinate value. + In particular, used for the value of ordinates for dimensions + greater than the defined dimension of a coordinate. + + + + + Gets or sets the X-ordinate value. + + + + + Gets or sets the Y-ordinate value. + + + + + Gets or sets the Z-ordinate value, if supported. + If no Z value is present, returns . + + + Thrown if an attempt is made to set the Z-ordinate value on an instance where + the Z-ordinate value is not supported. + + + + + Gets or sets the value of the measure, if supported. + If no measure value is present, returns . + + + Thrown if an attempt is made to set the measure value on an instance where + measures are not supported. + + + + + Constructs a Coordinate at (x,y). + + The X value + The Y value + + + + Constructs a Coordinate at (0,0). + + + + + Constructs a Coordinate having the same (x,y,z) values as + . + + Coordinate to copy. + + + + Gets or sets the value for the given ordinate. + + The ordinate. + The ordinate value + Thrown if is not one of , , , or . + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X) and 1 (Y) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets Coordinates (x,y,z) values. + + + + Gets a value indicating if the Coordinate + has valid x- and y ordinate values + + An ordinate value is valid if it is finite. + + true if the coordinate is valid + + + + + + Predicate to check if a value is finite. + + It is finite if both and return false + + The value to test + value + + + + Returns whether the planar projections of the two Coordinates are equal. + + Coordinate with which to do the 2D comparison. + + true if the x- and y-coordinates are equal; + the Z coordinates do not have to be equal. + + + + + Tests if another Coordinate has the same values for the X and Y ordinates, + within a specified tolerance value. The Z ordinate is ignored. + + A . + The tolerance value to use. + true if the X and Y ordinates are within the given tolerance. + The Z ordinate is ignored. + + + + + + + + + + + Compares this object with the specified object for order. + Since Coordinates are 2.5D, this routine ignores the z value when making the comparison. + Returns + -1 : this.x < other.x || ((this.x == other.x) AND (this.y < other.y)) + 0 : this.x == other.x AND this.y = other.y + 1 : this.x > other.x || ((this.x == other.x) AND (this.y > other.y)) + + Coordinate with which this Coordinate is being compared. + + A negative integer, zero, or a positive integer as this Coordinate + is less than, equal to, or greater than the specified Coordinate. + + + + + Compares this object with the specified object for order. + Since Coordinates are 2.5D, this routine ignores the z value when making the comparison. + Returns + -1 : this.x < other.x || ((this.x == other.x) AND (this.y < other.y)) + 0 : this.x == other.x AND this.y = other.y + 1 : this.x > other.x || ((this.x == other.x) AND (this.y > other.y)) + + Coordinate with which this Coordinate is being compared. + + A negative integer, zero, or a positive integer as this Coordinate + is less than, equal to, or greater than the specified Coordinate. + + + + + Create a copy of this . + + A copy of this coordinate. + + + + Create a Coordinate of the same type as this Coordinate, using the provided values. + + Depending on the actual type the following limitations are in place: + + Coordinate (Sub-)ClassLimitation + Coordinate-parameter and -parameter are silently dropped. + CoordinateZ-parameter is silently dropped. + CoordinateM-parameter is silently dropped. + CoordinateZMNo parameter is dropped. + + + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Computes the 2-dimensional Euclidean distance to another location. + + A with which to do the distance comparison. + the 2-dimensional Euclidean distance between the locations. + The Z-ordinate is ignored. + + + + Returns true if other has the same values for the x and y ordinates. + Since Coordinates are 2.5D, this routine ignores the z value when making the comparison. + + Coordinate with which to do the comparison. + true if other is a Coordinate with the same values for the x and y ordinates. + + + + Gets a hashcode for this coordinate. + + A hashcode for this coordinate. + + + + Returns a string of the form (x,y,z) . + + string of the form (x,y,z) + + + + Useful utility functions for handling Coordinate arrays. + + + + + Determine dimension based on subclass of . + + pts supplied coordinates + number of ordinates recorded + + + + Determine number of measures based on subclass of . + + supplied coordinates + number of measures recorded + + + + Utility method ensuring array contents are of consistent dimension and measures. + + Array is modified in place if required, coordinates are replaced in the array as required + to ensure all coordinates have the same dimension and measures. The final dimension and + measures used are the maximum found when checking the array. + + Modified in place to coordinates of consistent dimension and measures. + + + + Utility method ensuring array contents are of the specified dimension and measures. + + Array is returned unmodified if consistent, or a copy of the array is made with + each inconsistent coordinate duplicated into an instance of the correct dimension and measures. + + A coordinate array + + + Input array or copy created if required to enforce consistency. + + + + Tests whether an array of s forms a ring, by checking length and closure. + Self-intersection is not checked. + + An array of Coordinates + true if the coordinate form a ring. + + + + Finds a in a list of s + which is not contained in another list of s. + + The s to test. + An array of s to test the input points against. + + A from + which is not in , or null. + + + + + Compares two arrays + in the forward direction of their coordinates, + using lexicographic ordering. + + + + + + + + Determines which orientation of the array is (overall) increasing. + In other words, determines which end of the array is "smaller" + (using the standard ordering on ). + Returns an integer indicating the increasing direction. + If the sequence is a palindrome, it is defined to be + oriented in a positive direction. + + The array of Coordinates to test. + + 1 if the array is smaller at the start or is a palindrome, + -1 if smaller at the end. + + + + + Determines whether two arrays of equal length + are equal in opposite directions. + + + + + + + + Creates a deep copy of the argument Coordinate array. + + Array of Coordinates. + Deep copy of the input. + + + + Creates a deep copy of a given section of a source array into a destination Coordinate array. + The destination array must be an appropriate size to receive the copied coordinates. + + An array of Coordinates + The index to start copying from + The array to receive the deep-copied coordinates + The destination index to start copying to + The number of items to copy + + + + Converts the given of + s into a array. + + of coordinates. + + + + + Returns whether returns true + for any two consecutive coordinates in the given array. + + An array of Coordinates. + true if coord has repeated points; false otherwise. + + + + Returns either the given coordinate array if its length is greater than + the given amount, or an empty coordinate array. + + Length amount. + Array of Coordinates. + New Coordinate array. + + + + If the coordinate array argument has repeated points, + constructs a new array containing no repeated points. + Otherwise, returns the argument. + + An array of Coordinates + The array with repeated coordinates removed + + + + Tests whether an array has any repeated or invalid coordinates. + + An array of coordinates + true if the array contains repeated or invalid coordinates + + + + + If the coordinate array argument has repeated or invalid points, + constructs a new array containing no repeated points. + Otherwise, returns the argument. + + An array of coordinates + The array with repeated or invalid coordinates removed. + + + + + + Collapses a coordinate array to remove all null elements. + + The coordinate array to collapse + An Array containing only non-null elements + + + + Reverses the coordinates in an array in-place. + + Array of Coordinates. + + + + Returns true if the two arrays are identical, both null, or pointwise + equal (as compared using Coordinate.Equals). + + First array of Coordinates. + Second array of Coordinates. + true if two Coordinates array are equals; false otherwise + + + + Compares two arrays + in the forward direction of their coordinates, + using lexicographic ordering. + + + + + Compares the specified s arrays. + + An array of coordinates + An array of coordinates + + + + A comparator for arrays modulo their directionality. + E.g. if two coordinate arrays are identical but reversed + they will compare as equal under this ordering. + If the arrays are not equal, the ordering returned + is the ordering in the forward direction. + + + + + Compares the specified s arrays. + + An array of coordinates + An array of coordinates + + + + + + + Returns true if the two arrays are identical, both null, or pointwise + equal, using a user-defined + for s. + + An array of s. + Another array of s. + + A for s. + + + + + + Returns the minimum coordinate, using the usual lexicographic comparison. + + Array to search. + The minimum coordinate in the array, found using CompareTo. + + + + Shifts the positions of the coordinates until firstCoordinate is first. + + Array to rearrange. + Coordinate to make first. + + + + Shifts the positions of the coordinates until the coordinate + at indexOfFirstCoordinate is first. + + The array of coordinates to arrange + The index of the coordinate to make first + + + + Shifts the positions of the coordinates until the coordinate + at indexOfFirstCoordinate is first. + + + If is true, first and last + coordinate of the returned array are equal. + + The array of coordinates to arrange + The index of the coordinate to make first + A flag indicating if returned array should form a ring. + + + + Returns the index of in . + The first position is 0; the second is 1; etc. + + A to search for. + A array to search. + The position of coordinate, or -1 if it is not found. + + + + Extracts a subsequence of the input array + from indices to (inclusive). + The input indices are clamped to the array size; + If the end index is less than the start index, + the extracted array will be empty. + + The input array. + The index of the start of the subsequence to extract. + The index of the end of the subsequence to extract. + A subsequence of the input array. + + + + Computes the of the coordinates. + + the array to scan. + the of the . + + + + Extracts the coordinates which intersect an . + + The coordinates to scan + The envelope to intersect with + An array of coordinates which intersect with the envelope + + + + A class that can be used to test coordinates for equality. + + It uses the algorithm that was default for NTS prior to v2.2, + i.e. checks if the 2d distance between coordinates x + and y is less than or equal to a tolerance value. + + + + + + + + Compares s and for equality allowing for a . + + A Coordinate + A Coordinate + A tolerance value. + true if and can be considered equal; otherwise false. + + + + + + + Method to test 2 s for equality, allowing a tolerance. + + The 1st Coordinate + The 2nd Coordinate + A tolerance value + true if and can be considered equal. + + + + A class that can be used to test coordinates for equality. + + This class test for each ordinate if the distance is less + than a tolerance value. + + + + + Method to test 2 s for equality, allowing a tolerance. + + The 1st Coordinate + The 2nd Coordinate + A tolerance value + true if and can be considered equal. + + + + Computes the distance between two values + + 1st double + 2nd double + The distance between and + + + + A list of Coordinates, which may + be set to prevent repeated coordinates from occurring in the list. + + + + + Constructs a new list without any coordinates + + + + + Constructs a new list without any coordinates but an initial capacity + + The initial capacity of the list. + + + + Constructs a new list from an array of Coordinates, allowing repeated points. + (I.e. this constructor produces a with exactly the same set of points + as the input array.) + + Initial coordinates + + + + Constructs a new list from a collection of Coordinates, + allows repeated points. + + Collection of coordinates to load into the list. + + + + Constructs a new list from a collection of Coordinates, + allowing caller to specify if repeated points are to be removed. + + Collection of coordinates to load into the list. + If false, repeated points are removed. + + + + Constructs a new list from an array of Coordinates, + allowing caller to specify if repeated points are to be removed. + + Array of coordinates to load into the list. + If false, repeated points are removed. + + + + Returns the coordinate at specified index. + + Coordinate index. + Coordinate specified. + + + + Adds a section of an array of coordinates to the list. + + The coordinates + If set to false, repeated coordinates are collapsed + The index to start from + The index to add up to but not including + true (as by general collection contract) + + + + Adds an array of coordinates to the list. + + Coordinates to be inserted. + If set to false, repeated coordinates are collapsed. + If false, the array is added in reverse order. + Return true. + + + + Adds an array of coordinates to the list. + + Coordinates to be inserted. + If set to false, repeated coordinates are collapsed. + Return true. + + + + Adds a coordinate to the list. + + Coordinate to be inserted, as object. + If set to false, repeated coordinates are collapsed. + Return true. + + + + Adds a coordinate to the end of this list. + + Coordinate to be inserted. + If set to false, repeated coordinates are collapsed. + Return true if all ok. + + + + Inserts the specified coordinate at the specified position in this list. + + The position at which to insert + the coordinate to insert + if set to false, repeated coordinates are collapsed + + + + Add an array of coordinates. + + Coordinates collection to be inserted. + If set to false, repeated coordinates are collapsed. + Return true if at least one element has added (IList not empty). + + + + Ensure this coordList is a ring, by adding the start point if necessary. + + + + + Returns the Coordinates in this collection. + + Coordinates as Coordinate[] array. + + + + Creates an array containing the coordinates in this list, + oriented in the given direction (forward or reverse). + + The direction value: true for forward, false for reverse + An oriented array of coordinates + + + + Returns a deep copy of this collection. + + The copied object. + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane + and an additional measure () value. + + This data object is suitable for use with coordinate sequences with + dimension = 3 and measures = 1. + + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a CoordinateM only contains ordinate values + and properties. + + CoordinateMs are two-dimensional points, with an additional M-ordinate. + If an M-ordinate value is not specified or not defined, + constructed coordinates have a M-ordinate of NaN + (which is also the value of ). + Apart from the basic accessor functions, NTS supports + only specific operations involving the M-ordinate. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + Gets or sets the M-ordinate value. + + + + + Constructs a CoordinateM at (x,y,z). + + The X value + The Y value + The measure value + + + + Constructs a CoordinateM at (0,0,NaN). + + + + + Constructs a CoordinateM having the same (x,y) values as + . + + Coordinate to copy. + + + + Constructs a CoordinateM at (x,y,NaN). + + X value. + Y value. + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X), 1 (Y) and 2 (M) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets CoordinateMs (x,y,z) values. + + + + + Create a Coordinate of the same type as this Coordinate, + using the provided values for , and . + + A provided value for will be silently dropped. + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Returns a string of the form (x, y, m=m). + + string of the form (x, y, m=m) + + + + Useful utility functions for handling Coordinate objects. + + + + + Factory method providing access to common Coordinate implementations. + + + created coordinate + + + + Factory method providing access to common Coordinate implementations. + + + + created coordinate + + + + Determine dimension based on subclass of . + + supplied coordinate + number of ordinates recorded + + + + Determine number of measures based on subclass of . + + supplied coordinate + number of measures recorded + + + + + + + Initializes a new instance of the class. + + The value for . + The value for . + The value for . + + Thrown when any argument is negative. + + + Thrown when and specify fewer + than two (2) spatial dimensions. + + + + + Returns the dimension (number of ordinates in each coordinate) for this sequence. + + This total includes any measures, indicated by non-zero . + + + + + + Gets the number of measures included in for each coordinate for this + sequence. + + + For a measured coordinate sequence a non-zero value is returned. + + For sequence measures is zero + For sequence measure is one + For sequence measure is zero + For sequence measure is one + Values greater than one are supported + + + + + + Gets the number of non-measure dimensions included in for each + coordinate for this sequence. + + Equivalent to Dimension - Measures. + + + + + + Gets the kind of ordinates this sequence supplies. + + + + + Gets a value indicating if is supported. + + + + + Gets a value indicating if is supported. + + + + + Gets the index of the Z ordinate (for use with or + ), or -1 if is + . + + + It's just a cache for with . + + + + + Gets the index of the M ordinate (for use with or + ), or -1 if is + . + + + It's just a cache for with . + + + + + Creates a coordinate for use in this sequence. + + + The coordinate is created supporting the same number of and + as this sequence and is suitable for use with . + + A coordinate for use with this sequence + + + + Returns (possibly a copy of) the ith Coordinate in this collection. + Whether or not the Coordinate returned is the actual underlying + Coordinate or merely a copy depends on the implementation. + Note that in the future the semantics of this method may change + to guarantee that the Coordinate returned is always a copy. Callers are + advised not to assume that they can modify a CoordinateSequence by + modifying the Coordinate returned by this method. + + + + + + + Returns a copy of the i'th coordinate in this sequence. + This method optimizes the situation where the caller is + going to make a copy anyway - if the implementation + has already created a new Coordinate object, no further copy is needed. + + The index of the coordinate to retrieve. + A copy of the i'th coordinate in the sequence + + + + Copies the i'th coordinate in the sequence to the supplied Coordinate. + At least the first two dimensions must be copied. + + The index of the coordinate to copy. + A Coordinate to receive the value. + + + + Returns ordinate X (0) of the specified coordinate. + + + The value of the X ordinate in the index'th coordinate. + + + + Returns ordinate Y (1) of the specified coordinate. + + + The value of the Y ordinate in the index'th coordinate. + + + + Returns ordinate Z of the specified coordinate if available. + + + + The value of the Z ordinate in the index'th coordinate, or + if not defined. + + + + + Returns ordinate M of the specified coordinate if available. + + + + The value of the M ordinate in the index'th coordinate, or + if not defined. + + + + + Sets ordinate X (0) of the specified coordinate to the specified value. + + + The index of the coordinate whose X value to set. + + + The value to set the coordinate's X value to. + + + + + Sets ordinate Y (1) of the specified coordinate to the specified value. + + + The index of the coordinate whose Y value to set. + + + The value to set the coordinate's Y value to. + + + + + Sets ordinate Z of the specified coordinate to the specified value if present. + + + The index of the coordinate whose Z value to set if present. + + + The value to set the coordinate's Z value to if present. + + + + + Sets ordinate M of the specified coordinate to the specified value if present. + + + The index of the coordinate whose M value to set if present. + + + The value to set the coordinate's M value to if present. + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure + values as described by and . + + + If the sequence does not provide value for the required ordinate, the implementation must not throw an exception, it should return . + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + The ordinate value, or if the sequence does not provide values for "/> + + + + Returns the ordinate of a coordinate in this sequence. + + The coordinate index in the sequence. + The ordinate value to get. + The ordinate value, or if the sequence does not provide values for "/> + + + + Gets a value indicating the first Coordinate in this sequence.
+ For LineStrings e.g. this is the starting point. +
+ First Coordinate in sequence or null if empty. +
+ + + Gets a value indicating the last Coordinate in this sequence.
+ For LineStrings e.g. this is the ending point. +
+ Last Coordinate in sequence or null if empty. +
+ + + Gets a value indicating the number of coordinates in this sequence. + + + + + Sets the value for a given ordinate of a coordinate in this sequence. + + + If the sequence can't store the ordinate value, the implementation must not throw an exception, it should simply ignore the call. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + The new ordinate value. + + + + Sets the value for a given ordinate of a coordinate in this sequence. + + The coordinate index in the sequence. + The ordinate value to set. + The new ordinate value. + + + + Returns (possibly copies of) the Coordinates in this collection. + Whether or not the Coordinates returned are the actual underlying + Coordinates or merely copies depends on the implementation. Note that + if this implementation does not store its data as an array of Coordinates, + this method will incur a performance penalty because the array needs to + be built from scratch. + + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + Returns a deep copy of this collection. + + A copy of the coordinate sequence containing copies of all points + + + + Returns a reversed copy of this . + + + A reversed copy of this . + + + Thrown when returned . + + + + + Retrieves the index at which this sequence stores a particular 's + values, if that ordinate is present in . + + + The value whose index to retrieve. + + + When this method returns, contains the index of the requested ordinate, if the ordinate + is present in this sequence; otherwise, -1. This parameter is passed uninitialized. + + + if this sequence contains ; otherwise, + . + + + + + Compares two s. + + + For sequences of the same dimension, the ordering is lexicographic. + Otherwise, lower dimensions are sorted before higher. + The dimensions compared can be limited; if this is done + ordinate dimensions above the limit will not be compared. + + + If different behaviour is required for comparing size, dimension, + or coordinate values, any or all methods can be overridden. + + + + + Compare two doubles, allowing for NaN values. + NaN is treated as being less than any valid number. + + A double + A double + -1, 0, or 1 depending on whether a is less than, equal to or greater than b + + + + The number of dimensions to test + + + + + Creates a comparator which will test all dimensions. + + + + + Creates a comparator which will test only the specified number of dimensions. + + The number of dimensions to test + + + + Compares two s for relative order. + + A coordinate sequence + A coordinate sequence + -1, 0, or 1 depending on whether o1 is less than, equal to, or greater than o2 + + + + Compares the same coordinate of two s + + A coordinate sequence + A coordinate sequence + The index of the coordinate to test + the number of dimensions to test + + + + Compares two s for relative order. + + A coordinate sequence + A coordinate sequence + -1, 0, or 1 depending on whether s1 is less than, equal to, or greater than s2 + + + + An object that knows how to build a particular implementation of + CoordinateSequence from an array of Coordinates. + + + + + + Initializes a new instance of the class.` + + + + + Initializes a new instance of the class. + + + The maximum set of flags that this instance will be + able to create sequences for. + + + + + Gets the Ordinate flags that sequences created by this factory can maximal cope with. + + + + + Returns a based on the given array; + whether or not the array is copied is implementation-dependent. + + A coordinates array, which may not be null nor contain null elements + A coordinate sequence. + + + + Creates a which is a copy + of the given . + This method must handle null arguments by creating an empty sequence. + + + A coordinate sequence + + + + Creates a of the specified size and dimension. + For this to be useful, the implementation must be mutable. + + + If the requested dimension is larger than the CoordinateSequence implementation + can provide, then a sequence of maximum possible dimension should be created. + An error should not be thrown. + + + the dimension of the coordinates in the sequence + (if user-specifiable, otherwise ignored) + A coordinate sequence + + + + Creates a of the specified size and dimension + with measure support. For this to be useful, the + implementation must be mutable. + + + If the requested dimension or measures are larger than the CoordinateSequence implementation + can provide, then a sequence of maximum possible dimension should be created. + An error should not be thrown. + + The number of coordinates in the sequence + The dimension of the coordinates in the sequence (if user-specifiable, + otherwise ignored) + The number of measures of the coordinates in the sequence (if user-specifiable, + otherwise ignored) + + + + Creates a of the specified size and ordinates. + For this to be useful, the implementation must be mutable. + + The number of coordinates. + + The ordinates each coordinate has. is fix, and can be set. + + A coordinate sequence. + + + + Gets the three parameters needed to create any instance + (, , and + ) such that the sequence can store all the data + from a given array of instances. + + + The array of instances that the sequence will be created from. + + + The values of the three parameters to use for creating the sequence. + + + + + Utility functions for manipulating s. + + + + + Reverses the coordinates in a sequence in-place. + + The coordinate sequence to reverse. + + + + Swaps two coordinates in a sequence. + + seq the sequence to modify + the index of a coordinate to swap + the index of a coordinate to swap + + + + Copies a section of a to another . + The sequences may have different dimensions; + in this case only the common dimensions are copied. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a section of a to another . + The sequences must have same dimensions. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a section of a to another . + The sequences must have same dimensions. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a section of a to another . + The sequences must have same dimensions. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a coordinate of a to another . + The sequences may have different dimensions; + in this case only the common dimensions are copied. + + The sequence to copy coordinate from + The index of the coordinate to copy + The sequence to which the coordinate should be copied to + The index of the coordinate in + + + + Copies a coordinate of a to another . + The sequences may have different dimensions; + in this case only the common dimensions are copied. + + The sequence to copy coordinate from + The index of the coordinate to copy + The sequence to which the coordinate should be copied to + The index of the coordinate in + The number of spatial ordinates to copy + The number of measure ordinates to copy + + + + Tests whether a forms a valid , + by checking the sequence length and closure + (whether the first and last points are identical in 2D). + Self-intersection is not checked. + + The sequence to test + True if the sequence is a ring + + + + + Ensures that a CoordinateSequence forms a valid ring, + returning a new closed sequence of the correct length if required. + If the input sequence is already a valid ring, it is returned + without modification. + If the input sequence is too short or is not closed, + it is extended with one or more copies of the start point. + + The CoordinateSequenceFactory to use to create the new sequence + The sequence to test + The original sequence, if it was a valid ring, or a new sequence which is valid. + + + + Extends a given . + + Because coordinate sequences are fix in size, extending is done by + creating a new coordinate sequence of the requested size. + + The new, trailing coordinate entries (if any) are filled with the last + coordinate of the input sequence + + The factory to use when creating the new sequence. + The sequence to extend. + The required size of the extended sequence + The extended sequence + + + + Tests whether two s are equal. + To be equal, the sequences must be the same length. + They do not need to be of the same dimension, + but the ordinate values for the smallest dimension of the two + must be equal. + Two NaN ordinates values are considered to be equal. + + a CoordinateSequence + a CoordinateSequence + true if the sequences are equal in the common dimensions + + + + Tests whether two Coordinates s are equal. + They do not need to be of the same dimension, + but the ordinate values for the common ordinates of the two + must be equal. + Two NaN ordinates values are considered to be equal. + + A CoordinateSequence + The index of the Coordinate in . + a CoordinateSequence + The index of the Coordinate in . + true if the sequences are equal in the common dimensions + + + + Tests whether two Coordinates s are equal. + They do not need to be of the same dimension, + but the ordinate values for the common ordinates of the two + must be equal. + Two NaN ordinates values are considered to be equal. + + A CoordinateSequence + The index of the Coordinate in . + a CoordinateSequence + The index of the Coordinate in . + The number of spatial ordinates to compare + The number of measure ordinates to compare + true if the sequences are equal in the common dimensions + + + + Creates a string representation of a . + The format is: + + ( ord0,ord1.. ord0,ord1,... ... ) + + + the sequence to output + the string representation of the sequence + + + + Returns the minimum coordinate, using the usual lexicographic comparison. + + The coordinate sequence to search + The minimum coordinate in the sequence, found using + + + + Returns the index of the minimum coordinate of the whole + coordinate sequence, using the usual lexicographic comparison. + + The coordinate sequence to search + The index of the minimum coordinate in the sequence, found using + + + + Returns the index of the minimum coordinate of a part of + the coordinate sequence (defined by + and ), using the usual lexicographic + comparison. + + The coordinate sequence to search + The lower search index + The upper search index + The index of the minimum coordinate in the sequence, found using + + + + Shifts the positions of the coordinates until firstCoordinate is first. + + The coordinate sequence to rearrange + The coordinate to make first"> + + + + Shifts the positions of the coordinates until the coordinate at firstCoordinateIndex + is first. + + The coordinate sequence to rearrange + The index of the coordinate to make first + + + + Shifts the positions of the coordinates until the coordinate at firstCoordinateIndex + is first. + + The coordinate sequence to rearrange + The index of the coordinate to make first + Makes sure that will be a closed ring upon exit + + + + Returns the index of coordinate in a + The first position is 0; the second, 1; etc. + + The Coordinate to search for + The coordinate sequence to search + + The position of coordinate, or -1 if it is not found + + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane + and an additional z-ordinate () value. + + This base data object is suitable for use with coordinate sequences with + dimension = 3 and measures = 0. + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a CoordinateZ only contains ordinate values + and properties. + + CoordinateZs are two-dimensional points, with an additional Z-ordinate. + If an Z-ordinate value is not specified or not defined, + constructed coordinates have a Z-ordinate of NaN + (which is also the value of ). + + Apart from the basic accessor functions, NTS supports + only specific operations involving the Z-ordinate. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + Gets or sets the Z-ordinate value. + + + + + Constructs a CoordinateZ at (x,y,z). + + The X value + The Y value + The Z value + + + + Constructs a CoordinateZ at (0,0,NaN). + + + + + Constructs a CoordinateZ having the same (x,y) values as + . + + Coordinate to copy. + + + + Constructs a CoordinateZ at (x,y,NaN). + + X value. + Y value. + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X), 1 (Y) and 2 (Z) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets CoordinateZs (x,y,z) values. + + + + + Create a Coordinate of the same type as this Coordinate, + using the provided values for , and . + + A provided value for will be silently dropped. + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Returns true if + has the same values for X, Y and Z. + + A with which to do the 3D comparison. + + true if is a + with the same values for X, Y and Z. + + + + + Tests if another CoordinateZ has the same value for Z, within a tolerance. + + A . + The tolerance value. + true if the Z ordinates are within the given tolerance. + + + + Returns a string of the form (x, y, z) . + + string of the form (x, y, z) + + + + Computes the 3-dimensional Euclidean distance to another location. + + A with which to do the distance comparison. + the 3-dimensional Euclidean distance between the locations. + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane + and additional z- and m-ordinate values (, ). + + This data object is suitable for use with coordinate sequences with + dimension = 4 and measures = 1. + + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a CoordinateZM only contains ordinate values + and properties. + + CoordinateZMs are two-dimensional points, with an additional Z-ordinate. + If an Z-ordinate value is not specified or not defined, + constructed coordinates have a Z-ordinate of NaN + (which is also the value of ). + + Apart from the basic accessor functions, NTS supports + only specific operations involving the Z- and/or M-ordinate. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + Gets or sets the measure-ordinate value. + + + + + Constructs a CoordinateZM at (x,y,z). + + The X value + The Y value + The Z value + The Measure value + + + + Constructs a CoordinateZM at (0,0,NaN,NaN). + + + + + Constructs a CoordinateZM having the same (x,y) values as + . + + Coordinate to copy. + + + + Constructs a CoordinateZM at (x,y,NaN). + + X value. + Y value. + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X), 1 (Y) and 2 (Z) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets CoordinateZMs (x,y,z) values. + + + + + Create a Coordinate of the same type as this Coordinate, + using the provided values for , , and . + + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Returns a string of the form (x, y, z, m=m) . + + string of the form (x, y, z, m=m) + + + + Provides constants representing the dimensions of a point, a curve and a surface. + + + Also provides constants representing the dimensions of the empty geometry and + non-empty geometries, and the wildcard constant meaning "any dimension". + These constants are used as the entries in s. + + + + + Dimension value of a point (0). + + + + + Dimension value of a point (0). + + + + + Dimension value of a curve (1). + + + + + Dimension value of a curve (1). + + + + + Dimension value of a surface (2). + + + + + Dimension value of a surface (2). + + + + + Dimension value of a empty point (-1). + + + + + Dimension value of non-empty geometries (= {Point,Curve,Surface}). + + + + + Dimension value for any dimension (= {False, True}). + + + + + Dimension value for a unknown spatial object + + + + + Dimension value for a collapsed surface or curve + + + + + Class containing static methods for conversions + between dimension values and characters. + + + + + Symbol for the FALSE pattern matrix entry + + + + + Symbol for the TRUE pattern matrix entry + + + + + Symbol for the DONTCARE pattern matrix entry + + + + + Symbol for the P (dimension 0) pattern matrix entry + + + + + Symbol for the L (dimension 1) pattern matrix entry + + + + + Symbol for the A (dimension 2) pattern matrix entry + + + + + Converts the dimension value to a dimension symbol, + for example, True => 'T' + + Number that can be stored in the IntersectionMatrix. + Possible values are True, False, Dontcare, 0, 1, 2. + Character for use in the string representation of an IntersectionMatrix. + Possible values are T, F, * , 0, 1, 2. + + + + Converts the dimension symbol to a dimension value, + for example, '*' => Dontcare + + Character for use in the string representation of an IntersectionMatrix. + Possible values are T, F, * , 0, 1, 2. + Number that can be stored in the IntersectionMatrix. + Possible values are True, False, Dontcare, 0, 1, 2. + + + + Defines a rectangular region of the 2D coordinate plane. + + + It is often used to represent the bounding box of a Geometry, + e.g. the minimum and maximum x and y values of the Coordinates. + Note that Envelopes support infinite or half-infinite regions, by using the values of + Double.PositiveInfinity and Double.NegativeInfinity. + When Envelope objects are created or initialized, + the supplied extent values are automatically sorted into the correct order. + + + + + Test the point q to see whether it intersects the Envelope + defined by p1-p2. + + One extremal point of the envelope. + Another extremal point of the envelope. + Point to test for intersection. + true if q intersects the envelope p1-p2. + + + + Tests whether the envelope defined by p1-p2 + and the envelope defined by q1-q2 + intersect. + + One extremal point of the envelope Point. + Another extremal point of the envelope Point. + One extremal point of the envelope Q. + Another extremal point of the envelope Q. + true if Q intersects Point + + + + The minimum x-coordinate + + + + + The maximum x-coordinate + + + + + The minimum y-coordinate + + + + + The maximum y-coordinate + + + + + Creates a null Envelope. + + + + + Creates an Envelope for a region defined by maximum and minimum values. + + The first x-value. + The second x-value. + The first y-value. + The second y-value. + + + + Creates an Envelope for a region defined by two Coordinates. + + The first Coordinate. + The second Coordinate. + + + + Creates an Envelope for a region defined by a single Coordinate. + + The Coordinate. + + + + Creates an Envelope for a region defined by an enumeration of Coordinates. + + The Coordinates. + + + + Creates an Envelope for a region defined by a CoordinateSequences. + + The CoordinateSequence. + + + + Create an Envelope from an existing Envelope. + + The Envelope to initialize from. + + + + Initialize to a null Envelope. + + + + + Initialize an Envelope for a region defined by maximum and minimum values. + + The first x-value. + The second x-value. + The first y-value. + The second y-value. + + + + Initialize an Envelope for a region defined by two Coordinates. + + The first Coordinate. + The second Coordinate. + + + + Initialize an Envelope for a region defined by a single Coordinate. + + The Coordinate. + + + + Initialize an Envelope from an existing Envelope. + + The Envelope to initialize from. + + + + Makes this Envelope a "null" envelope.. + + + + + Returns true if this Envelope is a "null" envelope. + + + true if this Envelope is uninitialized + or is the envelope of the empty point. + + + + + Returns the difference between the maximum and minimum x values. + + max x - min x, or 0 if this is a null Envelope. + + + + Returns the difference between the maximum and minimum y values. + + max y - min y, or 0 if this is a null Envelope. + + + + Gets the length of the diameter (diagonal) of the envelope. + + The diameter length + + + + Returns the Envelopes minimum x-value. min x > max x + indicates that this is a null Envelope. + + The minimum x-coordinate. + + + + Returns the Envelopes maximum x-value. min x > max x + indicates that this is a null Envelope. + + The maximum x-coordinate. + + + + Returns the Envelopes minimum y-value. min y > max y + indicates that this is a null Envelope. + + The minimum y-coordinate. + + + + Returns the Envelopes maximum y-value. min y > max y + indicates that this is a null Envelope. + + The maximum y-coordinate. + + + + Gets the area of this envelope. + + The area of the envelope, or 0.0 if envelope is null + + + + Expands this envelope by a given distance in all directions. + Both positive and negative distances are supported. + + The distance to expand the envelope. + + + + Expands this envelope by a given distance in all directions. + Both positive and negative distances are supported. + + The distance to expand the envelope along the the X axis. + The distance to expand the envelope along the the Y axis. + + + + Gets the minimum extent of this envelope across both dimensions. + + + + + + Gets the maximum extent of this envelope across both dimensions. + + + + + + Enlarges this Envelope so that it contains + the given . + Has no effect if the point is already on or within the envelope. + + The Coordinate. + + + + Enlarges this Envelope so that it contains + the given . + + Has no effect if the point is already on or within the envelope. + The value to lower the minimum x to or to raise the maximum x to. + The value to lower the minimum y to or to raise the maximum y to. + + + + Enlarges this Envelope so that it contains + the other Envelope. + Has no effect if other is wholly on or + within the envelope. + + the Envelope to expand to include. + + + + Enlarges this Envelope so that it contains + the other Envelope. + Has no effect if other is wholly on or + within the envelope. + + the Envelope to expand to include. + + + + Translates this envelope by given amounts in the X and Y direction. + + The amount to translate along the X axis. + The amount to translate along the Y axis. + + + + Computes the coordinate of the centre of this envelope (as long as it is non-null). + + + The centre coordinate of this envelope, + or null if the envelope is null. + . + + + + Computes the intersection of two s. + + The envelope to intersect with + + A new Envelope representing the intersection of the envelopes (this will be + the null envelope if either argument is null, or they do not intersect + + + + + Check if the region defined by other + intersects the region of this Envelope. + + The Envelope which this Envelope is + being checked for intersecting. + + + true if the Envelopes intersect. + + + + + Check if the point p overlaps (lies inside) the region of this Envelope. + + the Coordinate to be tested. + true if the point overlaps this Envelope. + + + + Check if the point (x, y) overlaps (lies inside) the region of this Envelope. + + the x-ordinate of the point. + the y-ordinate of the point. + true if the point overlaps this Envelope. + + + + Tests if the extent defined by two extremal points + intersects the extent of this Envelope. + + A point + Another point + true if the extents intersect + + + + Tests if the region defined by other + is disjoint from the region of this Envelope. + + The Envelope being checked for disjointness + true if the Envelopes are disjoint + + + + + Tests if the Envelope other lies wholely inside this Envelope (inclusive of the boundary). + + + Note that this is not the same definition as the SFS contains, + which would exclude the envelope boundary. + + The Envelope to check + true if other is contained in this Envelope + + + + + Tests if the given point lies in or on the envelope. + + + Note that this is not the same definition as the SFS contains, + which would exclude the envelope boundary. + + the point which this Envelope is being checked for containing + true if the point lies in the interior or on the boundary of this Envelope. + + + + + Tests if the given point lies in or on the envelope. + + + Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary. + + the x-coordinate of the point which this Envelope is being checked for containing + the y-coordinate of the point which this Envelope is being checked for containing + + true if (x, y) lies in the interior or on the boundary of this Envelope. + + + + + + Tests if the given point lies in or on the envelope. + + the x-coordinate of the point which this Envelope is being checked for containing + the y-coordinate of the point which this Envelope is being checked for containing + true if (x, y) lies in the interior or on the boundary of this Envelope. + + + + Tests if the given point lies in or on the envelope. + + the point which this Envelope is being checked for containing + true if the point lies in the interior or on the boundary of this Envelope. + + + + Tests if the Envelope other lies wholely inside this Envelope (inclusive of the boundary). + + the Envelope to check + true if this Envelope covers the other + + + + Computes the distance between this and another + Envelope. + The distance between overlapping Envelopes is 0. Otherwise, the + distance is the Euclidean distance between the closest points. + + The distance between this and another Envelope. + + + + + + + + + + Compares two envelopes using lexicographic ordering. + The ordering comparison is based on the usual numerical + comparison between the sequence of ordinates. + Null envelopes are less than all non-null envelopes. + + An envelope + + + + Compares two envelopes using lexicographic ordering. + The ordering comparison is based on the usual numerical + comparison between the sequence of ordinates. + Null envelopes are less than all non-null envelopes. + + An envelope + + + + + + + Function to get a textual representation of this envelope + + A textual representation of this envelope + + + + Creates a deep copy of the current envelope. + + + + + + Method to parse an envelope from its value + + The envelope string + The envelope + + + + A representation of a planar, linear vector geometry. + + + +

Binary Predicates:

+ Because it is not clear at this time what semantics for spatial + analysis methods involving GeometryCollections would be useful, + GeometryCollections are not supported as arguments to binary + predicates or the Relate method. +
+ +

Overlay Methods:

+ The spatial analysis methods will + return the most specific class possible to represent the result. If the + result is homogeneous, a Point, LineString, or + Polygon will be returned if the result contains a single + element; otherwise, a MultiPoint, MultiLineString, + or MultiPolygon will be returned. If the result is + heterogeneous a GeometryCollection will be returned. +
+ + Representation of Computed Geometries: + The SFS states that the result + of a set-theoretic method is the "point-set" result of the usual + set-theoretic definition of the operation (SFS 3.2.21.1). However, there are + sometimes many ways of representing a point set as a Geometry. + The SFS does not specify an unambiguous representation of a given point set + returned from a spatial analysis method. One goal of NTS is to make this + specification precise and unambiguous. NTS uses a canonical form for + Geometrys returned from overlay methods. The canonical + form is a Geometry which is simple and noded: + Simple means that the Geometry returned will be simple according to + the NTS definition of IsSimple. + Noded applies only to overlays involving LineStrings. It + means that all intersection points on LineStrings will be + present as endpoints of LineStrings in the result. + This definition implies that non-simple geometries which are arguments to + spatial analysis methods must be subjected to a line-dissolve process to + ensure that the results are simple. + + + Constructed Points And The Precision Model: + The results computed by the set-theoretic methods may + contain constructed points which are not present in the input Geometrys. + These new points arise from intersections between line segments in the + edges of the input Geometrys. In the general case it is not + possible to represent constructed points exactly. This is due to the fact + that the coordinates of an intersection point may contain twice as many bits + of precision as the coordinates of the input line segments. In order to + represent these constructed points explicitly, NTS must truncate them to fit + the PrecisionModel. + Unfortunately, truncating coordinates moves them slightly. Line segments + which would not be coincident in the exact result may become coincident in + the truncated representation. This in turn leads to "topology collapses" -- + situations where a computed element has a lower dimension than it would in + the exact result. + When NTS detects topology collapses during the computation of spatial + analysis methods, it will throw an exception. If possible the exception will + report the location of the collapse. + + + +

Geometry Equality

+ There are two ways of comparing geometries for equality: + structural equality and topological equality. +

Structural Equality

+ Structural Equality is provided by the + method. + This implements a comparison based on exact, structural pointwise + equality. + The is a synonym for this method, + to provide structural equality semantics for + use in collections. + It is important to note that structural pointwise equality + is easily affected by things like + ring order and component order. In many situations + it will be desirable to normalize geometries before + comparing them (using the + or methods). + is provided + as a convenience method to compute equality over + normalized geometries, but it is expensive to use. + Finally, + allows using a tolerance value for point comparison. + +

Topological Equality

+ Topological Equality is provided by the + method. + It implements the SFS definition of point-set equality + defined in terms of the DE-9IM matrix. + To support the SFS naming convention, the method + is also provided as a synonym. + However, due to the potential for confusion with + its use is discouraged. +
+ + Since and are overridden, + Geometries can be used effectively in .Net collections. + +
+
+ + + An enumeration of sort values for geometries + + + NOTE:
+ For JTS v1.17 the values in this enum have been renamed to 'TYPECODE...' + In order not to break binary compatibility we did not follow. +
+
+ + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + + The name of point geometries + + + + + The name of multi-point geometries + + + + + The name of linestring geometries + + + + + The name of linearring geometries + + + + + The name of multi-linestring geometries + + + + + The name of polygon geometries + + + + + The name of multi-polygon geometries + + + + + The name of geometry collection geometries. + + + + + Gets the factory which contains the context in which this point was created. + + The factory for this point. + + + + Gets/Sets the user data object for this point, if any. + + + A simple scheme for applications to add their own custom data to a Geometry. + An example use might be to add an object representing a Coordinate Reference System. + Note that user data objects are not present in geometries created by + construction methods. + + + + + The bounding box of this Geometry. + + + + + Sets the ID of the Spatial Reference System used by the Geometry. + + + + NOTE: This method should only be used for exceptional circumstances or + for backwards compatibility. Normally the SRID should be set on the + used to create the geometry. + SRIDs set using this method will change the . + + + + + + + Creates a new Geometry via the specified GeometryFactory. + + The factory + + + + Returns the name of this Geometry's actual class. + + The name of this Geometrys actual class. + + + + Gets the OGC geometry type + + + + + Returns true if the array contains any non-empty Geometrys. + + an array of Geometrys; no elements may be null + + true if any of the Geometrys + IsEmpty methods return false. + + + + + Returns true if the array contains any null elements. + + an array to validate. + true if any of arrays elements are null. + + + + Returns true if the array contains any null elements. + + an array to validate. + true if any of arrays elements are null. + + + + Returns the PrecisionModel used by the Geometry. + + + the specification of the grid of allowable points, for this + Geometry and all other Geometrys. + + + + + Returns a vertex of this Geometry + (usually, but not necessarily, the first one). + + + The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation. + + a Coordinate which is a vertex of this Geometry. + null if this Geometry is empty. + + + + + Returns an array containing the values of all the vertices for + this geometry. + + + If the geometry is a composite, the array will contain all the vertices + for the components, in the order in which the components occur in the geometry. + + In general, the array cannot be assumed to be the actual internal + storage for the vertices. Thus modifying the array + may not modify the geometry itself. + Use the or + method + (possibly on the components) to modify the underlying data. + If the coordinates are modified, + must be called afterwards. + + + The vertices of this Geometry. + + + + + + + Gets an array of ordinate values + + The ordinate index + An array of ordinate values + + + + Returns the count of this Geometrys vertices. The Geometry + s contained by composite Geometrys must be + Geometry's; that is, they must implement NumPoints. + + The number of vertices in this Geometry. + + + + Returns the number of Geometryes in a GeometryCollection, + or 1, if the geometry is not a collection. + + + + + Returns an element Geometry from a GeometryCollection, + or this, if the geometry is not a collection. + + The index of the geometry element. + The n'th geometry contained in this geometry. + + + + Tests whether this is simple. + + The SFS definition of simplicity + follows the general rule that a Geometry is simple if it has no points of + self-tangency, self-intersection or other anomalous points. + + Simplicity is defined for each subclass as follows: + + Valid polygonal geometries are simple, since their rings + must not self-intersect. IsSimple + tests for this condition and reports false if it is not met. + (This is a looser test than checking for validity). + Linear rings have the same semantics. + Linear geometries are simple if they do not self-intersect at points + other than boundary points. + Zero-dimensional geometries (points) are simple if they have no + repeated points. + Empty Geometrys are always simple. + + + true if this Geometry is simple + + + + + Tests whether this Geometry is topologically + valid, according to the OGC SFS specification. + For validity rules see the documentation for the specific geometry subclass. + + true if this Geometry is valid. + + + + Tests whether the set of points covered in this Geometry is empty. + + Note this test is for topological emptiness, not structural emptiness.
+ A collection containing only empty elements is reported as empty.
+ To check structural emptiness use . +
+ true if this Geometry does not cover any points. +
+ + + Returns the minimum distance between this Geometry + and another Geometry g. + + The Geometry from which to compute the distance. + The distance between the geometries + 0 if either input geometry is empty + if g is null + + + + Tests whether the distance from this Geometry + to another is less than or equal to a specified value. + + the Geometry to check the distance to. + the distance value to compare. + true if the geometries are less than distance apart. + + + + Returns the area of this Geometry. + Areal Geometries have a non-zero area. + They override this function to compute the area. + Others return 0.0 + + The area of the Geometry. + + + + Returns the length of this Geometry. + Linear geometries return their length. + Areal geometries return their perimeter. + They override this function to compute the length. + Others return 0.0 + + The length of the Geometry. + + + + Computes the centroid of this Geometry. + The centroid + is equal to the centroid of the set of component Geometries of highest + dimension (since the lower-dimension geometries contribute zero + "weight" to the centroid). + + The centroid of an empty geometry is POINT EMPTY. + + A Point which is the centroid of this Geometry. + + + + Computes an interior point of this Geometry. + + + An interior point is guaranteed to lie in the interior of the Geometry, + if it possible to calculate such a point exactly. Otherwise, + the point may lie on the boundary of the point. + + The interior point of an empty geometry is POINT EMPTY. + + A Point which is in the interior of this Geometry. + + + + + + + + + Returns the dimension of this geometry. + + + The dimension of a geometry is is the topological + dimension of its embedding in the 2-D Euclidean plane. + In the NTS spatial model, dimension values are in the set {0,1,2}. + + Note that this is a different concept to the dimension of + the vertex s. + The geometry dimension can never be greater than the coordinate dimension. + For example, a 0-dimensional geometry (e.g. a Point) + may have a coordinate dimension of 3 (X,Y,Z). + + + + The topological dimensions of this geometry + + + + + Returns the boundary, or an empty geometry of appropriate dimension + if this Geometry is empty. + For a discussion of this function, see the OpenGIS Simple + Features Specification. As stated in SFS Section 2.1.13.1, "the boundary + of a Geometry is a set of Geometries of the next lower dimension." + + The closure of the combinatorial boundary of this Geometry. + + + + Returns the dimension of this Geometrys inherent boundary. + + + The dimension of the boundary of the class implementing this + interface, whether or not this object is the empty point. Returns + Dimension.False if the boundary is the empty point. + + + + + Gets a geometry representing the envelope (bounding box) of this Geometry. + + If this Geometry is + + empty, returns an empty Point + a point, returns a Point + a line parallel to an axis, a two-vertex LineString, + otherwise, returns a + Polygon whose vertices are (minx, miny), (maxx, miny), + (maxx, maxy), (minx, maxy), (minx, miny). + + + + A Geometry representing the envelope of this Geometry + + + + + + Gets an containing + the minimum and maximum x and y values in this Geometry. + If the geometry is empty, an empty Envelope + is returned. + + + The returned object is a copy of the one maintained internally, + to avoid aliasing issues. + For best performance, clients which access this + envelope frequently should cache the return value. + the envelope of this Geometry. + An empty Envelope if this Geometry is empty + + + + Notifies this geometry that its coordinates have been changed by an external + party (for example, via a ). + + + When this method is called the geometry will flush + and/or update any derived information it has cached (such as its ). + The operation is applied to all component Geometries. + + + + + Notifies this Geometry that its Coordinates have been changed by an external + party. When GeometryChanged is called, this method will be called for + this Geometry and its component Geometries. + + + + + Tests whether this geometry is disjoint from the argument geometry. + + + The Disjoint predicate has the following equivalent definitions: + + The DE-9IM intersection matrix for the two geometries matches FF*FF****. + !g.intersects(this) == true
(Disjoint is the inverse of Intersects)
+
+
+ The Geometry with which to compare this Geometry. + true if the two Geometrys are disjoint. + +
+ + + Tests whether this geometry touches the argument geometry + + + The Touches predicate has the following equivalent definitions: + + The geometries have at least one point in common, + but their interiors do not intersect + The DE-9IM Intersection Matrix for the two geometries matches + at least one of the following patterns + + FT*******, + F**T***** or + F***T****. + + + If both geometries have dimension 0, the predicate returns false, + since points have only interiors. + This predicate is symmetric. + + The Geometry with which to compare this Geometry. + + true if the two Geometrys touch; + Returns false if both Geometrys are points. + + + + + Tests whether this geometry intersects the argument geometry. + + + The Intersects predicate has the following equivalent definitions: + + The two geometries have at least one point in common + The DE-9IM Intersection Matrix for the two geometries matches
+ [T********] or
+ [*T*******] or
+ [***T*****] or
+ [****T****]
+ !g.disjoint(this)
+ (Intersects is the inverse of Disjoint)
+
+ The Geometry with which to compare this Geometry. + true if the two Geometrys intersect. + +
+ + + Tests whether this geometry crosses the specified geometry. + + + The Crosses predicate has the following equivalent definitions: + + The geometries have some but not all interior points in common. + The DE-9IM Intersection Matrix for the two geometries matches + one of the following patterns: + + CodeDescription + [T*T******]for P/L, P/A, and L/A situations + [T*****T**]for L/P, A/P, and A/L situations) + [0********]for L/L situations + + + + For the A/A and P/P situations this predicate returns false. + + The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. + To make the relation symmetric, + NTS extends the definition to apply to L/P, A/P and A/L situations as well. + + + The Geometry with which to compare this Geometry + true if the two Geometrys cross. + + + + Tests whether this geometry is within the specified geometry. + + + The within predicate has the following equivalent definitions: + + + Every point of this geometry is a point of the other geometry, + and the interiors of the two geometries have at least one point in common. + + The DE-9IM Intersection Matrix for the two geometries matches [T*F**F***] + g.contains(this) == true
(Within is the converse of )
+
+ + An implication of the definition is that "The boundary of a geometry is not within the Polygon". + In other words, if a geometry A is a subset of the points in the boundary of a geometry B, A.within(B) == false + (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) + For a predicate with similar behaviour but avoiding + this subtle limitation, see . + +
+ The Geometry with which to compare this Geometry. + true if this Geometry is within other. + + +
+ + + Tests whether this geometry contains the argument geometry. + + + The Contains predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry, + and the interiors of the two geometries have at least one point in common. + The DE-9IM Intersection Matrix for the two geometries matches the pattern + [T*****FF*] + g.within(this)
+ (Contains is the converse of )
+
+ + An implication of the definition is that "Geometries do not + contain their boundary". In other words, if a geometry A is a subset of + the points in the boundary of a geometry B, B.Contains(A) == false. + (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) + For a predicate with similar behaviour but avoiding + this subtle limitation, see . + +
+ the Geometry with which to compare this Geometry + true if this Geometry contains g + + +
+ + + Tests whether this geometry overlaps the specified geometry. + + + The Overlaps predicate has the following equivalent definitions: + + The geometries have at least one point each not shared by the other (or equivalently neither covers the other), + they have the same dimension, + and the intersection of the interiors of the two geometries has + the same dimension as the geometries themselves. + The DE-9IM Intersection Matrix for the two geometries matches + [T*T***T**] (for two points or two surfaces) + or [1*T***T**] (for two curves) + + If the geometries are of different dimension this predicate returns false. + + The Geometry with which to compare this Geometry. + + true if the two Geometrys overlap. + For this function to return true, the Geometry + s must be two points, two curves or two surfaces. + + + + + Tests whether this geometry covers the argument geometry + + + The covers predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry. + The DE-9IM Intersection Matrix for the two geometries matches at least + one of the following patterns: + + [T*****FF*] or
+ [*T****FF*] or
+ [***T**FF*] or
+ [****T*FF*] +
+
+ g.CoveredBy(this) == true
+ (covers is the converse of )
+
+ If either geometry is empty, the value of this predicate is false. + + This predicate is similar to , + but is more inclusive (i.e. returns true for more cases). + In particular, unlike Contains it does not distinguish between + points in the boundary and in the interior of geometries. + For most situations, Covers should be used in preference to Contains. + As an added benefit, Covers is more amenable to optimization, + and hence should be more performant. + +
+ The Geometry with which to compare this Geometry + true if this Geometry covers + + +
+ + Tests whether this geometry is covered by the specified geometry. + + The CoveredBy predicate has the following equivalent definitions: + + Every point of this geometry is a point of the other geometry. + The DE-9IM Intersection Matrix for the two geometries matches + at least one of the following patterns: + + [T*F**F***] + [*TF**F***] + [**FT*F***] + [**F*TF***] + g.Covers(this) == true
+ (CoveredBy is the converse of ) +
+
+ If either geometry is empty, the value of this predicate is false. + + This predicate is similar to , + but is more inclusive (i.e. returns true for more cases). + +
+ the Geometry with which to compare this Geometry + true if this Geometry is covered by g + + +
+ + + Tests whether the elements in the DE-9IM + for the two Geometrys match the elements in intersectionPattern. + + + The pattern is a 9-character string, with symbols drawn from the following set: + + 0(dimension 0) + 1(dimension 1) + 2(dimension 2) + T( matches 0, 1 or 2) + F( matches FALSE) + *( matches any value) + + For more information on the DE-9IM, see the OpenGIS Simple Features + Specification. + + the Geometry with which to compare this Geometry + the pattern against which to check the + intersection matrix for the two Geometrys + true if the DE-9IM intersection + matrix for the two Geometrys match intersectionPattern + + + + + Returns the DE-9IM intersection matrix for the two Geometrys. + + The Geometry with which to compare this Geometry + + A matrix describing the intersections of the interiors, + boundaries and exteriors of the two Geometrys. + + + + + Tests whether this geometry is + topologically equal to the argument geometry. + + This method is included for backward compatibility reasons. + It has been superseded by the method, + which has been named to clearly denote its functionality. + + This method should NOT be confused with the method + , which implements + an exact equality comparison. + + The Geometry with which to compare this Geometry + true if the two Geometrys are topologically equal. + + + + + Tests whether this geometry is topologically equal to the argument geometry + as defined by the SFS Equals predicate. + + + The SFS equals predicate has the following equivalent definitions: + + The two geometries have at least one point in common, + and no point of either geometry lies in the exterior of the other geometry. + The DE-9IM Intersection Matrix for the two geometries matches + the pattern T*F**FFF* +
+            T*F
+            **F
+            FF*
+            
+
+ Note that this method computes topologically equality. + For structural equality, see {@link #equalsExact(Geometry)}. +
+ the Geometry with which to compare this Geometry + true if the two Geometrys are topologically equal +
+ + + Tests whether this geometry is structurally and numerically equal + to a given Object. + + + If the argument Object is not a Geometry, + the result is false. + Otherwise, the result is computed using + . + + This method is provided to fulfill the Java contract + for value-based object equality. + In conjunction with + it provides semantics which are most useful + for using + Geometrys as keys and values in Java collections. + + Note that to produce the expected result the input geometries + should be in normal form. It is the caller's + responsibility to perform this where required + (using + or as appropriate). + + The object to compare + true if this geometry is exactly equal to the argument + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets a hash code for the Geometry. + + + An integer value suitable for use as a hashcode + + + + + Returns the Well-known Text representation of this Geometry. + For a definition of the Well-known Text format, see the OpenGIS Simple + Features Specification. + + + The Well-known Text representation of this Geometry. + + + + + Returns the Well-known Text representation of this Geometry. + For a definition of the Well-known Text format, see the OpenGIS Simple + Features Specification. + + + The Well-known Text representation of this Geometry. + + + + + + + + + + + Returns the Well-known Binary representation of this Geometry. + For a definition of the Well-known Binary format, see the OpenGIS Simple + Features Specification. + + The Well-known Binary representation of this Geometry. + + + + + + + + + + Returns the feature representation as GML 2.1.1 XML document. + This XML document is based on Geometry.xsd schema. + NO features or XLink are implemented here! + + + + + Computes a buffer area around this geometry having the given width. The + buffer of a Geometry is the Minkowski sum or difference of the geometry + with a disc of radius Abs(distance). + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The buffer geometry is constructed using 8 segments per quadrant to approximate + the circular arcs. + The end cap style is EndCapStyle.Round. + + The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + + + + The width of the buffer (may be positive, negative or 0), interpreted according to the + PrecisionModel of the Geometry. + + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + + + + + Computes a buffer region around this Geometry having the given width. + The buffer of a Geometry is the Minkowski sum or difference of the geometry + with a disc of radius Abs(distance). + + + The end cap style specifies the buffer geometry that will be + created at the ends of linestrings. The styles provided are: +
    +
  • - (default) a semi-circle
  • +
  • - a straight line perpendicular to the end segment
  • +
  • - a half-square
  • +
+ The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . +
+ + The width of the buffer, interpreted according to the + PrecisionModel of the Geometry. + + Cap Style to use for compute buffer. + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + +
+ + + Computes a buffer region around this Geometry having the given + width and with a specified accuracy of approximation for circular arcs. + The buffer of a Geometry is the Minkowski sum of the Geometry with + a disc of radius distance. Curves in the buffer polygon are + approximated with line segments. This method allows specifying the + accuracy of that approximation. + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The quadrantSegments argument allows controlling the accuracy of + the approximation by specifying the number of line segments used to + represent a quadrant of a circle + The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + + + + The width of the buffer (may be positive, negative or 0), interpreted according to the + PrecisionModel of the Geometry. + + The number of segments to use to approximate a quadrant of a circle. + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + + + + + Computes a buffer region around this Geometry having the given + width and with a specified number of segments used to approximate curves. + The buffer of a Geometry is the Minkowski sum of the Geometry with + a disc of radius distance. Curves in the buffer polygon are + approximated with line segments. This method allows specifying the + accuracy of that approximation. + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The quadrantSegments argument allows controlling the accuracy of + the approximation by specifying the number of line segments used to + represent a quadrant of a circle + The end cap style specifies the buffer geometry that will be + created at the ends of linestrings. The styles provided are: +
    +
  • - (default) a semi-circle
  • +
  • - a straight line perpendicular to the end segment
  • +
  • - a half-square
  • +
+ The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + +
+ + The width of the buffer, interpreted according to the + PrecisionModel of the Geometry. + + The number of segments to use to approximate a quadrant of a circle. + Cap Style to use for compute buffer. + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + +
+ + + Computes a buffer region around this Geometry having the given + width and with a specified number of segments used to approximate curves. + The buffer of a Geometry is the Minkowski sum of the Geometry with + a disc of radius distance. Curves in the buffer polygon are + approximated with line segments. This method allows specifying the + accuracy of that approximation. + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The bufferParameters argument has a property QuadrantSegments controlling the accuracy of + the approximation by specifying the number of line segments used to + represent a quadrant of a circle + The EndCapStyle property of the bufferParameters argument specifies the buffer geometry that will be + created at the ends of linestrings. The styles provided are: +
    +
  • - (default) a semi-circle
  • +
  • - a straight line perpendicular to the end segment
  • +
  • - a half-square
  • +
+ The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + +
+ + The width of the buffer, interpreted according to the + PrecisionModel of the Geometry. + + This argument type has a number of properties that control the construction of the + buffer, including QuadrantSegments, EndCapStyle, JoinStyle, and MitreLimit + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + +
+ + + Returns the smallest convex Polygon that contains all the + points in the Geometry. This obviously applies only to Geometry + s which contain 3 or more points. + + the minimum-area convex polygon containing this Geometry's points. + + + + Computes a new geometry which has all component coordinate sequences + in reverse order (opposite orientation) to this one. + + A reversed geometry + Don't override this function, implement . + + + + The actual implementation of the function + + A reversed geometry + In JTS this function is abstract, but that would break binary compatibility of current version. + + + + Computes a Geometry representing the point-set which is + common to both this Geometry and the other Geometry. + + The intersection of two geometries of different dimension produces a result + geometry of dimension less than or equal to the minimum dimension of the input + geometries. + The result geometry may be a heterogeneous . + If the result is empty, it is an atomic geometry + with the dimension of the lowest input dimension. + + Intersection of s is supported + only for homogeneous collection types. + + Non-empty heterogeneous arguments are not supported. + + The Geometry with which to compute the intersection. + A geometry representing the point-set common to the two Geometrys. + if a robustness error occurs. + if the argument is a non-empty heterogeneous GeometryCollection + if the argument has a factory with a different GeometryOverlay object assigned + + + + Computes a Geometry representing the point-set + which is contained in both this + Geometry and the other Geometry. + + + The method may be used on arguments of different dimension, but it does not + support arguments. + + The union of two geometries of different dimension produces a result + geometry of dimension equal to the maximum dimension of the input + geometries. + The result geometry may be a heterogeneous + . + If the result is empty, it is an atomic geometry + with the dimension of the highest input dimension. + + Unioning s has the effect of + noding and dissolving the input linework. In this context + "noding" means that there will be a node or endpoint in the result for + every endpoint or line segment crossing in the input. "Dissolving" means + that any duplicate (i.e. coincident) line segments or portions of line + segments will be reduced to a single line segment in the result. + If merged linework is required, the + class can be used. + + Non-empty arguments are not supported. + the Geometry with which to compute the union + A point-set combining the points of this Geometry and the + points of other + Thrown if a robustness error occurs + Thrown if either input is a non-empty GeometryCollection + if the argument has a factory with a different GeometryOverlay object assigned + + + + + Computes a Geometry representing the closure of the point-set + of the points contained in this Geometry that are not contained in + the other Geometry. + + If the result is empty, it is an atomic geometry + with the dimension of the left-hand input. + + Non-empty arguments are not supported. + + The Geometry with which to compute the difference. + A Geometry representing the point-set difference of this Geometry with other. + if the argument has a factory with a different GeometryOverlay object assigned + + + + Computes a Geometry representing the closure of the point-set + which is the union of the points in this Geometry which are not + contained in the other Geometry, + with the points in the other Geometry not contained in this + Geometry. + If the result is empty, it is an atomic geometry + with the dimension of the highest input dimension. + + Non-empty arguments are not supported. + + The Geometry with which to compute the symmetric difference. + a Geometry representing the point-set symmetric difference of this Geometry with other. + if the argument has a factory with a different GeometryOverlay object assigned + + + + Computes the union of all the elements of this geometry. + + + This method supports s (which the other overlay operations currently do not). + + The result obeys the following contract: + + Unioning a set of s has the effect of fully noding and dissolving the linework. + Unioning a set of s always returns a geometry + (unlike ), which may return geometries of lower dimension if a topology + collapse occurred). + + + Thrown if a robustness error occurs + + + + Returns true if the two Geometrys are exactly equal, + up to a specified tolerance. + Two Geometries are exactly within a tolerance equal if: + + they have the same class, + they have the same values of Coordinates, + within the given tolerance distance, in their internal + Coordinate lists, in exactly the same order. + + This method does not + test the values of the GeometryFactory, the SRID, + or the UserData fields. + + To properly test equality between different geometries, + it is usually necessary to them first. + + The Geometry with which to compare this Geometry + have identical structure and point values, up to the distance tolerance. + Distance at or below which two Coordinates will be considered equal. + + true if this and the other Geometry + are of the same class and have equal internal data. + + + + + + + + Returns true if the two Geometrys are exactly equal. + Two Geometries are exactly equal if: + + they have the same class, + they have the same values of Coordinates in their internal + Coordinate lists, in exactly the same order. + + This provides a stricter test of equality than + , which is more useful + in certain situations + (such as using geometries as keys in collections). + + This method does not + test the values of the GeometryFactory, the SRID, + or the UserData fields. + + To properly test equality between different geometries, + it is usually necessary to them first. + + The Geometry with which to compare this Geometry. + + true if this and the other Geometry have identical structure and point values. + + + + + Tests whether two geometries are exactly equal + in their normalized forms. + + This is a convenience method which creates normalized + versions of both geometries before computing + . + This method is relatively expensive to compute. + For maximum performance, the client + should instead perform normalization on the individual geometries + at an appropriate point during processing. + + + A geometry + true if the input geometries are exactly equal in their normalized form + + + + + Performs an operation with or on this Geometry's coordinates. + + + If this method modifies any coordinate values, + must be called to update the geometry state. + Note that you cannot use this method to + modify this Geometry if its underlying CoordinateSequence's #get method + returns a copy of the Coordinate, rather than the actual Coordinate stored + (if it even stores Coordinate objects at all). + + The filter to apply to this Geometry's coordinates + + + + Performs an operation on the coordinates in this Geometry's s. + + + If the filter reports that a coordinate value has been changed, + will be called automatically. + + The filter to apply + + + + Performs an operation on this Geometry's s. + + + If the filter reports that a coordinate value has been changed, + will be called automatically. + + The filter to apply + + + + Performs an operation with or on this Geometry and its + subelement Geometrys (if any). + Only GeometryCollections and subclasses + have subelement Geometry's. + + + The filter to apply to this Geometry (and + its children, if it is a GeometryCollection). + + + + + Performs an operation with or on this Geometry and its + component Geometry's. Only GeometryCollections and + Polygons have component Geometry's; for Polygons they are the LinearRings + of the shell and holes. + + The filter to apply to this Geometry. + + + + Creates a deep copy of this object. + Coordinate sequences contained in it are copied. + All instance fields are copied + (i.e. the SRID, EnvelopeInternal and UserData). + + + NOTE: The UserData object reference (if present) is copied, + but the value itself is not copied. + If a deep copy is required this must be performed by the caller. + + A deep copy of this geometry + + + + An internal method to copy subclass-specific geometry data. + + A copy of the target geometry object. + + + + Converts this Geometry to normal form (or canonical form ). + + + + Normal form is a unique representation for Geometrys. + It can be used to test whether two Geometrys are equal + in a way that is independent of the ordering of the coordinates within + them. Normal form equality is a stronger condition than topological + equality, but weaker than pointwise equality. + + The definitions for normal + form use the standard lexicographical ordering for coordinates. "Sorted in + order of coordinates" means the obvious extension of this ordering to + sequences of coordinates. + + + NOTE that this method mutates the value of this geometry in-place. + If this is not safe and/or wanted, the geometry should be + cloned prior to normalization. + + + + + + Creates a new Geometry which is a normalized copy of this Geometry. + + A normalized copy of this geometry. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry. + + If their classes are different, they are compared using the following + ordering: + + Point (lowest), + MultiPoint, + LineString, + LinearRing, + MultiLineString, + Polygon, + MultiPolygon, + GeometryCollection (highest). + + If the two Geometrys have the same class, their first + elements are compared. If those are the same, the second elements are + compared, etc. + + A Geometry with which to compare this Geometry + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry. + + If their classes are different, they are compared using the following + ordering: + + Point (lowest), + MultiPoint, + LineString, + LinearRing, + MultiLineString, + Polygon, + MultiPolygon, + GeometryCollection (highest). + /// + If the two Geometrys have the same class, their first + elements are compared. If those are the same, the second elements are + compared, etc. + + A Geometry with which to compare this Geometry + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry, using the given . + + If their classes are different, they are compared using the following + ordering: + + Point (lowest), + MultiPoint, + LineString, + LinearRing, + MultiLineString, + Polygon, + MultiPolygon, + GeometryCollection (highest). + + If the two Geometrys have the same class, their first + elements are compared. If those are the same, the second elements are + compared, etc. + + A Geometry with which to compare this Geometry + A IComparer<CoordinateSequence> + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether the two Geometrys are equal, from the point + of view of the EqualsExact method. Called by EqualsExact + . In general, two Geometry classes are considered to be + "equivalent" only if they are the same class. An exception is LineString + , which is considered to be equivalent to its subclasses. + + The Geometry with which to compare this Geometry for equality. + + true if the classes of the two Geometry + s are considered to be equal by the equalsExact method. + + + + + Throws an exception if g's type is a GeometryCollection. + (Its subclasses do not trigger an exception). + + The Geometry to check. + + if g is a GeometryCollection, but not one of its subclasses. + + + + + Tests whether this is an instance of a general {@link GeometryCollection}, + rather than a homogeneous subclass. + + true if this is a heterogeneous GeometryCollection + + + + Returns the minimum and maximum x and y values in this Geometry, + or a null Envelope if this Geometry is empty. + Unlike EnvelopeInternal, this method calculates the Envelope + each time it is called; EnvelopeInternal caches the result + of this method. + + + This Geometrys bounding box; if the Geometry + is empty, Envelope.IsNull will return true. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry having the same class. + + A Geometry having the same class as this Geometry. + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry of the same class. + using the given . + + A Geometry having the same class as this Geometry + The comparer + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the JTS Technical + Specifications + + + + + Returns the first non-zero result of CompareTo encountered as + the two Collections are iterated over. If, by the time one of + the iterations is complete, no non-zero result has been encountered, + returns 0 if the other iteration is also complete. If b + completes before a, a positive number is returned; if a + before b, a negative number. + + A Collection of IComparables. + A Collection of IComparables. + The first non-zero compareTo result, if any; otherwise, zero. + + + + + + + + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + Tests whether this is a rectangular . + + true if the geometry is a rectangle. + Polygon overrides to check for actual rectangle. + + + + A predefined with == . + + + + + + + Basic implementation of GeometryCollection. + + + + + Represents an empty GeometryCollection. + + + + + Internal representation of this GeometryCollection. + + + + + + + + The Geometrys for this GeometryCollection, + or null or an empty array to create the empty + point. Elements may be empty Geometrys, + but not nulls. + + + For create this is used a standard + with == . + + + + + + + + The Geometrys for this GeometryCollection, + or null or an empty array to create the empty + point. Elements may be empty Geometrys, + but not nulls. + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + Collects all coordinates of all subgeometries into an Array. + Note that while changes to the coordinate objects themselves + may modify the Geometries in place, the returned Array as such + is only a temporary container which is not synchronized back. + + The collected coordinates. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the name of this object's interface. + + "GeometryCollection" + + + + Gets the OGC geometry type + + + + + + + + + + Returns the area of this GeometryCollection. + + + + + Returns the length of this GeometryCollection. + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + Return true if all features in collection are of the same type. + + + + + + + + Returns the iTh element in the collection. + + + + + + + Creates a with + every component reversed. + The order of the components in the collection are not reversed. + + A in the reverse order + + + + The actual implementation of the function for GeometryCollections. + + A reversed geometry + + + + Returns the number of geometries contained by this . + + + + + Iterates over all Geometry's in a GeometryCollection. + Implements a pre-order depth-first traversal of the GeometryCollection + (which may be nested). The original GeometryCollection is + returned as well (as the first object), as are all sub-collections. It is + simple to ignore the GeometryCollection objects if they are not + needed. + + + + + The GeometryCollection being iterated over. + + + + + Indicates whether or not the first element (the GeometryCollection) + has been returned. + + + + + The number of Geometrys in the the GeometryCollection. + + + + + The index of the Geometry that will be returned when next + is called. + + + + + The iterator over a nested GeometryCollection, or null + if this GeometryCollectionIterator is not currently iterating + over a nested GeometryCollection. + + + + + Constructs an iterator over the given GeometryCollection. + + + The collection over which to iterate; also, the first + element returned by the iterator. + + + + > + + + > + The parent GeometryCollection is the first object returned! + + + + + + + + + + + + + + + + + + + Delegate function declaration to handle filter operation + + The geometry to filter + + + + An implementation that applies filtering with the provided + + + + + Creates an instance of this class + + The filter method to be used + + + + Supplies a set of utility methods for building Geometry objects + from lists of Coordinates. + + + Note that the factory constructor methods do not change the input coordinates in any way. + In particular, they are not rounded to the supplied PrecisionModel. + It is assumed that input Coordinates meet the given precision. + + Instances of this class are thread-safe. + + + + + A predefined with c + == . + + + + + A predefined with + == . + + A shortcut for . + + + + A predefined with + == . + + + + + A predefined with + == . + + + + + Returns the PrecisionModel that Geometries created by this factory + will be associated with. + + + + + + + + + + The SRID value defined for this factory. + + + + + Gets a value indicating the geometry overlay function set to use + + A geometry overlay function set. + + + + Gets a value indicating the geometry overlay function set to use + + A geometry overlay function set. + + + + Gets a value indicating the object that created this factory. + + + + + + + + + + + + + Constructs a GeometryFactory that generates Geometries having the given + precision model, spatial-reference ID, + CoordinateSequence and + NtsGeometryServices. + + A precision model + A spatial reference id + A coordinate sequence factory + NtsGeometryServices object creating this factory + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. + + + + + Constructs a GeometryFactory that generates Geometries having the given + CoordinateSequence implementation, a double-precision floating PrecisionModel and a + spatial-reference ID of 0. + + + + + Constructs a GeometryFactory that generates Geometries having the given + {PrecisionModel} and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel and spatial-reference ID, and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + The SRID to use. + + + + Constructs a GeometryFactory that generates Geometries having a floating + PrecisionModel and a spatial-reference ID of 0. + + + + + Converts the IEnumerable to an array. + + The IEnumerable of Points to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of Geometry's to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of LineStrings to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of LinearRings to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of Polygons to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of MultiPoints to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of MultiLineStrings to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of MultiPolygons to convert. + The IEnumerable in array format. + + + + Creates a with the same extent as the given envelope. + + + + The Geometry returned is guaranteed to be valid. + To provide this behavior, the following cases occur: + + + If the Envelope is: +
    +
  • null returns an empty
  • +
  • a point returns a non-empty
  • +
  • a line returns a two-point
  • +
  • a rectangle returns a whose points are (minx, maxy), (minx, maxy), (maxx, maxy), (maxx, miny).
  • +
+
+
+ The Envelope + + An empty Point (for null Envelopes), a Point (when min x = max x and min y = max y) or a Polygon (in all other cases) + +
+ + + Creates an empty Point + + + An empty Point + + + + + Creates a Point using the given Coordinate. + A null coordinate creates an empty Geometry. + + a Coordinate, or null + A object + + + + Creates a Point using the given CoordinateSequence; a null or empty + CoordinateSequence will create an empty Point. + + a CoordinateSequence (possibly empty), or null + A object + + + + Creates an empty LineString + + An empty LineString + + + + Creates a LineString using the given Coordinates. + A null or empty array creates an empty LineString. + + An array without null elements, or an empty array, or null. + A object + + + + Creates a LineString using the given CoordinateSequence. + A null or empty CoordinateSequence creates an empty LineString. + + A CoordinateSequence (possibly empty), or null. + A object + + + Creates an empty LinearRing + An empty LinearRing + + + + Creates a LinearRing using the given Coordinates; a null or empty array + creates an empty LinearRing. The points must form a closed and simple + linestring. Consecutive points must not be equal. + + An array without null elements, or an empty array, or null. + A object + If the ring is not closed, or has too few points + + + + Creates a LinearRing using the given CoordinateSequence; a null or empty CoordinateSequence + creates an empty LinearRing. The points must form a closed and simple + linestring. Consecutive points must not be equal. + + A CoordinateSequence (possibly empty), or null. + A object + If the ring is not closed, or has too few points + + + Creates an empty Polygon + An empty Polygon + + + + Constructs a Polygon with the given exterior boundary and + interior boundaries. + + + The outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty point is to be created. + + + The inner boundaries of the new Polygon, or + null or empty LinearRing s if + the empty point is to be created. + + A object + + + + Constructs a Polygon with the given exterior boundary. + + the outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty geometry is to be created. + A object + If the boundary ring is invalid + + + + Constructs a Polygon with the given exterior boundary. + + the outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty geometry is to be created. + A object + If the boundary ring is invalid + + + + Constructs a Polygon with the given exterior boundary. + + the outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty geometry is to be created. + the created Polygon + If the boundary ring is invalid + + + Creates an empty MultiPoint + An empty MultiPoint + + + + Creates a using the given Points. + A null or empty array will create an empty MultiPoint. + + An array (without null elements), or an empty array, or null. + A object + + + + Creates a using the given Coordinates. + A null or empty array will create an empty MultiPoint. + + An array (without null elements), or an empty array, or null + A object + + + + Creates a using the given CoordinateSequence. + A null or empty CoordinateSequence will create an empty MultiPoint. + + A CoordinateSequence (possibly empty), or null. + A object + + + Creates an empty MultiLineString + An empty MultiLineString + + + + Creates a MultiLineString using the given LineStrings; a null or empty + array will create an empty MultiLineString. + + LineStrings, each of which may be empty but not null- + A object + + + Creates an empty MultiPolygon + An empty MultiPolygon + + + + Creates a MultiPolygon using the given Polygons; a null or empty array + will create an empty Polygon. The polygons must conform to the + assertions specified in the OpenGIS Simple Features + Specification for SQL. + + Polygons, each of which may be empty but not null. + A object + + + Creates an empty GeometryCollection + An empty GeometryCollection + + + + Creates a GeometryCollection using the given Geometries; a null or empty + array will create an empty GeometryCollection. + + an array of Geometries, each of which may be empty but not null, or null + A object + + + + Build an appropriate Geometry, MultiGeometry, or + GeometryCollection to contain the Geometrys in + it. + + + If geomList contains a single Polygon, + the Polygon is returned.
+ If geomList contains several Polygons, a + MultiPolygon is returned.
+ If geomList contains some Polygons and + some LineStrings, a GeometryCollection is + returned.
+ If geomList is empty, an empty GeometryCollection + is returned. + Note that this method does not "flatten" Geometries in the input, and hence if + any MultiGeometries are contained in the input a GeometryCollection containing + them will be returned. +
+ The Geometry to combine. + + A of the "smallest", "most type-specific" + class that can contain the elements of geomList. + +
+ + + Creates an empty atomic geometry of the given dimension. + If passed a dimension of + will create an empty . + + The required dimension (, , or ) + An empty atomic geometry of given dimension + + + + Creates a deep copy of the input . + The defined for this factory + is used to copy the s + of the input geometry. + + This is a convenient way to change the CoordinateSequence + used to represent a geometry, or to change the + factory used for a geometry. + + can also be used to make a deep copy, + but it does not allow changing the CoordinateSequence type. + + The geometry + A deep copy of the input geometry, using the CoordinateSequence type of this factory + + + + + Returns a new whose is + the given value and whose other values and behavior are, as near as we possibly can make + it, the same as our own. + + + The for the result. + + + The cloned instance. + + + + + + + + An extended that is capable of enforcing a ring orientation for polygons. + + + + + Gets or sets the default polygon shell ring orientation that is used when nothing else has been set. + + + + + Gets or sets the default precision model to use with these geometry factories + + + + + Gets or sets the default coordinate sequence factory to use with these geometry factories + + + + + Gets or sets the default spatial reference id. + + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. + + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. + + + + + Constructs a GeometryFactory that generates Geometries having the given + CoordinateSequence implementation, a double-precision floating PrecisionModel and a + spatial-reference ID of 0. + + + + + Constructs a GeometryFactory that generates Geometries having the given + {PrecisionModel} and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel and spatial-reference ID, and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + The SRID to use. + + + + Constructs a GeometryFactory that generates Geometries having a floating + PrecisionModel and a spatial-reference ID of 0. + + + + + The polygon shell ring orientation enforced by this factory + + + + + Gets or sets a value indicating the ring orientation of the + Polygon's exterior rings. + If its value is , this + factory behaves just like the base . + + + + The setter of this property has to be used prior to any call + to CreatePolygon, CreateMultiPolygon, or + ReplaceSRID + + + + + + + + + Gets a value indicating the ring orientation for the interior rings + + + This value is always opposite of , + except when its value is . + + + + + Constructs a Polygon with the given exterior boundary and + interior boundaries. + + The is enforced on the constructed polygon. + + + The outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty point is to be created. + + + The inner boundaries of the new Polygon, or + null or empty LinearRing s if + the empty point is to be created. + + A object + + + + Creates a MultiPolygon using the given Polygons; a null or empty array + will create an empty Polygon. The polygons must conform to the + assertions specified in the OpenGIS Simple Features + Specification for SQL. + The is enforced on each polygon. + + Polygons, each of which may be empty but not null. + A object + + + + + + + Utility function to enforce a specific ring orientation on a linear ring + + The ring + The required orientation + A ring + + + + A class that encapsulates geometry overlay functionality + + + + + Gets a value indicating a geometry overlay operation class that uses old NTS overlay operation set. + + + + + Gets a value indicating a geometry overlay operation class that uses next-generation NTS overlay operation set. + + + + + Computes a Geometry representing the overlay of geometries a and b + using the spatial function defined by opCode. + + The 1st geometry + The 2nd geometry + The spatial function for the overlay operation + The computed geometry + + + + Computes a Geometry representing the point-set which is + common to both a and b Geometry. + + The 1st Geometry + The 2nd Geometry + A geometry representing the point-set common to the two Geometrys. + + + + + Computes a Geometry representing the point-set + which is contained in both input Geometrys . + + The 1st Geometry + The 2nd Geometry + A point-set combining the points of + Geometry's a and b. + + + + + + Computes a Geometry representing the closure of the point-set + of the points contained in this Geometry that are not contained in + the other Geometry. + + The 1st Geometry + The 2nd Geometry + + A Geometry representing the point-set difference + of Geometry's a and b. + + + + + + Computes a Geometry representing the closure of the point-set + which is the union of the points in Geometry a which are not + contained in the Geometry b, + with the points in the b Geometry not contained in the Geometry a. + + The 1st Geometry + The 2nd Geometry + + A Geometry representing the point-set symmetric difference + of Geometry's a and b. + + + + + + Computes the union of all the elements in the Geometry a. + + The Geometry + The union of a + + + + + A spatial object in an AbstractSTRtree. + + + + + Returns a representation of space that encloses this Boundable, preferably + not much bigger than this Boundable's boundary yet fast to test for intersection + with the bounds of other Boundables. The class of object returned depends + on the subclass of AbstractSTRtree. + + + An Envelope (for STRtrees), an Interval (for SIRtrees), or other object + (for other subclasses of AbstractSTRtree). + + + + + Gets the item that is bounded + + + + + An interface for classes which use the values of the coordinates in a . + Coordinate filters can be used to implement centroid and + envelope computation, and many other functions. + + ICoordinateFilter is + an example of the Gang-of-Four Visitor pattern. + + Note: it is not recommended to use these filters to mutate the coordinates. + There is no guarantee that the coordinate is the actual object stored in the source geometry. + In particular, modified values may not be preserved if the source Geometry uses a non-default . + If in-place mutation is required, use . + + + + + + + Performs an operation with the provided coord. + Note that there is no guarantee that the input coordinate + is the actual object stored in the source geometry, + so changes to the coordinate object may not be persistent. + + A Coordinate to which the filter is applied. + + + + An interface for classes which process the coordinates in a . + A filter can either record information about each coordinate, + or change the value of the coordinate. + Filters can be + used to implement operations such as coordinate transformations, centroid and + envelope computation, and many other functions. + classes support the concept of applying a + CoordinateSequenceFilter to each + s they contain. + + For maximum efficiency, the execution of filters can be short-circuited by using the property. + + + + CoordinateSequenceFilter is an example of the Gang-of-Four Visitor pattern. + Note: In general, it is preferable to treat Geometrys as immutable. + Mutation should be performed by creating a new Geometry object (see + and for convenient ways to do this). + An exception to this rule is when a new Geometry has been created via . + In this case mutating the Geometry will not cause aliasing issues, + and a filter is a convenient way to implement coordinate transformation. + + + Martin Davis + + + + + + + Performs an operation on a coordinate in a . + + the CoordinateSequence to which the filter is applied + i the index of the coordinate to apply the filter to + + + + Reports whether the application of this filter can be terminated. + + + Once this method returns true, it must + continue to return true on every subsequent call. + + + + + Reports whether the execution of this filter has modified the coordinates of the geometry. + If so, will be executed + after this filter has finished being executed. + + Most filters can simply return a constant value reflecting whether they are able to change the coordinates. + + + + A variant of , except it receives each + just once, instead of once for each of its coordinates. + + + + + Reports whether the application of this filter can be terminated. + + + Once this method returns it must continue to return + on every subsequent call. + + + + + Reports whether the execution of this filter has modified the coordinates of the geometry. + If so, will be executed + after this filter has finished being executed. + + + Most filters can simply return a constant value reflecting whether they are able to + change the coordinates. + + + + + Performs an operation on a . + + + The . + + + + + Interface describing objects that can expand themselves by objects of type . + + The type of objects that can expand clients + + + + Method to expand this object by + + The object to expand with + + + + Function to expand compute a new object that is this object by expanded by . + + The object to expand with + The expanded object + + + + Geometry classes support the concept of applying + an IGeometryComponentFilter filter to the Geometry. + + + The filter is applied to every component of the Geometry + which is itself a Geometry + and which does not itself contain any components. + (For instance, all the LinearRings in Polygons are visited, + but in a MultiPolygon the Polygons themselves are not visited.) + Thus the only classes of Geometry which must be + handled as arguments to + are s, s and s. + An IGeometryComponentFilter filter can either + record information about the Geometry + or change the Geometry in some way. + IGeometryComponentFilter is an example of the Gang-of-Four Visitor pattern. + > + + + + Performs an operation with or on geom. + + A Geometry to which the filter is applied. + + + + GeometryCollection classes support the concept of + applying a IGeometryFilter to the Geometry. + The filter is applied to every element Geometry. + A IGeometryFilter can either record information about the Geometry + or change the Geometry in some way. + IGeometryFilter is an example of the Gang-of-Four Visitor pattern. + + + + + Performs an operation with or on geom. + + A Geometry to which the filter is applied. + + + + Interface describing objects that can perform an intersects predicate with objects. + + The type of the component that can intersect + + + + Predicate function to test if intersects with this object. + + The object to test + true if this objects intersects with + + + + Interface to identify all Geometry subclasses that have a Dimension of + and have components which are s. + + Martin Davis + + + + + + A backed by an array of s. + This is the implementation that s use by default. + + Coordinates returned by , and are live -- + modifications to them are actually changing the + CoordinateSequence's underlying data. + A dimension may be specified for the coordinates in the sequence, + which may be 2 or 3. + The actual coordinates will always have 3 ordinates, + but the dimension is useful as metadata in some situations. + + + + + Array of coordinates in sequence + + + + + Constructs a sequence based on the given array of s. + The coordinate dimension defaults to 2 + + + The array is not copied. + + The coordinate array that will be referenced. + + + + Constructs a sequence based on the given array + of s. + + The Array is not copied + The coordinate array that will be referenced. + The dimension of the coordinates + + + + Constructs a sequence based on the given array + of s. + + The Array is not copied + + It is your responsibility to ensure the array contains Coordinates of the + indicated dimension and measures (See ). + + The coordinate array that will be referenced. + The dimension of the coordinates + The number of measure ordinate values. + + + + Constructs a sequence of a given size, populated with new Coordinates. + + The size of the sequence to create. + + + + Constructs a sequence of a given , populated + with new s of the given . + + The size of the sequence to create. + the dimension of the coordinates + + + + Constructs a sequence of a given , populated + with new s of the given + with the given number of + + The size of the sequence to create. + the dimension of the coordinates + the number of measures of the coordinates + + + + Creates a new sequence based on a deep copy of the given . + + The coordinate sequence that will be copied + + + + Ensure array contents of the same type, making use of as needed. + + A new array will be created if needed to return a consistent result. + + + array containing consistent coordinate instances + + + + Get the Coordinate with index i. + + The index of the coordinate. + The requested Coordinate instance. + + + + Get a copy of the Coordinate with index i. + + The index of the coordinate. + A copy of the requested Coordinate. + + + + Copies the i'th coordinate in the sequence to the supplied Coordinate. + + The index of the coordinate to copy. + A Coordinate to receive the value. + + + + Returns ordinate X (0) of the specified coordinate. + + + + The value of the X ordinate in the index'th coordinate. + + + + + Returns ordinate Y (1) of the specified coordinate. + + + + The value of the Y ordinate in the index'th coordinate. + + + + + Returns ordinate Z of the specified coordinate if available. + + + + The value of the Z ordinate in the index'th coordinate, or Double.NaN if not defined. + + + + + Returns ordinate M of the specified coordinate if available. + + + + The value of the M ordinate in the index'th coordinate, or Double.NaN if not defined. + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure values). + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + + + + + Creates a deep copy of the CoordinateArraySequence. + + The deep copy. + + + + + + + + + + Sets the value for a given ordinate of a coordinate in this sequence. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + The new ordinate value. + + + + This method exposes the internal Array of Coordinate Objects. + + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + + + + Returns the string representation of the coordinate array. + + + + + + Creates CoordinateSequences represented as an array of Coordinates. + + + + + Returns the singleton instance of CoordinateArraySequenceFactory. + + + + + Returns a CoordinateArraySequence based on the given array (the array is not copied). + + the coordinates, which may not be null nor contain null elements. + + + + + + + + + + + A coordinate sequence that follows the dotspatial shape range + + + + + Creates an instance of this class + + The coordinates + + + + + Constructs a sequence of a given size, populated with new Coordinates. + + The size of the sequence to create. + The number of dimensions. + The number of measures. + + + + Constructs a sequence of a given size, populated with new Coordinates. + + The size of the sequence to create. + The kind of ordinates. + + + + Creates a sequence based on the given coordinate sequence. + + The coordinate sequence. + The ordinates to copy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Creates a reversed version of this coordinate sequence with cloned s + + A reversed version of this sequence + + + + Gets the vector with x- and y-ordinate values; + + If you modify the values of this vector externally, you need to call ! + + + + Gets the vector with z-ordinate values + + If you modify the values of this vector externally, you need to call ! + + + + Gets the vector with measure values + + If you modify the values of this vector externally, you need to call ! + + + + Releases the weak reference to the weak referenced coordinate array + + This is necessary if you modify the values of the , , arrays externally. + + + + A coordinate sequence factory class that creates DotSpatial's Shape/ShapeRange like coordinate sequences. + + + + + Returns the singleton instance of DotSpatialAffineCoordinateSequenceFactory. + + + + + + Returns a CoordinateArraySequence based on the given array (the array is not copied). + + the coordinates, which may not be null nor contain null elements. + + + + + Creates a which is a copy + of the given . + This method must handle null arguments by creating an empty sequence. + + + A coordinate sequence + + + + + + + Creates a of the specified size and ordinates. + For this to be useful, the implementation must be mutable. + + The number of coordinates. + + The ordinates each coordinate has. is fix, + and can be set. + + A coordinate sequence. + + + + Creates an instance of this class using the provided array for x- and y ordinates + + The x- and y-ordinates + A coordinate sequence + + + + Creates an instance of this class using the provided array for x- and y ordinates, + the array for either z-ordinates or measure values. This is indicated by . + + The x- and y-ordinates + An array of z- or measure values + A value indicating if contains z-ordinates or measure values. + A coordinate sequence + + + + Creates an instance of this class using the provided array for x- and y ordinates, + the array for z ordinates and for measure values. + + The x- and y-ordinates + An array of z- or measure values + An array of measure values. + A coordinate sequence + + + + A CoordinateSequence implementation based on a packed arrays. + + + + + A soft reference to the Coordinate[] representation of this sequence. + Makes repeated coordinate array accesses more efficient. + + + + + Creates an instance of this class + + The number of s in the sequence. + The total number of ordinates that make up a in this sequence. + the number of measure-ordinates each { in this sequence has. + + + + Returns (possibly a copy of) the ith Coordinate in this collection. + Whether or not the Coordinate returned is the actual underlying + Coordinate or merely a copy depends on the implementation. + Note that in the future the semantics of this method may change + to guarantee that the Coordinate returned is always a copy. Callers are + advised not to assume that they can modify a CoordinateSequence by + modifying the Coordinate returned by this method. + + + + + + + Returns (possibly copies of) the Coordinates in this collection. + Whether or not the Coordinates returned are the actual underlying + Coordinates or merely copies depends on the implementation. + Note that if this implementation does not store its data as an array of Coordinates, + this method will incur a performance penalty because the array needs to + be built from scratch. + + + + + + Releases the weak reference to the coordinate array. + + + This is necessary if you directly modify the array from GetRawCoordinates. + + + + + + + + Returns a Coordinate representation of the specified coordinate, by always + building a new Coordinate object. + + The coordinate index + The at the given index + + + + Packed coordinate sequence implementation based on doubles. + + + + + The packed coordinate array + + + + + Initializes a new instance of the class. + + An array of double values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of float values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of s. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + The number of coordinates in this sequence + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Gets the underlying array containing the coordinate values. + + The array of coordinate values + + + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure values). + + + Beware, for performance reasons the ordinate index is not checked, if + it's over dimensions you may not get an exception but a meaningless + value. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + + + + + Sets the ordinate of a coordinate in this sequence. + + The coordinate index. + The ordinate index in the coordinate, 0 based, + smaller than the number of dimensions. + The new ordinate value. + + Warning: for performance reasons the ordinate index is not checked. + If it is larger than the dimension a meaningless value may be returned. + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + Packed coordinate sequence implementation based on floats. + + + + + The packed coordinate array + + + + + Initializes a new instance of the class. + + An array of float values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of double values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of s. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + + + + + + + Gets the underlying array containing the coordinate values. + + The array of coordinate values + + + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure values). + + + Beware, for performance reasons the ordinate index is not checked, if + it's over dimensions you may not get an exception but a meaningless + value. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + + + + + Sets the ordinate of a coordinate in this sequence. + + The coordinate index. + The ordinate index in the coordinate, 0 based, + smaller than the number of dimensions. + The new ordinate value. + + Warning: for performance reasons the ordinate index is not checked: + if it is over dimensions you may not get an exception but a meaningless value. + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + Builds packed array coordinate sequences. + The array data type can be either + double or float, + and defaults to double. + + + + + An enumeration of valid type codes + + + + + Type code for arrays of type double. + + + + + Type code for arrays of type float. + + + + + A factory creating coordinate sequences + + + + + A factory creating coordinate sequences + + + + + Initializes a new instance of the class, + using double values. + + + + + Initializes a new instance of the class. + + The type. + + + + Gets the type of packed coordinate sequence this factory builds, either + or + + The type of packed array built. + + + + Returns a CoordinateSequence based on the given array; whether or not the + array is copied is implementation-dependent. + + Coordinates array, which may not be null nor contain null elements + + + + + Returns a CoordinateSequence based on the given coordinate sequence; whether or not the + array is copied is implementation-dependent. + + + + + + + Creates a packed coordinate sequence of type from the provided double array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + A packed coordinate sequence of + + + + Creates a packed coordinate sequence of type from the provided double array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + The coordinate measure count + A packed coordinate sequence of + + + + Creates a packed coordinate sequence of type from the provided float array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + A packed coordinate sequence of + + + + Creates a packed coordinate sequence of type from the provided float array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + The coordinate measure count + A packed coordinate sequence of + + + + + + + An implementation of that packs its contents in a way that + can be customized by the creator. + + + + + Initializes a new instance of the class. + + + Contains the raw data for this sequence. + + + Contains a pair of indexes to tell us, for each dimension, where to find its data in + . + + + The value for . + + + + + Gets the underlying for the ordinates at the given index, along + with a "stride" value that represents how many slots there are between elements. + + + The index of the ordinate whose values to get, from + . + + + The underlying and stride. + + + Assuming is nonzero, the first element of the + returned array holds the first coordinate's value for the requested ordinate, and the + last element of the returned array holds the last coordinate's value for the requested + ordinate. + + + + + + + + + + + + + + + + + + + + + + + Factory for creating instances. + + + + + Initializes a new instance of the class. + + + A sequence of zero or more flags representing ordinate values + that should be allocated together. + + + Thrown when is . + + + Thrown when a given flag appears in more than one element of + . + + + Any flags not represented in , and any spatial or + measure dimensions beyond the 16th, will be allocated together, SoA-style. + + Elements without any bits set will be silently ignored. + + + + + Creates a new that uses the given arrays for reading + and writing X and Y data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X and Y data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2. + + + + + Creates a new that uses the given arrays for reading + and writing X, Y, and Z data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and Z data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2, or when the + input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and Z data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X, Y, and Z values, laid out as + [x0, y0, z0, x1, y1, z1, x2, y2, z2, ..., xn, yn, zn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 3. + + + + + Creates a new that uses the given arrays for reading + and writing X, Y, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2, or when the + input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X, Y, and M values, laid out as + [x0, y0, m0, x1, y1, m1, x2, y2, m2, ..., xn, yn, mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 3. + + + + + Creates a new that uses the given arrays for reading + and writing X, Y, Z, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, Z, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2, or when the + input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, Z, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X, Y, Z, and M values, laid out as + [x0, y0, z0, m0, x1, y1, z1, m1, x2, y2, z2, m2, ..., xn, yn, zn, mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 4. + + + + + + + + Models a Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix. + + + DE-9IM matrix values (such as "212FF1FF2") + specify the topological relationship between two s. + This class can also represent matrix patterns (such as "T*T******") + which are used for matching instances of DE-9IM matrices. + + DE-9IM matrices are 3x3 matrices with integer entries. + The matrix indices {0,1,2} + represent the topological locations + that occur in a geometry(Interior, Boundary, Exterior). + These are provided by the constants + , , and . + + When used to specify the topological relationship between two geometries, + the matrix entries represent the possible dimensions of each intersection: + = 2, = 1, = 0 and = -1.
+ When used to represent a matrix pattern entries can have the additional values + ("T") and ("*"). + + For a description of the DE-9IM and the spatial predicates derived from it, see the following references: + + OGC 99-049 OpenGIS Simple Features Specification for SQL. + + OGC 06-103r4 OpenGIS Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture, + Section 6.1.15 (which provides some further details on certain predicate specifications). + Wikipedia article on DE-9IM + + + Methods are provided to: + + set and query the elements of the matrix in a convenient fashion + convert to and from the standard string representation(specified in SFS Section 2.1.13.2). + test if a matrix matches a given pattern string. + test if a matrix(possibly with geometry dimensions) matches a standard named spatial predicate + +
+
+ + + Internal representation of this . + + + + + Creates an with null location values. + + + + + Creates an with the given dimension + symbols. + + A string of nine dimension symbols in row major order. + + + + Creates an with the same elements as + other. + + An to copy. + + + + Adds one matrix to another. + Addition is defined by taking the maximum dimension value of each position + in the summand matrices. + + The matrix to add. + + + + Tests if the dimension value matches TRUE + (i.e. has value 0, 1, 2 or TRUE). + + A number that can be stored in the IntersectionMatrix. + Possible values are {, , , , , } + true if the dimension value matches + + + + Tests if the dimension value satisfies the dimension symbol. + + + a number that can be stored in the IntersectionMatrix. + Possible values are {True, False, Dontcare, 0, 1, 2}. + + + A character used in the string + representation of an . + Possible values are T, F, * , 0, 1, 2. + + + true if the dimension symbol encompasses the dimension value. + + + + + Tests if each of the actual dimension symbols in a matrix string satisfies the + corresponding required dimension symbol in a pattern string. + + + Nine dimension symbols to validate. + Possible values are T, F, * , 0, 1, 2. + + + Nine dimension symbols to validate + against. Possible values are T, F, * , 0, 1, 2. + + + true if each of the required dimension + symbols encompass the corresponding actual dimension symbol. + + + + + Changes the value of one of this elements. + + + The row of this , + indicating the interior, boundary or exterior of the first + + + The column of this , + indicating the interior, boundary or exterior of the second + + The new value of the element + + + + Changes the elements of this to the + dimension symbols in dimensionSymbols. + + + Nine dimension symbols to which to set this + s elements. Possible values are {T, F, * , 0, 1, 2} + + + + + Changes the specified element to minimumDimensionValue if the element is less. + + + The row of this , + indicating the interior, boundary or exterior of the first . + + + The column of this , + indicating the interior, boundary or exterior of the second . + + + The dimension value with which to compare the + element. The order of dimension values from least to greatest is + True, False, Dontcare, 0, 1, 2. + + + + + If row >= 0 and column >= 0, changes the specified element to minimumDimensionValue + if the element is less. Does nothing if row is smaller to 0 or column is smaller to 0. + + + + + + + + For each element in this , changes the + element to the corresponding minimum dimension symbol if the element is + less. + + + Nine dimension symbols with which to + compare the elements of this . The + order of dimension values from least to greatest is Dontcare, True, False, 0, 1, 2. + + + + + Changes the elements of this to dimensionValue. + + + The dimension value to which to set this + s elements. Possible values True, False, Dontcare, 0, 1, 2}. + + + + + Returns the value of one of this s + elements. + + + The row of this , indicating + the interior, boundary or exterior of the first . + + + The column of this , + indicating the interior, boundary or exterior of the second . + + The dimension value at the given matrix position. + + + + See methods Get(int, int) and Set(int, int, int value) + + + + + Tests if this matrix matches [FF*FF****]. + + + true if the two 's related by + this matrix are disjoint. + + + + + Tests if isDisjoint returns . + + + true if the two 's related by + this matrix intersect. + + + + + Tests if this matrix matches + [FT*******], [F**T*****] or [F***T****]. + + The dimension of the first . + The dimension of the second . + + true if the two + s related by this matrix touch; Returns false + if both s are points. + + + + + Tests whether this geometry crosses the + specified geometry. + + + The crosses predicate has the following equivalent definitions: + + The geometries have some but not all interior points in common. + The DE-9IM Intersection Matrix for the two geometries matches + + [T*T******] (for P/L, P/A, and L/A situations) + [T*****T**] (for L/P, L/A, and A/L situations) + [0********] (for L/L situations) + + + For any other combination of dimensions this predicate returns false. + + The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. + JTS extends the definition to apply to L/P, A/P and A/L situations as well. + This makes the relation symmetric. + + The dimension of the first . + The dimension of the second . + + true if the two + s related by this matrix cross. + + + + + Tests whether this matrix matches [T*F**F***]. + + true if the first is within the second. + + + + Tests whether this matrix matches [T*****FF*] + + true if the first contains the second. + + + + Tests if this matrix matches + [T*****FF*] + or [*T****FF*] + or [***T**FF*] + or [****T*FF*]. + + true if the first covers the second + + + + Tests if this matrix matches + [T*F**F***] + or [*TF**F***] + or [**FT*F***] + or [**F*TF***]. + + true if the first is covered by the second + + + + Tests whether the argument dimensions are equal and + this matrix matches the pattern [T*F**FFF*]. + + Note: This pattern differs from the one stated in + Simple feature access - Part 1: Common architecture. + That document states the pattern as [TFFFTFFFT]. This would + specify that + two identical POINTs are not equal, which is not desirable behaviour. + The pattern used here has been corrected to compute equality in this situation. + + The dimension of the first . + The dimension of the second . + + true if the two s + related by this matrix are equal; the + s must have the same dimension to be equal. + + + + + Tests if this matrix matches + + [T*T***T**] (for two points or two surfaces) + [1*T***T**] (for two curves) + + + The dimension of the first . + The dimension of the second . + + true if the two + s related by this matrix overlap. For this + function to return true, the s must + be two points, two curves or two surfaces. + + + + + Tests whether this matrix matches the given matrix pattern + + + A pattern containing nine dimension symbols with which to + compare the entries of this matrix.Possible + symbol values are { T, F, * , 0, 1, 2}. + + + true if this + matches the required dimension symbols. + + + + + Transposes this IntersectionMatrix. + + This as a convenience, + + + + Returns a nine-character String representation of this . + + + The nine dimension symbols of this + in row-major order. + + + + + Interface to identify all Geometry subclasses that have a Dimension of + and have components that are s. + + Martin Davis + + + + + + Interface to identify all Geometry subclasses that have a Dimension of + and have components that ar s. + + Martin Davis + + + + + + Models an OGC SFS LinearRing. + + + A LinearRing is a which is both closed and simple. + In other words, + the first and last coordinate in the ring must be equal, + and the ring must not self-intersect. + Either orientation of the ring is allowed. + + A ring must have either 0 or 3 or more points. + The first and last points must be equal (in 2D). + If these conditions are not met, the constructors throw + an
+ A ring with 3 points is invalid, because it is collapsed + and thus has a self-intersection. It is allowed to be constructed + so that it can be represented, and repaired if needed. +
+
+ + + The minimum number of vertices allowed in a valid non-empty ring. + Empty rings with 0 vertices are also valid. + + + + + Constructs a LinearRing with the vertices specified + by the given . + + A sequence points forming a closed and simple linestring, + or null to create the empty geometry. + The factory that creates this LinearRing + If the ring is not closed, or has too few points + + + + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + Returns Dimensions.False, since by definition LinearRings do not have a boundary. + + + + + + + + + + Returns the name of this object's interface. + + "LinearRing" + + + > + + + + + + + The actual implementation of the function for LINEARRINGs. + + A reversed geometry + + + + Gets a value indicating if this LINEARRING is oriented + + + + + Initializes a new instance of the class. + + The points used for create this instance. + + For create this is used a standard + with == . + + If the ring is not closed, or has too few points + + + + An enumeration of ring orientation values + + + + + The orientation of the ring's coordinates is counter-clockwise. + + + + + The orientation of the ring's coordinates follows the left-hand-rule, + saying that if you follow the ring in the direction of its coordinates + your left hand will be inside the ring. + + + + + + The orientation of the ring's coordinates is counter-clockwise. + + + + + The orientation of the rings coordinates does not matter. + + + + + The default orientation of the rings coordinates. + Set to + + + + + The orientation of the ring's coordinates is clockwise. + + + + + The orientation of the ring's coordinates follows the right-hand-rule, + saying that if you follow the ring in the direction of its coordinates + your right hand will be inside the ring. + + + + + + The orientation of the ring's coordinates is clockwise. + + + + + Represents a line segment defined by two Coordinates. + Provides methods to compute various geometric properties + and relationships of line segments. + This class is designed to be easily mutable (to the extent of + having its contained points public). + This supports a common pattern of reusing a single LineSegment + object as a way of computing segment properties on the + segments defined by arrays or lists of Coordinates. + + + + + The end-point + + + + + The start-point + + + + + Creates an instance of this class using two coordinates + + The start-point + The end-point + + + + Creates an instance of this class using another instance + + + + + + + + + + + Creates an instance of this class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the minimum X ordinate + + + + + Gets the maximum X ordinate + + + + + Gets the minimum Y ordinate + + + + + Gets the maximum Y ordinate + + + + + Computes the length of the line segment. + + The length of the line segment. + + + + Tests whether the segment is horizontal. + + true if the segment is horizontal. + + + + Tests whether the segment is vertical. + + true if the segment is vertical. + + + + Determines the orientation of a LineSegment relative to this segment. + The concept of orientation is specified as follows: + Given two line segments A and L, + A is to the left of a segment L if A lies wholly in the + closed half-plane lying to the left of L + A is to the right of a segment L if A lies wholly in the + closed half-plane lying to the right of L + otherwise, A has indeterminate orientation relative to L. This + happens if A is collinear with L or if A crosses the line determined by L. + + The LineSegment to compare. + + 1 if seg is to the left of this segment, + -1 if seg is to the right of this segment, + 0 if seg is collinear to or crosses this segment. + + + + + Determines the orientation index of a relative to this segment. + The orientation index is as defined in . + + + + + 1if p is to the left of this segment + -1if p is to the right of this segment + 0if p is collinear with this segment + " + + + + + + Reverses the direction of the line segment. + + + + + Puts the line segment into a normalized form. + This is useful for using line segments in maps and indexes when + topological equality rather than exact equality is desired. + + + + + The angle this segment makes with the x-axis (in radians). + + + + The midpoint of the segment + + + + Computes the distance between this line segment and another one. + + + + + + + Computes the distance between this line segment and a point. + + + + + Computes the perpendicular distance between the (infinite) line defined + by this line segment and a point. + + + + + + + Computes the that lies a given + fraction along the line defined by this segment. + + + A fraction of 0.0 returns the start point of the segment; + A fraction of 1.0 returns the end point of the segment. + If the fraction is < 0.0 or > 1.0 the point returned + will lie before the start or beyond the end of the segment. + + the fraction of the segment length along the line + the point at that distance + + + + Computes the that lies a given + + + A fraction along the line defined by this segment and offset from + the segment by a given distance. + A fraction of 0.0 offsets from the start point of the segment; + A fraction of 1.0 offsets from the end point of the segment. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + + the fraction of the segment length along the line + the distance the point is offset from the segment + (positive is to the left, negative is to the right) + the point at that distance and offset + if the segment has zero length + + + Computes the Projection Factor for the projection of the point p + onto this LineSegment. The Projection Factor is the constant r + by which the vector for this segment must be multiplied to + equal the vector for the projection of p on the line + defined by this segment. + + The projection factor will lie in the range (-inf, +inf), + or be NaN if the line segment has zero length. + + The point to compute the factor for + The projection factor for the point + + + + Computes the fraction of distance (in [0.0, 1.0]) + that the projection of a point occurs along this line segment. + If the point is beyond either ends of the line segment, + the closest fractional value (0.0 or 1.0) is returned. + + + Essentially, this is the clamped to + the range [0.0, 1.0]. + + the point + the fraction along the line segment the projection of the point occurs + + + + Compute the projection of a point onto the line determined + by this line segment. + Note that the projected point may lie outside the line segment. + If this is the case, the projection factor will lie outside the range [0.0, 1.0]. + + + + + + + Project a line segment onto this line segment and return the resulting + line segment. The returned line segment will be a subset of + the target line line segment. This subset may be null, if + the segments are oriented in such a way that there is no projection. + Note that the returned line may have zero length (i.e. the same endpoints). + This can happen for instance if the lines are perpendicular to one another. + + The line segment to project. + The projected line segment, or null if there is no overlap. + + + + Computes the that is offset from + the segment by a given distance. + The computed segment is offset to the left of the line if the offset distance is + positive, to the right if negative. + + The distance the point is offset from the segment + (positive is to the left, negative is to the right) + A line segment offset by the specified distance + Thrown if the segment has zero length + + + + Computes the closest point on this line segment to another point. + + The point to find the closest point to. + + A Coordinate which is the closest point on the line segment to the point p. + + + + + Computes the closest points on a line segment. + + + + A pair of Coordinates which are the closest points on the line segments. + + + + + Computes the reflection of a point in the line defined + by this line segment. + + The point to reflect + The reflected point + + + + Computes an intersection point between two segments, if there is one. + There may be 0, 1 or many intersection points between two segments. + If there are 0, null is returned. If there is 1 or more, a single one + is returned (chosen at the discretion of the algorithm). If + more information is required about the details of the intersection, + the class should be used. + + A line segment + An intersection point, or null if there is none. + + + + + Computes the intersection point of the lines defined by two segments, if there is one. + + + There may be 0, 1 or an infinite number of intersection points between two lines. + If there is a unique intersection point, it is returned. + Otherwise, null is returned. + If more information is required about the details of the intersection, + the class should be used. + + A line segment defining a straight line + An intersection point, or null if there is none or an infinite number + + + + + Creates a LineString with the same coordinates as this segment + + the geometry factory to use + A LineString with the same geometry as this segment + + + + Returns true if o has the same values for its points. + + A LineSegment with which to do the comparison. + + true if o is a LineSegment + with the same values for the x and y ordinates. + + + + + + + + + + + + + + + + + + + + + Compares this object with the specified object for order. + Uses the standard lexicographic ordering for the points in the LineSegment. + + + The LineSegment with which this LineSegment + is being compared. + + + A negative integer, zero, or a positive integer as this LineSegment + is less than, equal to, or greater than the specified LineSegment. + + + + + Returns true if other is + topologically equal to this LineSegment (e.g. irrespective + of orientation). + + + A LineSegment with which to do the comparison. + + + true if other is a LineSegment + with the same values for the x and y ordinates. + + + + + + + + + + + + Return HashCode. + + + + + Models an OGC-style LineString + + + A LineString consists of a sequence of two or more vertices, + along with all points along the linearly-interpolated curves + (line segments) between each + pair of consecutive vertices. + Consecutive vertices may be equal. + The line segments in the line may intersect each other (in other words, + the LineString may "curl back" in itself and self-intersect. + LineStrings with exactly two identical points are invalid. + A LineString must have either 0 or 2 or more points. + If these conditions are not met, the constructors throw an . + + + + + + Represents an empty LineString. + + + + + The points of this LineString. + + + + + Initializes a new instance of the class. + + + For create this is used a standard + with == . + + The coordinates used for create this . + If too few points are provided + + + + Initializes a new instance of the class. + + + The points of the LineString, or null + to create the empty point. Consecutive points may not be equal. + + + If too few points are provided + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + Returns an array containing the values of all the vertices for + this geometry. + + + If the geometry is a composite, the array will contain all the vertices + for the components, in the order in which the components occur in the geometry. + + In general, the array cannot be assumed to be the actual internal + storage for the vertices. Thus modifying the array + may not modify the geometry itself. + Use the method + (possibly on the components) to modify the underlying data. + If the coordinates are modified, + must be called afterwards. + + + The vertices of this Geometry. + + + + + + + Gets an array of ordinate values + + The ordinate index + An array of ordinate values + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets + + + + + + + Gets a value indicating the start point of this LINESTRING + + + + + Gets a value indicating the end point of this LINESTRING + + + + + Gets a value indicating if this LINESTRING is closed. + + + + + Gets a value indicating if this LINESTRING forms a ring. + + + + + Returns the name of this object's interface. + + "LineString" + + + + Gets the OGC geometry type + + + + + Returns the length of this LineString + + The length of the polygon. + + + + Returns the boundary, or an empty geometry of appropriate dimension + if this Geometry is empty. + For a discussion of this function, see the OpenGIS Simple + Features Specification. As stated in SFS Section 2.1.13.1, "the boundary + of a Geometry is a set of Geometries of the next lower dimension." + + The closure of the combinatorial boundary of this Geometry. + + + + Creates a whose coordinates are in the reverse order of this objects. + + A with coordinates in the reverse order. + + + + The actual implementation of the function for LINESTRINGs. + + A reversed geometry + + + + Returns true if the given point is a vertex of this LineString. + + The Coordinate to check. + true if pt is one of this LineString's vertices. + + + + + + + + + + + + + + + + + + + + + + + + Performs an operation on the coordinates in this Geometry's s. + + + If the filter reports that a coordinate value has been changed, + will be called automatically. + + The filter to apply + + + + + + + Performs an operation with or on this Geometry and its + subelement Geometrys (if any). + Only GeometryCollections and subclasses + have subelement Geometry's. + + + The filter to apply to this Geometry (and + its children, if it is a GeometryCollection). + + + + + Performs an operation with or on this Geometry and its + component Geometry's. Only GeometryCollections and + Polygons have component Geometry's; for Polygons they are the LinearRings + of the shell and holes. + + The filter to apply to this Geometry. + + + > + + + + Normalizes a LineString. A normalized LineString + has the first point which is not equal to it's reflected point + less than the reflected point. + + + + + + + + + + + + + + + + + + + + + + + + + + + The location of a relative to a + + + + + DE-9IM row index of the interior of the first point and column index of + the interior of the second point. Location value for the interior of a + point. + + int value = 0; + + + + DE-9IM row index of the boundary of the first point and column index of + the boundary of the second point. Location value for the boundary of a + point. + + int value = 1; + + + + DE-9IM row index of the exterior of the first point and column index of + the exterior of the second point. Location value for the exterior of a + point. + + int value = 2; + + + + Used for uninitialized location values. + + int value = 1; + + + + Utility class for enumeration + + + + + Converts the location value to a location symbol, for example, EXTERIOR => 'e'. + + + Either 'e', 'b', 'i' or '-'. + + + + Models a collection of s. + + Any collection of LineStrings is a valid MultiLineString. + + + + + Represents an empty MultiLineString. + + + + + Constructs a MultiLineString. + + + The LineStrings for this MultiLineString, + or null or an empty array to create the empty + point. Elements may be empty LineStrings, + but not nulls. + + + + + + Constructs a MultiLineString. + + + The LineStrings for this MultiLineString, + or null or an empty array to create the empty + point. Elements may be empty LineStrings, + but not nulls. + + + For create this is used a standard + with == . + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + + + + + Returns the name of this object's interface. + + "MultiLineString" + + + + Gets the OGC geometry type + + + + + Gets a value indicating whether this instance is closed. + + true if this instance is closed; otherwise, false. + + + + Creates a in the reverse order to this object. + Both the order of the component LineStrings + and the order of their coordinate sequences are reversed. + + a in the reverse order. + + + + + + > + + + + + + + + + + + + Models a collection of Points. + + + + + Represents an empty MultiPoint. + + + + + Constructs a MultiPoint. + + + The Points for this MultiPoint + , or null or an empty array to create the empty point. + Elements may be empty Points, but not nulls. + + + + + + Constructs a MultiPoint. + + + The Points for this MultiPoint + , or null or an empty array to create the empty point. + Elements may be empty Points, but not nulls. + + + For create this is used a standard + with == . + + + + > + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + + + Returns the name of this object's interface. + + "MultiPoint" + + + + Gets the boundary of this geometry. + Zero-dimensional geometries have no boundary by definition, + so an empty GeometryCollection is returned. + + + + + + + + + + + + + + + + + + + Returns the Coordinate at the given position. + + The index of the Coordinate to retrieve, beginning at 0. + + The nth Coordinate. + + + + Basic implementation of MultiPolygon. + + + + + Represents an empty MultiPolygon. + + + + + Constructs a MultiPolygon. + + + The Polygons for this MultiPolygon + , or null or an empty array to create the empty point. + Elements may be empty Polygons, but not null + s. The polygons must conform to the assertions specified in the + OpenGIS Simple Features + Specification for SQL. + + + For create this is used a standard + with == . + + + + + Constructs a MultiPolygon. + + + The Polygons for this MultiPolygon + , or null or an empty array to create the empty point. + Elements may be empty Polygons, but not null + s. The polygons must conform to the assertions specified in the + OpenGIS Simple Features + Specification for SQL. + + + + + > + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + + + Returns the name of this object's interface. + + "MultiPolygon" + + + > + + + + + + + + + + + + + + + + + Creates a with every component reversed. + + The order of the components in the collection are not reversed. + An in the reverse order + + + + + + + A bounding container for a which is in the shape of a general octagon. + + + The OctagonalEnvelope of a geometric object + is a geometry which is tight bound along the (up to) four extremal rectilinear parallels + and along the (up to) four extremal diagonal parallels. + Depending on the shape of the contained + geometry, the octagon may be degenerate to any extreme + (e.g. it may be a rectangle, a line, or a point). + + + + + Gets the octagonal envelope of a geometry + + The geometry + The octagonal envelope of the geometry + + + + Creates a new null bounding octagon + + + + + Creates a new null bounding octagon bounding a + + The coordinate to bound + + + + Creates a new null bounding octagon bounding a pair of s + + A coordinate to bound + A coordinate to bound + + + + Creates a new null bounding octagon bounding an + + + + + Creates a new null bounding octagon bounding an + (the copy constructor). + + + + + Creates a new null bounding octagon bounding a + + + + + Gets a value indicating the minimal x-ordinate value + + + + + Gets a value indicating the maximal x-ordinate value + + + + + Gets a value indicating the minimal y-ordinate value + + + + + Gets a value indicating the maximal y-ordinate value + + + + + Gets a value indicating the minimal a value + + + + + Gets a value indicating the maximal a value + + + + + Gets a value indicating the minimal b value + + + + + Gets a value indicating the maximal b value + + + + + Gets a value indicating that this object is null + + + + + Method to expand this to include the provided geometry. + + The geometry + + + + Method to expand this to include the provided coordinate sequence. + + The coordinate sequence + A reference to this octagonal envelope, expanded by + + + + Method to expand this to include the provided OctogonalEnvelope. + + The OctogonalEnvelope + A reference to this octagonal envelope, expanded by + + + + Function to expand this to include the provided coordinate. + + The coordinate + A reference to this octagonal envelope, expanded by + + + + Function to expand this to include the provided envelope. + + The envelope + A reference to this octagonal envelope, expanded by + + + + Function to expand this to include the provided - and ordinates. + + A x-ordinate value + A y-ordinate value + A reference to this octagonal envelope, expanded by and + + + + Gets a value indicating if the extremal values for this octagon are valid. + + true if this object has valid values + + + + Function to test if this octagonal envelope intersects octagonal envelope . + + An octagonal envelope + true if this octagonal envelope intersects octagonal envelope . + + + + Function to test if this octagonal envelope contains coordinate. + + A coordinate + true if this octagonal envelope contains coordinate. + + + + Function to test if this octagonal envelope contains octagonal envelope. + + An octagonal envelope + true if this octagonal envelope contains octagonal envelope. + + + + Function to convert this octagonal envelope into a geometry + + The factory to create the geometry + A geometry + + + + OGC compliant geometry factory + + + + + Creates an instance of this class using the default + values for , + and + . + + + + + Creates an instance of this class using the default + values for , + , + but the specified . + + + + Creates an instance of this class using the default + values for , + but the + specified . + + + + + + + + The is guaranteed to be orientated counter-clockwise. + + + + + + The is guaranteed to be orientated counter-clockwise. + + + + + + The is guaranteed to be orientated counter-clockwise. + + + + + + The is guaranteed to be orientated counter-clockwise. +
The are guaranteed to be orientated clockwise. +
+
+ + + Enumeration of OGC Geometry Types + + + + + Point. + + + + + LineString. + + + + + Polygon. + + + + + MultiPoint. + + + + + MultiLineString. + + + + + MultiPolygon. + + + + + GeometryCollection. + + + + + CircularString + + + + + CompoundCurve + + + + + CurvePolygon + + + + + MultiCurve + + + + + MultiSurface + + + + + Curve + + + + + Surface + + + + + PolyhedralSurface + + + + + TIN + + + + + Identifies the different well-supported components of coordinate values. + + All supported coordinates define values for at least the X and the Y components. + + + The first 16 spatial and 16 measure dimensions may also be accessed this way. + + + + + + The 1st spatial dimension. + + + + + The "X" ordinate. + + + + + The 2nd spatial dimension. + + + + + The "Y" ordinate. + + + + + The 3rd spatial dimension. + + + + + The "Z" ordinate. + + + + + The 4th spatial dimension. + + + + + The 5th spatial dimension. + + + + + The 6th spatial dimension. + + + + + The 7th spatial dimension. + + + + + The 8th spatial dimension. + + + + + The 9th spatial dimension. + + + + + The 10th spatial dimension. + + + + + The 11th spatial dimension. + + + + + The 12th spatial dimension. + + + + + The 13th spatial dimension. + + + + + The 14th spatial dimension. + + + + + The 15th spatial dimension. + + + + + The 16th spatial dimension. + + + + + The 1st measure dimension. + + + + + The "M" ordinate. + + + + + The 2nd measure dimension. + + + + + The 3rd measure dimension. + + + + + The 4th measure dimension. + + + + + The 5th measure dimension. + + + + + The 6th measure dimension. + + + + + The 7th measure dimension. + + + + + The 8th measure dimension. + + + + + The 9th measure dimension. + + + + + The 10th measure dimension. + + + + + The 11th measure dimension. + + + + + The 12th measure dimension. + + + + + The 13th measure dimension. + + + + + The 14th measure dimension. + + + + + The 15th measure dimension. + + + + + The 16th measure dimension. + + + + + Flags for Ordinate values + + + + + No ordinates + + + + + Flag for the x-ordinate + + + + + Flag for the y-ordinate + + + + + Flag for the z-ordinate + + + + + Flag for the m-ordinate + + + + + Flag for both x- and y-ordinate + + + + + Flag for x-, y- and z-ordinate + + + + + Flag for x-, y- and m-ordinate + + + + + Flag for x-, y-, z- and m-ordinate + + + + + Flag for the 1st spatial dimension. + + + + + Flag for the 2nd spatial dimension. + + + + + Flag for the 3rd spatial dimension. + + + + + Flag for the 4th spatial dimension. + + + + + Flag for the 5th spatial dimension. + + + + + Flag for the 6th spatial dimension. + + + + + Flag for the 7th spatial dimension. + + + + + Flag for the 8th spatial dimension. + + + + + Flag for the 9th spatial dimension. + + + + + Flag for the 10th spatial dimension. + + + + + Flag for the 11th spatial dimension. + + + + + Flag for the 12th spatial dimension. + + + + + Flag for the 13th spatial dimension. + + + + + Flag for the 14th spatial dimension. + + + + + Flag for the 15th spatial dimension. + + + + + Flag for the 16th spatial dimension. + + + + + Flags for all spatial ordinates. + + + + + Flag for the 1st measure dimension. + + + + + Flag for the 2nd measure dimension. + + + + + Flag for the 3rd measure dimension. + + + + + Flag for the 4th measure dimension. + + + + + Flag for the 5th measure dimension. + + + + + Flag for the 6th measure dimension. + + + + + Flag for the 7th measure dimension. + + + + + Flag for the 8th measure dimension. + + + + + Flag for the 9th measure dimension. + + + + + Flag for the 10th measure dimension. + + + + + Flag for the 11th measure dimension. + + + + + Flag for the 12th measure dimension. + + + + + Flag for the 13th measure dimension. + + + + + Flag for the 14th measure dimension. + + + + + Flag for the 15th measure dimension. + + + + + Flag for the 16th measure dimension. + + + + + Flags for all non-spatial ordinates. + + + + + Flags for all recognized ordinates. + + + + + Static utility functions for dealing with and dimension + + + + + Translates the -flag to a number of dimensions. + + The ordinates flag + The number of dimensions + + + + Translates the -flag to a number of measures. + + The ordinates flag + The number of measures + + + + Represents a single point. + + A Point is topologically valid if and only if: + + The coordinate which defines it if any) is a valid coordinate + (i.e. does not have an NaN X- or Y-ordinate + + + + + + + Represents an empty Point. + + + + + The Coordinate wrapped by this Point. + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + Initializes a new instance of the class. + + The coordinate used for create this . + + For create this is used a standard + with == . + + + + + Constructs a Point with the given coordinate. + + + Contains the single coordinate on which to base this Point, + or null to create the empty point. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the name of this object's interface. + + "Point" + + + + Gets the OGC geometry type + + + + + Gets the boundary of this geometry. + Zero-dimensional geometries have no boundary by definition, + so an empty GeometryCollection is returned. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + The actual implementation of the function for POINTs. + + A reversed geometry + + + + + + + + + + + + + + + + + + + + + + Initializes a new instance of the class. + + The x coordinate. + The y coordinate. + The z coordinate. + /// + For create this is used a standard + with set to . + + + + + Initializes a new instance of the class. + + The x coordinate. + The y coordinate. + /// + For create this is used a standard + with set to . + + + + + + + + + + Represents a polygon with linear edges, which may include holes. + The outer boundary (shell) + and inner boundaries (holes) of the polygon are represented by {@link LinearRing}s. + The boundary rings of the polygon may have any orientation. + Polygons are closed, simple geometries by definition. + + The polygon model conforms to the assertions specified in the + OpenGIS Simple Features + Specification for SQL. + + A Polygon is topologically valid if and only if: + + the coordinates which define it are valid coordinates + the linear rings for the shell and holes are valid + (i.e. are closed and do not self-intersect) + holes touch the shell or another hole at at most one point + (which implies that the rings of the shell and holes must not cross) + the interior of the polygon is connected, + or equivalently no sequence of touching holes + makes the interior of the polygon disconnected + (i.e. effectively split the polygon into two pieces). + + + + + + Represents an empty Polygon. + + + + + The exterior boundary, or null if this Polygon + is the empty point. + + + + + The interior boundaries, if any. + + + + + Initializes a new instance of the class. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + point is to be created. + + + The inner boundaries of the new Polygon + , or null or empty LinearRings if the empty + point is to be created. + + + For create this is used a standard + with == . + + + + + Constructs a Polygon with the given exterior boundary and + interior boundaries. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + point is to be created. + + + The inner boundaries of the new Polygon + , or null or empty LinearRings if the empty + point is to be created. + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + Returns a vertex of this Geometry + (usually, but not necessarily, the first one). + + + The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation. + + a Coordinate which is a vertex of this Geometry. + null if this Geometry is empty. + + + + + Returns an array containing the values of all the vertices for + this geometry. + + + If the geometry is a composite, the array will contain all the vertices + for the components, in the order in which the components occur in the geometry. + + In general, the array cannot be assumed to be the actual internal + storage for the vertices. Thus modifying the array + may not modify the geometry itself. + Use the method + (possibly on the components) to modify the underlying data. + If the coordinates are modified, + must be called afterwards. + + + The vertices of this Geometry. + + + + + + + Gets an array of ordinate values + + The ordinate index + An array of ordinate values + + + + Returns the count of this Geometrys vertices. The Geometry + s contained by composite Geometrys must be + Geometry's; that is, they must implement NumPoints. + + The number of vertices in this Geometry. + + + + Returns the dimension of this geometry. + + + The dimension of a geometry is is the topological + dimension of its embedding in the 2-D Euclidean plane. + In the NTS spatial model, dimension values are in the set {0,1,2}. + + Note that this is a different concept to the dimension of + the vertex s. + The geometry dimension can never be greater than the coordinate dimension. + For example, a 0-dimensional geometry (e.g. a Point) + may have a coordinate dimension of 3 (X,Y,Z). + + + + The topological dimensions of this geometry + + + + + Returns the dimension of this Geometrys inherent boundary. + + + The dimension of the boundary of the class implementing this + interface, whether or not this object is the empty point. Returns + Dimension.False if the boundary is the empty point. + + NOTE: make abstract and remove setter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the name of this object's interface. + + "Polygon" + + + + + + + Returns the area of this Polygon + + + + + + Returns the perimeter of this Polygon. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests whether this is a rectangular . + + true if the geometry is a rectangle. + + + + + + + The actual implementation of the function for POLYGONs + + A reversed geometry + + + + Constructs a Polygon with the given exterior boundary. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + polygon is to be created. + + + + + + Constructs a Polygon with the given exterior boundary. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + polygon is to be created. + + + + + + + + + + + + + + + Indicates the position of a location relative to a + node or edge component of a planar topological structure. + + + + + Specifies that a location is on a component + + 0 + + + + Specifies that a location is to the left of a component + + 1 + + + + Specifies that a location is to the right of a component + + 2 + + + + Specifies that a location is is parallel to x-axis of a component + + -1 + + + + Creates a new position index + + A position index + + + + Gets a value indicating the position index + + + + + Returns if the position is , + if the position is , or the position + otherwise. + + + + + Equality comparer for indices + + The position index on the left-hand-side + The position index on the right-hand-side + true if both indices are equal. + + + + Inequality comparer for indices + + The position index on the left-hand-side + The position index on the right-hand-side + true if both indices are not equal. + + + + Implicit conversion operator for to conversion. + + The position index + + + + Specifies the precision model of the Coordinates in a Geometry. + In other words, specifies the grid of allowable points for a Geometry. + A precision model may befloating ( or ), + in which case normal floating-point value semantics apply. + + + For a precision model the + method allows rounding a + coordinate to a "precise" value; that is, one whose precision + is known exactly. + + Coordinates are assumed to be precise in geometries. + That is, the coordinates are assumed to be rounded to the + precision model given for the geometry. + + All internal operations + assume that coordinates are rounded to the precision model. + Constructive methods (such as bool operations) always round computed + coordinates to the appropriate precision model.
+ Three types of precision model are supported: + + FloatingRepresents full double precision floating point. + This is the default precision model used in NTS + FloatingSingleRepresents single precision floating point + FixedRepresents a model with a fixed number of decimal places. + A Fixed Precision Model is specified by a scale factor. + The scale factor specifies the size of the grid which numbers are rounded to. + + Input coordinates are mapped to fixed coordinates according to the following + equations: + + jtsPt.X = Math.Round( inputPt.X * scale, MidPointRounding.AwayFromZero ) / scale ) + jtsPt.Y = Math.Round( inputPt.Y * scale, MidPointRounding.AwayFromZero ) / scale ) + + + For example, to specify 3 decimal places of precision, use a scale factor + of 1000. To specify -3 decimal places of precision (i.e. rounding to + the nearest 1000), use a scale factor of 0.001. + + It is also supported to specify a precise grid size + by providing it as a negative scale factor. + This allows setting a precise grid size rather than using a fractional scale, + which provides more accurate and robust rounding. + For example, to specify rounding to the nearest 1000 use a scale factor of -1000. + + Coordinates are represented internally as Java double-precision values. + .NET uses the IEEE-394 floating point standard, which + provides 53 bits of precision. (Thus the maximum precisely representable + integer is 9,007,199,254,740,992 - or almost 16 decimal digits of precision). +
+
+ + + Determines which of two s is the most precise + + A precision model + A precision model + The PrecisionModel which is most precise + + + + The maximum precise value representable in a double. Since IEE754 + double-precision numbers allow 53 bits of mantissa, the value is equal to + 2^53 - 1. This provides almost 16 decimal digits of precision. + + + + + The type of PrecisionModel this represents. + + + + + The scale factor which determines the number of decimal places in fixed precision. + + + + + If non-zero, the precise grid size specified. + In this case, the scale is also valid and is computed from the grid size. + If zero, the scale is used to compute the grid size where needed. + + + + + Gets a value indicating a precision model with double precision. + + A double precision model + + + + Gets a value indicating a precision model with single precision. + + A single precision model + + + + Gets a value indicating a precision model with a scale of 1. + + A fixed precision model + + + + Creates a PrecisionModel with a default precision + of Floating. + + + + + Creates a PrecisionModel that specifies + an explicit precision model type. + If the model type is Fixed the scale factor will default to 1. + + + The type of the precision model. + + + + + Creates a PrecisionModel that specifies Fixed precision. + Fixed-precision coordinates are represented as precise internal coordinates, + which are rounded to the grid defined by the scale factor. + + The provided scale may be negative, to specify an exact grid size. + The scale is then computed as the reciprocal. + + + Amount by which to multiply a coordinate, to obtain a precise coordinate. + Must be non-zero + + + + + Copy constructor to create a new PrecisionModel + from an existing one. + + + + + + Tests whether the precision model supports floating point. + + true if the precision model supports floating point. + + + + Returns the maximum number of significant digits provided by this + precision model. + Intended for use by routines which need to print out precise values. + + + The maximum number of decimal places provided by this precision model. + + + + + Returns the scale factor used to specify a fixed precision model. + + + The number of decimal places of precision is + equal to the base-10 logarithm of the scale factor. + Non-integral and negative scale factors are supported. + Negative scale factors indicate that the places + of precision is to the left of the decimal point. + + + The scale factor for the fixed precision model + + + + + Computes the grid size for a fixed precision model. + This is equal to the reciprocal of the scale factor. + If the grid size has been set explicity (via a negative scale factor) + it will be returned. + + The grid size at a fixed precision scale. + + + + Gets the type of this PrecisionModel. + + + + + + Rounds a numeric value to the PrecisionModel grid. + Symmetric Arithmetic Rounding is used, to provide + uniform rounding behaviour no matter where the number is + on the number line. + + + This method has no effect on NaN values + + + + + + Rounds a Coordinate to the PrecisionModel grid. + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + Compares this PrecisionModel object with the specified object for order. + A PrecisionModel is greater than another if it provides greater precision. + The comparison is based on the value returned by the + {getMaximumSignificantDigits) method. + This comparison is not strictly accurate when comparing floating precision models + to fixed models; however, it is correct when both models are either floating or fixed. + + + The PrecisionModel with which this PrecisionModel + is being compared. + + + A negative integer, zero, or a positive integer as this PrecisionModel + is less than, equal to, or greater than the specified PrecisionModel. + + + + + + + + + + + + + + + + + Floating precision corresponds to the standard + double-precision floating-point representation, which is + based on the IEEE-754 standard + + + + + Floating single precision corresponds to the standard + single-precision floating-point representation, which is + based on the IEEE-754 standard + + + + + Fixed Precision indicates that coordinates have a fixed number of decimal places. + The number of decimal places is determined by the log10 of the scale factor. + + + + + A base class containing the logic for computes the contains + and covers spatial relationship predicates + for a relative to all other classes. + Uses short-circuit tests and indexing to improve performance. + + + + Contains and covers are very similar, and differ only in how certain + cases along the boundary are handled. These cases require + full topological evaluation to handle, so all the code in + this class is common to both predicates. + + + It is not possible to short-circuit in all cases, in particular + in the case where line segments of the test geometry touches the polygon linework. + In this case full topology must be computed. + (However, if the test geometry consists of only points, this + can be evaluated in an optimized fashion. + + + Martin Davis + + + + This flag controls a difference between contains and covers. + For contains the value is true. + For covers the value is false. + + + + + Creates an instance of this operation. + + The PreparedPolygon to evaluate + + + + Evaluate the contains or covers relationship + for the given geometry. + + the test geometry + true if the test geometry is contained + + + + Evaluation optimized for Point geometries. + This provides about a 2x performance increase, and less memory usage. + + A Point or MultiPoint geometry + The value of the predicate being evaluated + + + + Tests whether a geometry consists of a single polygon with no holes. + + True if the geometry is a single polygon with no holes + + + + Computes the full topological predicate. + Used when short-circuit tests are not conclusive. + + The test geometry + true if this prepared polygon has the relationship with the test geometry + + + + A base class for subclasses. + + + Contains default implementations for methods, which simply delegate to the equivalent methods. + This class may be used as a "no-op" class for Geometry types which do not have a corresponding implementation. + + Martin Davis + + + + Gets the list of representative points for this geometry. + One vertex is included for every component of the geometry + (i.e. including one for every ring of polygonal geometries). + + Do not modify the returned list! + + + + + Tests whether any representative of the target geometry intersects the test geometry. + This is useful in A/A, A/L, A/P, L/P, and P/P cases. + + The test geometry + true if any component intersects the areal test geometry + + + + Determines whether a Geometry g interacts with this geometry by testing the geometry envelopes. + + A geometry + true if the envelopes intersect + + + + Determines whether the envelope of this geometry covers the Geometry g. + + A geometry + true if g is contained in this envelope + + + + Tests whether the base contains a given geometry. + + The Geometry to test + true if this Geometry contains the given Geometry + + Default implementation. + + + + Tests whether the base properly contains a given geometry. + + The ContainsProperly predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry's interior. + The DE-9IM Intersection Matrix for the two geometries matches >[T**FF*FF*] + + In other words, if the test geometry has any interaction with the boundary of the target + geometry the result of ContainsProperly is false. + This is different semantics to the predicate, + in which test geometries can intersect the target's boundary and still be contained. + + The advantage of using this predicate is that it can be computed + efficiently, since it avoids the need to compute the full topological relationship + of the input boundaries in cases where they intersect. + + An example use case is computing the intersections + of a set of geometries with a large polygonal geometry. + Since intersection is a fairly slow operation, it can be more efficient + to use to filter out test geometries which lie + wholly inside the area. In these cases the intersection is + known a priori to be simply the original test geometry. + + The geometry to test + true if this geometry properly contains the given geometry + + Default implementation. + + + + + Tests whether the base is covered by a given geometry. + + The geometry to test + true if this geometry is covered by the given geometry + + Default implementation. + + + + Tests whether the base covers a given geometry. + + The geometry to test + true if this geometry covers the given geometry + + Default implementation. + + + + Tests whether the base crosses a given geometry. + + The geometry to test + true if this geometry crosses the given geometry + + Default implementation. + + + + Tests whether the base is disjoint from given geometry. + + The geometry to test + true if this geometry is disjoint from the given geometry + + Standard implementation for all geometries. + + + + Tests whether the base intersects a given geometry. + + The geometry to test + true if this geometry intersects the given geometry + + Default implementation. + + + + Tests whether the base overlaps a given geometry. + + The geometry to test + true if this geometry overlaps the given geometry + + Default implementation. + + + + Tests whether the base touches a given geometry. + + The geometry to test + true if this geometry touches the given geometry + + Default implementation. + + + + Tests whether the base is within a given geometry. + + The geometry to test + true if this geometry is within the given geometry + + Default implementation. + + + + + + + An interface for classes which prepare s + in order to optimize the performance of repeated calls to specific geometric operations. + + + + A given implementation may provide optimized implementations + for only some of the specified methods, and delegate the remaining + methods to the original operations. + + + An implementation may also only optimize certain situations, and delegate others. + See the implementing classes for documentation about which methods and situations + they optimize. + + Subclasses are intended to be thread-safe, to allow IPreparedGeometry + to be used in a multi-threaded context + (which allows extracting maximum benefit from the prepared state). + + + Martin Davis + + + + Gets the original which has been prepared. + + + + + Tests whether the base contains a given geometry. + + The Geometry to test + true if this Geometry contains the given Geometry + + + + + Tests whether the base contains a given geometry. + + + + The ContainsProperly predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry's interior. + The DE-9IM Intersection Matrix for the two geometries matches >[T**FF*FF*] + + The advantage to using this predicate is that it can be computed + efficiently, with no need to compute topology at individual points. + + + An example use case for this predicate is computing the intersections + of a set of geometries with a large polygonal geometry. + Since intersection is a fairly slow operation, it can be more efficient + to use containsProperly to filter out test geometries which lie + wholly inside the area. In these cases the intersection + known a priori to be simply the original test geometry. + + + The geometry to test + true if this geometry properly contains the given geometry + + + + Tests whether the base is covered by a given geometry. + + The geometry to test + true if this geometry is covered by the given geometry + + + + + Tests whether the base covers a given geometry. + + The geometry to test + true if this geometry covers the given geometry + + + + + Tests whether the base crosses a given geometry. + + The geometry to test + true if this geometry crosses the given geometry + + + + + Tests whether the base is disjoint from given geometry. + + + This method supports s as input + + The geometry to test + true if this geometry is disjoint from the given geometry + + + + + Tests whether the base intersects a given geometry. + + + This method supports s as input + + The geometry to test + true if this geometry intersects the given geometry + + + + + Tests whether the base overlaps a given geometry. + + The geometry to test + true if this geometry overlaps the given geometry + + + + + Tests whether the base touches a given geometry. + + The geometry to test + true if this geometry touches the given geometry + + + + + Tests whether the base is within a given geometry. + + The geometry to test + true if this geometry is within the given geometry + + + + + A factory for creating s. It chooses an appropriate implementation of PreparedGeometry + based on the geometric type of the input geometry. + + In the future, the factory may accept hints that indicate + special optimizations which can be performed. + + Instances of this class are thread-safe. + + Martin Davis + + + + Creates a new appropriate for the argument . + + The geometry to prepare + + the prepared geometry + + + + + Creates a new appropriate for the argument . + + The geometry to prepare + + the prepared geometry + + + + + A prepared version for geometries. + Instances of this class are thread-safe. + + mbdavis + + + + Computes the intersects spatial relationship predicate + for a target relative to other classes. + + + Uses short-circuit tests and indexing to improve performance. + + Martin Davis + + + + Computes the intersects predicate between a + and a . + + The prepared linestring + A test geometry + true if the linestring intersects the geometry + + + + Creates an instance of this operation. + + The target PreparedLineString + + + + Tests whether this geometry intersects a given geometry. + + The test geometry + true if the test geometry intersects + + + + Tests whether any representative point of the test Geometry intersects + the target geometry. + + + Only handles test geometries which are Puntal (dimension 0) + + A Puntal geometry to test + true if any point of the argument intersects the prepared geometry + + + + A prepared version for geometries. + Instances of this class are thread-safe. + + Martin Davis + + + + Tests whether this point intersects a . + + + The optimization here is that computing topology for the test geometry + is avoided. This can be significant for large geometries. + + + + + A prepared version for geometries. + This class supports both s and s. + This class does not support MultiPolygons which are non-valid + (e.g. with overlapping elements). + + + Instances of this class are thread-safe and immutable. + + mbdavis + + + + Computes the contains spatial relationship predicate for a relative to all other classes. + Uses short-circuit tests and indexing to improve performance. + + + + It is not possible to short-circuit in all cases, in particular + in the case where the test geometry touches the polygon linework. + In this case full topology must be computed. + + + Martin Davis + + + + Computes the contains spatial relationship predicate between a and a . + + The prepared polygon + A test geometry + true if the polygon contains the geometry + + + + Creates an instance of this operation. + + the PreparedPolygon to evaluate + + + + Tests whether this PreparedPolygon contains a given geometry. + + The test geometry + true if the test geometry is contained + + + + Computes the full topological contains predicate.
+ Used when short-circuit tests are not conclusive. +
+ The test geometry + true if this prepared polygon contains the test geometry +
+ + + Computes the containsProperly spatial relationship predicate for s relative to all other {@link Geometry} classes.
+ Uses short-circuit tests and indexing to improve performance. +
+ + + A Geometry A containsProperly another Geometry B if + all points of B are contained in the Interior of A. + Equivalently, B is contained in A AND B does not intersect + the Boundary of A. + + + The advantage to using this predicate is that it can be computed + efficiently, with no need to compute topology at individual points. + In a situation with many geometries intersecting the boundary + of the target geometry, this can make a performance difference. + + + Martin Davis +
+ + Computes the containsProperly predicate between a and a . + + The prepared polygon + A test geometry + true if the polygon properly contains the geometry + + + + Creates an instance of this operation. + + The PreparedPolygon to evaluate + + + + Tests whether this PreparedPolygon containsProperly a given geometry. + + The test geometry + true if the polygon properly contains the geometry + + + + Computes the Covers spatial relationship predicate for a relative to all other classes. + + + Uses short-circuit tests and indexing to improve performance. + + It is not possible to short-circuit in all cases, in particular in the case where the test geometry touches the polygon linework. + In this case full topology must be computed. + + Martin Davis + + + + Computes the Covers spatial relationship predicate for a relative to all other classes. + + The prepared polygon + A test geometry + true if the polygon covers the geometry + + + + Creates an instance of this operation. + + The PreparedPolygon to evaluate + + + + Tests whether this PreparedPolygon covers a given geometry. + + The test geometry + true if the test geometry is covered + + + + Computes the full topological covers predicate. Used when short-circuit tests are not conclusive. + + The test geometry + true if this prepared polygon covers the test geometry + + + + Computes the intersects spatial relationship predicate + for s relative to all other classes. + + Uses short-circuit tests and indexing to improve performance. + Martin Davis + + + + Computes the intersects predicate between a + and a . + + The prepared polygon + A test geometry + true if the polygon intersects the geometry + + + + Creates an instance of this operation. + + The prepared polygon + + + + Tests whether this PreparedPolygon intersects a given geometry. + + The test geometry + true if the test geometry intersects + + + + A base class for predicate operations on s. + + mbdavis + + + + Creates an instance of this operation. + + the PreparedPolygon to evaluate + + + + Tests whether all components of the test Geometry are contained in the target geometry. + + Handles both linear and point components. + A geometry to test + + true if all components of the argument are contained in the target geometry + + + + + Tests whether all components of the test Geometry are contained in the interior of the target geometry. + + Handles both linear and point components. + A geometry to test + true if all components of the argument are contained in the target geometry interior + + + + Tests whether any component of the test Geometry intersects + the area of the target geometry. + Handles test geometries with both linear and point components. + + A geometry to test + true if any component of the argument intersects the prepared area geometry + + + + Tests whether any point of the test Geometry intersects the interior of the target geometry. + + Handles test geometries with both linear and point components. + A geometry to test + true if any point of the argument intersects the prepared area geometry + + + + Tests whether any point of the test Geometry intersects the interior of the target geometry. + + A geometry to test + true if any point of the argument intersects the prepared area geometry interior + + + + Tests whether any component of the test Geometry intersects the interior of the target geometry. + + Handles test geometries with both linear and point components. + A geometry to test + true if any component of the argument intersects the prepared area geometry interior + + + + Tests whether all points of the test Pointal geometry + are contained in the target geometry. + + A geometry to test + true if all points of the argument are contained in the target geometry + + + + Tests whether any component of the target geometry intersects the test geometry (which must be an areal geometry) + + The test geometry + The representative points of the target geometry + true if any component intersects the areal test geometry + + + + Quadrant values + + + The quadants are numbered as follows: + + + 1 - NW | 0 - NE
+ -------+-------
+ 2 - SW | 3 - SE +
+
+
+
+ + + Undefined + + + + + North-East + + + + + North-West + + + + + South-West + + + + + South-East + + + + + Creates a quadrant with t + + + + + + Creates a quadrant of a directed line segment (specified as x and y + displacements, which cannot both be 0). + + + + If the displacements are both 0 + + + + Returns the quadrant of a directed line segment from p0 to p1. + + + + if the points are equal + + + + + + + + + + + + + Returns true if the quadrants are 1 and 3, or 2 and 4. + + A quadrant + + + + Returns the right-hand quadrant of the halfplane defined by the two quadrants, + or -1 if the quadrants are opposite, or the quadrant if they are identical. + + + + + + + Returns whether this quadrant lies within the given halfplane (specified + by its right-hand quadrant). + + + + + + Returns true if the given quadrant is 0 or 1. + + + + + Equality operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are equal. + + + + Inequality operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are not equal. + + + + Greater than (>) operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are not equal. + + + + Less than (<) operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are not equal. + + + + Indicates an invalid or inconsistent topological situation encountered during processing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a planar triangle, and provides methods for calculating various + properties of triangles. + + + + + A corner point of the triangle + + + + + A corner point of the triangle + + + + + A corner point of the triangle + + + + + Tests whether a triangle is acute. A triangle is acute if all interior + angles are acute. This is a strict test - right triangles will return + false A triangle which is not acute is either right or obtuse. + + Note: this implementation is not robust for angles very close to 90 degrees. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + True if the triangle is acute. + + + + Tests whether a triangle is oriented counter-clockwise. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + true if the triangle orientation is counter-clockwise + + + + Tests whether a triangle intersects a point. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if the triangle intersects the point + + + + Computes the line which is the perpendicular bisector of the + + A point + Another point + The perpendicular bisector, as an HCoordinate line segment a-b. + + + Computes the circumcentre of a triangle. + + The circumcentre is the centre of the circumcircle, + the smallest circle which encloses the triangle. + It is also the common intersection point of the + perpendicular bisectors of the sides of the triangle, + and is the only point which has equal distance to all three + vertices of the triangle. + + The circumcentre does not necessarily lie within the triangle. For example, + the circumcentre of an obtuse isosceles triangle lies outside the triangle. + + This method uses an algorithm due to J.R.Shewchuk which uses normalization + to the origin to improve the accuracy of computation. (See Lecture Notes + on Geometric Robustness, Jonathan Richard Shewchuk, 1999). + + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The circumcentre of the triangle + + + + Computes the circumcentre of a triangle. The circumcentre is the centre of + the circumcircle, the smallest circle which encloses the triangle.It is + also the common intersection point of the perpendicular bisectors of the + sides of the triangle, and is the only point which has equal distance to + all three vertices of the triangle. + + The circumcentre does not necessarily lie within the triangle. For example, + the circumcentre of an obtuse isosceles triangle lies outside the triangle. + + This method uses extended-precision arithmetic to + provide more accurate results than + + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The circumcentre of the triangle + + + + Computes the determinant of a 2x2 matrix. Uses standard double-precision + arithmetic, so is susceptible to round-off error. + + the [0,0] entry of the matrix + the [0,1] entry of the matrix + the [1,0] entry of the matrix + the [1,1] entry of the matrix + The determinant + + + + Computes the incentre of a triangle. + + + The InCentre of a triangle is the point which is equidistant + from the sides of the triangle. + It is also the point at which the bisectors of the triangle's angles meet. + It is the centre of the triangle's InCircle, which is the unique circle + that is tangent to each of the triangle's three sides. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point which is the incentre of the triangle + + + Computes the centroid (centre of mass) of a triangle. + + This is also the point at which the triangle's three + medians intersect (a triangle median is the segment from a vertex of the triangle to the + midpoint of the opposite side). + The centroid divides each median in a ratio of 2:1. + The centroid always lies within the triangle. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The centroid of the triangle + + + + Compute the length of the perimeter of a triangle + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The length of the perimeter of the triangle + + + Computes the length of the longest side of a triangle + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The length of the longest side of the triangle + + + Computes the point at which the bisector of the angle ABC cuts the segment AC. + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The angle bisector cut point + + + + Computes the 2D area of a triangle. + The area value is always non-negative. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The area of the triangle + + + + + Computes the signed 2D area of a triangle. + + + + The area value is positive if the triangle is oriented CW, + and negative if it is oriented CCW. + + + The signed area value can be used to determine point orientation, but + the implementation in this method is susceptible to round-off errors. + Use for robust orientation + calculation. + + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The area of the triangle + + + + + + Computes the 3D area of a triangle. + The value computed is always non-negative. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The 3D area of the triangle + + + + Computes the Z-value (elevation) of an XY point + on a three-dimensional plane defined by a triangle + whose vertices have Z-values. + The defining triangle must not be degenerate + (in other words, the triangle must enclose a + non-zero area), + and must not be parallel to the Z-axis. + + This method can be used to interpolate + the Z-value of a point inside a triangle + (for example, of a TIN facet with elevations on the vertices). + + The point to compute the Z-value of + A vertex of a triangle, with a Z ordinate + A vertex of a triangle, with a Z ordinate + A vertex of a triangle, with a Z ordinate + The computed Z-value (elevation) of the point + + + + Creates a new triangle with the given vertices. + + A vertex + A vertex + A vertex + + + + Computes the InCentre of this triangle + + The InCentre of a triangle is the point which is equidistant + from the sides of the triangle. + This is also the point at which the bisectors of the angles meet. + It is the centre of the triangle's InCircle, + which is the unique circle that is tangent to each of the triangle's three sides. + + + The point which is the InCentre of the triangle. + + + + + Tests whether this triangle is acute. A triangle is acute if all interior + angles are acute. This is a strict test - right triangles will return + false A triangle which is not acute is either right or obtuse. + + Note: this implementation is not robust for angles very close to 90 + degrees. + + true if this triangle is acute + + + + Tests whether this triangle is oriented counter-clockwise. + + true if the triangle orientation is counter-clockwise + + + + Computes the circumcentre of this triangle. The circumcentre is the centre + of the circumcircle, the smallest circle which encloses the triangle. It is + also the common intersection point of the perpendicular bisectors of the + sides of the triangle, and is the only point which has equal distance to + all three vertices of the triangle. + + The circumcentre does not necessarily lie within the triangle. + + This method uses an algorithm due to J.R.Shewchuk which uses normalization + to the origin to improve the accuracy of computation. (See Lecture Notes + on Geometric Robustness, Jonathan Richard Shewchuk, 1999). + + The circumcentre of this triangle + + + + Computes the centroid (centre of mass) of this triangle. This is also the + point at which the triangle's three medians intersect (a triangle median is + the segment from a vertex of the triangle to the midpoint of the opposite + side). The centroid divides each median in a ratio of 2:1. + + The centroid always lies within the triangle. + + The centroid of this triangle + + + + Computes the length of the perimeter of this triangle. + + The length of the perimeter + + + + Computes the length of the longest side of this triangle + + The length of the longest side of this triangle + + + + Computes the 2D area of this triangle. The area value is always + non-negative. + + The area of this triangle + + + + + Computes the signed 2D area of this triangle. The area value is positive if + the triangle is oriented CW, and negative if it is oriented CCW. + + The signed area value can be used to determine point orientation, but the + implementation in this method is susceptible to round-off errors. Use + + for robust orientation calculation. + + The signed 2D area of this triangle + + + + + Computes the 3D area of this triangle. The value computed is always + non-negative. + + The 3D area of this triangle + + + + Computes the Z-value (elevation) of an XY point on a three-dimensional + plane defined by this triangle (whose vertices must have Z-values). This + triangle must not be degenerate (in other words, the triangle must enclose + a non-zero area), and must not be parallel to the Z-axis. + + This method can be used to interpolate the Z-value of a point inside this + triangle (for example, of a TIN facet with elevations on the vertices). + + The point to compute the Z-value of + The computed Z-value (elevation) of the point + + + + Represents an affine transformation on the 2D Cartesian plane. + + + + It can be used to transform a or . + An affine transformation is a mapping of the 2D plane into itself + via a series of transformations of the following basic types: +
    +
  • reflection (through a line)
  • +
  • rotation (around the origin)
  • +
  • scaling (relative to the origin)
  • +
  • shearing (in both the X and Y directions)
  • +
  • translation
  • +
+
+ + In general, affine transformations preserve straightness and parallel lines, + but do not preserve distance or shape. + + + An affine transformation can be represented by a 3x3 + matrix in the following form: +
+ T = | m00 m01 m02 |
+ | m10 m11 m12 |
+ | 0 0 1 | +
+ A coordinate P = (x, y) can be transformed to a new coordinate P' = (x', y') + by representing it as a 3x1 matrix and using matrix multiplication to compute: +
+ | x' | = T x | x |
+ | y' | | y |
+ | 1 | | 1 | +
+
+

Transformation Composition

+ + Affine transformations can be composed using the method. + Composition is computed via multiplication of the + transformation matrices, and is defined as: +
+            A.compose(B) = TB x TA
+            
+
+ + This produces a transformation whose effect is that of A followed by B. + The methods , , + , , and + have the effect of composing a transformation of that type with + the transformation they are invoked on. + The composition of transformations is in general not commutative. + +

Transformation Inversion

+ + Affine transformations may be invertible or non-invertible. + If a transformation is invertible, then there exists + an inverse transformation which when composed produces + the identity transformation. + The method + computes the inverse of a transformation, if one exists. + + + @author Martin Davis + +
+
+ + + Creates a transformation for a reflection about the + line (x0,y0) - (x1,y1). + + the x-ordinate of a point on the reflection line + the y-ordinate of a point on the reflection line + the x-ordinate of a another point on the reflection line + the y-ordinate of a another point on the reflection line + a transformation for the reflection + + + + Creates a transformation for a reflection about the + line (0,0) - (x,y). + + the x-ordinate of a point on the reflection line + the y-ordinate of a point on the reflection line + a transformation for the reflection + + + + Creates a transformation for a rotation + about the origin + by an angle theta. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the rotation angle, in radians + a transformation for the rotation + + + + Creates a transformation for a rotation + by an angle theta, + specified by the sine and cosine of the angle. + + + This allows providing exact values for sin(theta) and cos(theta) + for the common case of rotations of multiples of quarter-circles. + + the sine of the rotation angle + the cosine of the rotation angle + a transformation for the rotation + + + + Creates a transformation for a rotation + about the point (x,y) by an angle theta. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the rotation angle, in radians + the x-ordinate of the rotation point + the y-ordinate of the rotation point + a transformation for the rotation + + + + Creates a transformation for a rotation + about the point (x,y) by an angle theta, + specified by the sine and cosine of the angle. + + + This allows providing exact values for sin(theta) and cos(theta) + for the common case of rotations of multiples of quarter-circles. + + the sine of the rotation angle + the cosine of the rotation angle + the x-ordinate of the rotation point + the y-ordinate of the rotation point + a transformation for the rotation + + + + Creates a transformation for a scaling relative to the origin. + + the value to scale by in the x direction + the value to scale by in the y direction + a transformation for the scaling + + + + Creates a transformation for a scaling relative to the point (x,y). + + The value to scale by in the x direction + The value to scale by in the y direction + The x-ordinate of the point to scale around + The y-ordinate of the point to scale around + A transformation for the scaling + + + + Creates a transformation for a shear. + + the value to shear by in the x direction + the value to shear by in the y direction + a transformation for the shear + + + + Creates a transformation for a translation. + + the value to translate by in the x direction + the value to translate by in the y direction + a transformation for the translation + + + + Constructs a new identity transformation + + + + + Constructs a new transformation whose + matrix has the specified values. + + an array containing the 6 values { m00, m01, m02, m10, m11, m12 } + if matrix is null + if matrix is too small + + + + Constructs a new transformation whose + matrix has the specified values. + + the entry for the [0, 0] element in the transformation matrix + the entry for the [0, 1] element in the transformation matrix + the entry for the [0, 2] element in the transformation matrix + the entry for the [1, 0] element in the transformation matrix + the entry for the [1, 1] element in the transformation matrix + the entry for the [1, 2] element in the transformation matrix + + + + Constructs a transformation which is + a copy of the given one. + + the transformation to copy + + + + Constructs a transformation + which maps the given source + points into the given destination points. + + source point 0 + source point 1 + source point 2 + the mapped point for source point 0 + the mapped point for source point 1 + the mapped point for source point 2 + + + + Sets this transformation to be the identity transformation. + + + The identity transformation has the matrix: +
+ | 1 0 0 |
+ | 0 1 0 |
+ | 0 0 1 | +
+
+ this transformation, with an updated matrix +
+ + + Sets this transformation's matrix to have the given values. + + the entry for the [0, 0] element in the transformation matrix + the entry for the [0, 1] element in the transformation matrix + the entry for the [0, 2] element in the transformation matrix + the entry for the [1, 0] element in the transformation matrix + the entry for the [1, 1] element in the transformation matrix + the entry for the [1, 2] element in the transformation matrix + this transformation, with an updated matrix + + + + Sets this transformation to be a copy of the given one + + a transformation to copy + this transformation, with an updated matrix + + + + Gets an array containing the entries + of the transformation matrix. + + + Only the 6 non-trivial entries are returned, + in the sequence: +
+            m00, m01, m02, m10, m11, m12
+            
+
+ an array of length 6 +
+ + + Computes the determinant of the transformation matrix. + + + + The determinant is computed as: +
+ | m00 m01 m02 |
+ | m10 m11 m12 | = m00 * m11 - m01 * m10
+ | 0 0 1 | +
+
+ + If the determinant is zero, + the transform is singular (not invertible), + and operations which attempt to compute + an inverse will throw a . + +
+ the determinant of the transformation + + + The determinant of the transformation + +
+ + + Computes the inverse of this transformation, if one + exists. + + + + The inverse is the transformation which when + composed with this one produces the identity + transformation. + A transformation has an inverse if and only if it + is not singular (i.e. its + determinant is non-zero). + Geometrically, an transformation is non-invertible + if it maps the plane to a line or a point. + If no inverse exists this method + will throw a . + + + The matrix of the inverse is equal to the + inverse of the matrix for the transformation. + It is computed as follows: +
+ 1 + inverse(A) = --- x adjoint(A) + det + + + = 1 | m11 -m01 m01*m12-m02*m11 | + --- x | -m10 m00 -m00*m12+m10*m02 | + det | 0 0 m00*m11-m10*m01 | + + + + = | m11/det -m01/det m01*m12-m02*m11/det | + | -m10/det m00/det -m00*m12+m10*m02/det | + | 0 0 1 | +
+
+
+ A new inverse transformation + + +
+ + + Explicitly computes the math for a reflection. May not work. + + The x-ordinate of one point on the reflection line + The y-ordinate of one point on the reflection line + The x-ordinate of another point on the reflection line + The y-ordinate of another point on the reflection line + This transformation with an updated matrix + + + + Sets this transformation to be a reflection about the line defined by a line (x0,y0) - (x1,y1). + + The x-ordinate of one point on the reflection line + The y-ordinate of one point on the reflection line + The x-ordinate of another point on the reflection line + The y-ordinate of another point on the reflection line + This transformation with an updated matrix + + + + Sets this transformation to be a reflection + about the line defined by vector (x,y). + + + The transformation for a reflection + is computed by: +
+ d = sqrt(x2 + y2) + sin = x / d; + cos = x / d; + Tref = Trot(sin, cos) x Tscale(1, -1) x Trot(-sin, cos) +
+
+ the x-component of the reflection line vector + the y-component of the reflection line vector + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation around the orign. + + + A positive rotation angle corresponds + to a counter-clockwise rotation. + The transformation matrix for a rotation + by an angle theta + has the value: +
+            |  cos(theta)  -sin(theta)   0 |
+            |  sin(theta)   cos(theta)   0 |
+            |           0            0   1 |
+            
+
+ the rotation angle, in radians + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation around the origin + by specifying the sin and cos of the rotation angle directly. + + + The transformation matrix for the rotation + has the value: +
+            |  cosTheta  -sinTheta   0 |
+            |  sinTheta   cosTheta   0 |
+            |         0          0   1 |
+            
+
+ the sine of the rotation angle + the cosine of the rotation angle + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation + around a given point (x,y). + + + A positive rotation angle corresponds + to a counter-clockwise rotation. + The transformation matrix for a rotation + by an angle + has the value: +
+            |  cosTheta  -sinTheta   x-x*cos+y*sin |
+            |  sinTheta   cosTheta   y-x*sin-y*cos |
+            |           0            0   1 |
+            
+
+ the rotation angle, in radians + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation + around a given point (x,y) + by specifying the sin and cos of the rotation angle directly. + + + The transformation matrix for the rotation + has the value: +
+            |  cosTheta  -sinTheta   x-x*cos+y*sin |
+            |  sinTheta   cosTheta   y-x*sin-y*cos |
+            |         0          0         1       |
+            
+
+ the sine of the rotation angle + the cosine of the rotation angle + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix +
+ + + Sets this transformation to be a scaling. + + + The transformation matrix for a scale + has the value: +
+            |  xScale      0  dx |
+            |  0      yScale  dy |
+            |  0           0   1 |
+            
+
+ the amount to scale x-ordinates by + the amount to scale y-ordinates by + this transformation, with an updated matrix +
+ + + Sets this transformation to be a shear. + + + The transformation matrix for a shear + has the value: +
+            |  1      xShear  0 |
+            |  yShear      1  0 |
+            |  0           0  1 |
+            
+ Note that a shear of (1, 1) is not + equal to shear(1, 0) composed with shear(0, 1). + Instead, shear(1, 1) corresponds to a mapping onto the + line x = y. +
+ the x component to shear by + the y component to shear by + this transformation, with an updated matrix +
+ + + Sets this transformation to be a translation. + + + For a translation by the vector (x, y) + the transformation matrix has the value: +
+            |  1  0  dx |
+            |  1  0  dy |
+            |  0  0   1 |
+            
+
+ the x component to translate by + the y component to translate by + this transformation, with an updated matrix +
+ + + Updates the value of this transformation + to that of a reflection transformation composed + with the current value. + + the x-ordinate of a point on the line to reflect around + the y-ordinate of a point on the line to reflect around + the x-ordinate of a point on the line to reflect around + the y-ordinate of a point on the line to reflect around + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a reflection transformation composed + with the current value. + + the x-ordinate of the line to reflect around + the y-ordinate of the line to reflect around + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation transformation composed + with the current value. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the angle to rotate by in radians + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation around the origin composed + with the current value, + with the sin and cos of the rotation angle specified directly. + + the sine of the angle to rotate by + the cosine of the angle to rotate by + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation around a given point composed + with the current value. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the angle to rotate by, in radians + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation around a given point composed + with the current value, + with the sin and cos of the rotation angle specified directly. + + the sine of the angle to rotate by + the cosine of the angle to rotate by + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a scale transformation composed + with the current value. + + the value to scale by in the x direction + the value to scale by in the y direction + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a shear transformation composed + with the current value. + + the value to shear by in the x direction + the value to shear by in the y direction + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a translation transformation composed + with the current value. + + the value to translate by in the x direction + the value to translate by in the y direction + this transformation, with an updated matrix + + + + Updates this transformation to be + the composition of this transformation with the given . + + + This produces a transformation whose effect + is equal to applying this transformation + followed by the argument transformation. + Mathematically, +
+            A.compose(B) = TB x TA
+            
+
+ an affine transformation + this transformation, with an updated matrix +
+ + + Updates this transformation to be the composition + of a given with this transformation. + + + This produces a transformation whose effect + is equal to applying the argument transformation + followed by this transformation. + Mathematically, +
+            A.composeBefore(B) = TA x TB
+            
+
+ an affine transformation + this transformation, with an updated matrix +
+ + + Applies this transformation to the coordinate + and places the results in the coordinate + (which may be the same as the source). + + the coordinate to transform + the coordinate to accept the results + the dest coordinate + + + + + Creates a new which is the result of this transformation applied to the input Geometry. + + A Geometry + The transformed Geometry + + + + Applies this transformation to the i'th coordinate + in the given CoordinateSequence. + + a CoordinateSequence + the index of the coordinate to transform + + + + Transforms the i'th coordinate in the input sequence + + A CoordinateSequence + The index of the coordinate to transform + + + + Reports that this filter should continue to be executed until + all coordinates have been transformed. + + false + + + Tests if this transformation is the identity transformation. + + + + Tests if an object is an AffineTransformation and has the same matrix as this transformation. + + An object to test + true if the given object is equal to this object + + + + + + + Gets a text representation of this transformation. + The string is of the form: + + AffineTransformation[[m00, m01, m02], [m10, m11, m12]] + + + A string representing this transformation + + + + Clones this transformation + + A copy of this transformation + + + + Builds an defined by a set of control vectors. + + + + A control vector consists of a source point and a destination point, + which is the image of the source point under the desired transformation. + + + A transformation is well-defined + by a set of three control vectors + if and only if the source points are not collinear. + (In particular, the degenerate situation + where two or more source points are identical will not produce a well-defined transformation). + A well-defined transformation exists and is unique. + If the control vectors are not well-defined, the system of equations + defining the transformation matrix entries is not solvable, + and no transformation can be determined. + + No such restriction applies to the destination points. + However, if the destination points are collinear or non-unique, + a non-invertible transformations will be generated. + + + This technique of recovering a transformation + from its effect on known points is used in the Bilinear Interpolated Triangulation + algorithm for warping planar surfaces. + + + Martin Davis + + + + Constructs a new builder for the transformation defined by the given set of control point mappings. + + A control point + A control point + A control point + The image of under the required transformation + The image of under the required transformation + The image of under the required transformation + + + + Computes the + determined by the control point mappings, + or null if the control vectors do not determine a well-defined transformation. + + + An affine transformation, or if the control vectors do not + determine a well-defined transformation. + + + + + Computes the transformation matrix by + solving the two systems of linear equations + defined by the control point mappings, + if this is possible. + + True if the transformation matrix is solvable + + + + Solves the transformation matrix system of linear equations + for the given right-hand side vector. + + The vector for the right-hand side of the system + The solution vector, or if no solution could be determined. + + + + Supports creating s defined by various kinds of inputs and transformation mapping rules. + + Martin Davis + + + + Creates a transformation from a set of three control vectors. A control + vector consists of a source point and a destination point, which is the + image of the source point under the desired transformation. Three control + vectors allows defining a fully general affine transformation. + + + + + + + + The computed transformation + + + + Creates an AffineTransformation defined by a pair of control vectors. A + control vector consists of a source point and a destination point, which is + the image of the source point under the desired transformation. The + computed transformation is a combination of one or more of a uniform scale, + a rotation, and a translation (i.e. there is no shear component and no + reflection) + + + + + + The computed transformation + null if the control vectors do not determine a well-defined transformation + + + + Creates an AffineTransformation defined by a single control vector. A + control vector consists of a source point and a destination point, which is + the image of the source point under the desired transformation. This + produces a translation. + + The start point of the control vector + The end point of the control vector + The computed transformation + + + + Creates an AffineTransformation defined by a set of control vectors. + Between one and three vectors must be supplied. + + The source points of the vectors + The destination points of the vectors + The computed transformation + if the control vector arrays are too short, long or of different lengths + + + + Creates an AffineTransformation defined by a mapping between two baselines. + The computed transformation consists of: + + a translation from the start point of the source baseline to the start point of the destination baseline, + a rotation through the angle between the baselines about the destination start point, + and a scaling equal to the ratio of the baseline lengths. + + If the source baseline has zero length, an identity transformation is returned. + + The start point of the source baseline + The end point of the source baseline + The start point of the destination baseline + The end point of the destination baseline + + + + + Extracts a representative + from each connected component of a . + + 1.9 + + + + Extracts a representative + from each connected component in a geometry. + + If more than one geometry is to be processed, it is more + efficient to create a single + instance and pass it to each geometry. + + The Geometry from which to extract + A list of representative Coordinates + + + + Constructs a LineExtracterFilter with a list in which to store LineStrings found. + + + + + Utility to combine just the s of a list of geometries. + + + + + Gets the smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + The list of input geometries. + + + The smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + + + Gets the smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + The list of input geometries. + + + The smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + + + Initializes a new instance of the class. + + + The instances to combine. + + + + + Initializes a new instance of the class. + + + The instances to combine. + + + + + Gets the smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + The smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + + + Maps the members of a + into another GeometryCollection via a defined + mapping function. + + Martin Davis + + + + + + + + + + + + Creates an instance of this class + + + + + + + + + + + + + Combines s to produce a of the most appropriate type. + + + Input geometries which are already collections will have their elements extracted first. + No validation of the result geometry is performed. + (The only case where invalidity is possible is where geometries are combined and result in a self-intersection). + + mbdavis + + + + Combines a collection of geometries. + The geometries to combine + The combined geometry + + + + Combines two geometries. + + A geometry to combine + A geometry to combine + The combined geometry + + + + Combines three geometries. + + A geometry to combine + A geometry to combine + A geometry to combine + The combined geometry + + + + Creates a list from two items + + + + A list from two geometries + + + + Creates a list from three items + + + + + A list from three geometries + + + + Value indicating whether empty geometries should be skipped + + + + + Creates a new combiner for a collection of geometries + + The geometries to combine + + + + Extracts the GeometryFactory used by the geometries in a collection + + + a GeometryFactory + + + + Computes the combination of the input geometries to produce the most appropriate or + + A Geometry which is the combination of the inputs + + + + + A class which supports creating new s + which are modifications of existing ones, + maintaining the same type structure. + + + Geometry objects are intended to be treated as immutable. + This class allows you to "modifies" a Geometrys + by traversing them, applying a user-defined + , or + and creating a new Geometrys with the same structure but + (possibly) modified components. + + Examples of the kinds of modifications which can be made are: + + + The values of the coordinates may be changed. + The editor does not check whether changing coordinate values makes the result Geometry invalid + + + The coordinate lists may be changed (e.g. by adding, deleting or modifying coordinates). + The modified coordinate lists must be consistent with their original parent component + (e.g. a LinearRing must always have at least 4 coordinates, and the first and last + coordinate must be equal). + + + Components of the original point may be deleted + (e.g. holes may be removed from a Polygon, or LineStrings removed from a MultiLineString). + Deletions will be propagated up the component tree appropriately. + + + + All changes must be consistent with the original Geometry's structure + (e.g. a Polygon cannot be collapsed into a LineString). + If changing the structure is required, use a . + + + This class supports creating an edited Geometry + using a different via the + constructor. + Examples of situations where this is required is if the geometry is + transformed to a new SRID and/or a new PrecisionModel. + + Usage notes + + The resulting Geometry is not checked for validity. + If validity needs to be enforced, the new Geometry's + method should be called. + By default the UserData of the input geometry is not copied to the result. + + + + + + + + + The factory used to create the modified Geometry. + + + If null the GeometryFactory of the input is used. + + + + + Creates a new GeometryEditor object which will create + edited with the same as the input Geometry. + + + + + Creates a new GeometryEditor object which will create + edited s with the given . + + The GeometryFactory to create the edited Geometry with. + + + + Gets or sets a value indicating if the User Data is copied to the edit result. + If so, only the object reference is copied. + + + + + Edit the input Geometry with the given edit operation. + Clients can create subclasses of GeometryEditorOperation or + CoordinateOperation to perform required modifications. + + The Geometry to edit. + The edit operation to carry out. + A new Geometry which is the result of the editing (which may be empty). + + + + A interface which specifies an edit operation for Geometries. + + + + + Edits a Geometry by returning a new Geometry with a modification. + The returned Geometry may be the input geometry itself. + It may be null if the geometry is to be deleted. + + The Geometry to modify. + + The factory with which to construct the modified Geometry + (may be different to the factory of the input point). + + A new Geometry which is a modification of the input Geometry. + null if the Geometry is to be deleted completely + + + + A GeometryEditorOperation which does not modify + the input geometry. + This can be used for simple changes of + (including PrecisionModel and SRID). + + mbdavis + + + + A GeometryEditorOperation which edits the coordinate list of a Geometry. + Operates on Geometry subclasses which contains a single coordinate list. + + + + + + + + + + + + + Edits the array of Coordinates from a Geometry. + + The coordinate array to operate on. + The point containing the coordinate list. + An edited coordinate array (which may be the same as the input). + + + + A which edits the + of a . + + Operates on Geometry subclasses which contains a single coordinate list. + + + + An edited coordinate sequence (which may be the same as the input) + + + + Extracts the components of a given type from a . + + + + + Extracts the T components from an and adds them to the provided . + + the geometry from which to extract + the list to add the extracted elements to + The geometry type to extract + + + + Extracts the T elements from a single and returns them in a . + + the geometry from which to extract + + + + Extracts the components of geometryType from a + + The geometry from which to extract + Geometry type to extract (null or all white-space means all types) + + + + Extracts the components of geometryType from a + and adds them to the provided + + The geometry from which to extract + Geometry type to extract (null or all white-space means all types) + The list to add the extracted elements to + + + + Extracts the components of type T from a . + + + + + Constructs a filter with a list in which to store the elements found. + + Geometry type to extract (null means all types) + The list to extract into + + + + Y + + + + + + + + + + + Extracts the components of type T from a . + + + + + Constructs a filter with a list in which to store the elements found. + + The list to extract into + + + + Fixes a geometry to be a valid geometry, while preserving as much as + possible of the shape and location of the input. + Validity is determined according to . + + Input geometries are always processed, so even valid inputs may + have some minor alterations.The output is always a new geometry object. +

Semantic Rules

+ + Vertices with non-finite X or Y ordinates are removed (as per ) + Repeated points are reduced to a single point + Empty atomic geometries are valid and are returned unchanged + Empty elements are removed from collections + Point: keep valid coordinate, or EMPTY + LineString: coordinates are fixed + LinearRing: coordinates are feixed, keep valid ring or else convert into LineString + Polygon: transform into a valid polygon, + preserving as much of the extent and vertices as possible. + + Rings are fixed to ensure they are valid + Holes intersection the shell are subtracted from the shell + Holes outside the shell are converted into polygons + + MultiPolygon: each polygon is fixed, + then result made non - overlapping (via union) + GeometryCollection: each element is fixed + Collapsed lines and polygons are handled as follows, + depending on the keepCollapsed setting: + + false: (default) collapses are converted to empty geometries + (and removed if they are elements of collections) + true: collapses are converted to a valid geometry of lower dimension + + +
+ Martin Davis + +
+ + + Fixes a geometry to be valid. + + The geometry to be fixed + The valid fixed geometry + + + + Fixes a geometry to be valid, allowing to set a flag controlling how + single item results from fixed MULTI geometries should be + returned. + + The geometry to be fixed + A flag indicating if MULTI geometries should not + be converted to single instance types if they consist of only one item. + The valid fixed geometry + + + Creates a new instance to fix a given geometry + The geometry to be fixed + + + + Gets or sets a value indicating whether collapsed + geometries are converted to empty, + (which will be removed from collections), + or to a valid geometry of lower dimension. + The default is to convert collapses to empty geometries (false). + + + + + Gets or sets a value indicating whether collapsed + geometries are converted to empty, + (which will be removed from collections), + or to a valid geometry of lower dimension. + The default is to convert collapses to empty geometries (false). + + + + + Gets the fixed geometry. + + The fixed geometry + + + + Returns a clean copy of the input coordinate array. + + Coordinates to clean + An array of clean coordinates + + + Subtracts a list of polygonal geometries from a polygonal geometry. + polygonal geometry for shell + polygonal geometries for holes + The result geometry + + + + Unions a list of polygonal geometries. + Optimizes case of zero or one input geometries. + Requires that the inputs are net new objects. + + The polygonal geometries to union + The union of the inputs + + + + Methods to map various collections + of s + via defined mapping functions. + + Martin Davis + + + + Maps the members of a + (which may be atomic or composite) + into another Geometry of most specific type. + null results are skipped. + In the case of hierarchical s, + only the first level of members are mapped. + + The input atomic or composite geometry + The mapping operation delegate + A result collection or geometry of most specific type + + + + Maps the members of a + (which may be atomic or composite) + into another Geometry of most specific type. + null results are skipped. + In the case of hierarchical s, + only the first level of members are mapped. + + The input atomic or composite geometry + The mapping operation + A result collection or geometry of most specific type + + + + Maps the atomic elements of a + (which may be atomic or composite) + using a mapping operation + into an atomic Geometry or a flat collection + of the most specific type. + null and empty values returned from the mapping operation + are discarded. + + The geometry to map + The dimension of empy geometry to create + The mapping operation + The mapped result + + + + An interface for geometry functions used for mapping. + + Martin Davis + + + + Computes a new geometry value. + + The input geometry + A result geometry + + + + Standard implementation of a geometry mapping + + + + + Creates an instance of this class using the provided mapping operation function + + A mapping operation function + + + + Computes a new geometry value. + + The input geometry + A result geometry + + + + A framework for processes which transform an input Geometry into + an output , possibly changing its structure and type(s). + + + + This class is a framework for implementing subclasses + which perform transformations on + various different Geometry subclasses. + + + It provides an easy way of applying specific transformations + to given point types, while allowing unhandled types to be simply copied. + Also, the framework handles ensuring that if subcomponents change type + the parent geometries types change appropriately to maintain valid structure. + Subclasses will override whichever TransformX methods + they need to to handle particular Geometry types. + + + A typically usage would be a transformation that may transform Polygons into + Polygons, LineStrings or Points, depending on the geometry of the input + (For instance, a simplification operation). + This class would likely need to override the + method to ensure that if input Polygons change type the result is a GeometryCollection, + not a MultiPolygon. + + The default behaviour of this class is simply to recursively transform + each Geometry component into an identical object by deep copying down + to the level of, but not including, coordinates. + + + Note that all TransformXXX methods may return null, + to avoid creating empty point objects. This will be handled correctly + by the transformer. TransformXXX methods should always return valid + geometry - if they cannot do this they should return null + (for instance, it may not be possible for a transformLineString implementation + to return at least two points - in this case, it should return null). + The method itself will always + return a non-null Geometry object (but this may be empty). + > + + + + The geometry factory + + + + + true if empty geometries should not be included in the result. + + + + + true if a homogenous collection result + from a GeometryCollection should still + be a general GeometryCollection. + + + + + true if the type of the input should be preserved. + + + + + Makes the input geometry available + + + + + + + + + + + + Convenience method which provides standard way of + creating a CoordinateSequence. + + The coordinate array to copy. + A coordinate sequence for the array. + + + + Convenience method which provides a standard way of copying s. + + The sequence to copy. + A deep copy of the sequence. + + + + Transforms a . + This method should always return a valid coordinate list for + the desired result type. (E.g. a coordinate list for a LineString + must have 0 or at least 2 points). + If this is not possible, return an empty sequence - + this will be pruned out. + + The coordinates to transform + The parent geometry + The transformed coordinates + + + + Transforms a geometry. + + The Point to transform + The parent geometry + A Point + + + + Transforms a geometry. + + The MultiPoint to transform + The parent geometry + A MultiPoint + + + + Transforms a . + + The transformation of a LinearRing may result in a coordinate sequence + which does not form a structurally valid ring (i.e. a degenerate ring of 3 or fewer points). + In this case a LineString is returned. + Subclasses may wish to override this method and check for this situation + (e.g.a subclass may choose to eliminate degenerate linear rings) + + The LinearRing to transform + The parent geometry + + A LinearRing if the transformation resulted in a structurally valid ring, otherwise, + if the transformation caused the LinearRing to collapse to 3 or fewer points, a LineString + + + + + Transforms a geometry. + + The LineString to transform + The parent geometry + A LineString + + + + Transforms a geometry. + + The MultiLineString to transform + The parent geometry + A MultiLineString + + + + Transforms a geometry. + + The Polygon to transform + The parent geometry + A Polygon + + + + Transforms a geometry. + + The MultiPolygon to transform + The parent geometry + A MultiPolygon + + + + Transforms a geometry. + + The GeometryCollection to transform + The parent geometry + A GeometryCollection + + + + Extracts all the 1-dimensional () components from a . + For polygonal geometries, this will extract all the component s. + If desired, s can be forced to be returned as s. + + + + + Extracts the linear components from a + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a single + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a single + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a single point. + If more than one point is to be processed, it is more + efficient to create a single LineExtracterFilter instance + and pass it to multiple geometries. + + The point from which to extract linear components. + The list of linear components. + + + + Extracts the linear components from a single geometry. + If more than one geometry is to be processed, it is more + efficient to create a single instance + and pass it to multiple geometries. + + The geometry from which to extract linear components + true if s should be converted to s + The list of linear components + + + + Extracts the linear components from a single + and returns them as either a or . + + The geometry from which to extract + A linear geometry + + + + Extracts the linear components from a single + and returns them as either a or . + + The geometry from which to extract + true if s should be converted to s + A linear geometry + + + + Constructs a LineExtracterFilter with a list in which to store LineStrings found. + + + + + + Constructs a LineExtracterFilter with a list in which to store LineStrings found. + + + + + + + + + + + + + + + + + + Extracts all the elements from a . + + + + + + Extracts the elements from a single + and adds them to the. + + The geometry from which to extract + The list to add the extracted elements to + The list argument + + + + Extracts the elements from a single + and returns them in a . + + The geometry from which to extract + A list containing the linear elements + + + + Extracts the elements from a single + and returns them as either a or . + + The geometry from which to extract + A linear geometry + + + + Constructs a filter with a list in which to store the elements found. + + + + + Implements some 2D matrix operations (in particular, solving systems of linear equations). + + Martin Davis + + + + Solves a system of equations using Gaussian Elimination.
+ In order to avoid overhead the algorithm runs in-place + on A - if A should not be modified the client must supply a copy. +
+ A an nxn matrix in row/column order )modified by this method) + A vector of length n + if the matrix is the wrong size + + + A vector containing the solution (if any) + null if the system has no or no unique solution + + +
+ + + Indicates that an is non-invertible. + + Martin Davis + + + + Extracts all the 0-dimensional (Point) components from a Geometry. + + + + + + Extracts the elements from a single and adds them to the provided . + + The geometry from which to extract + The list to add the extracted elements to + + + + + Extracts the elements from a single and returns them in a . + + the geometry from which to extract + + + + Constructs a PointExtracterFilter with a list in which to store Points found. + + + + + + + + + + + + Extracts all the elements from a . + + + + + + Extracts the elements from a single and adds them to the provided . + + The geometry from which to extract + The list to add the extracted elements to + + + + + Extracts the elements from a single and returns them in a . + + The geometry from which to extract + + + + Constructs a PolygonExtracterFilter with a list in which to store Polygons found. + + + + + + + + + + + + A visitor to elements which components, which + allows short-circuiting when a defined condition holds. + + + + + + + + + + + + + + + + + Reports whether visiting components can be terminated. + Once this method returns , it must + continue to return on every subsequent call. + + + if visiting can be terminated. + + + + + Creates geometries which are shaped like multi-armed stars with each arm shaped like a sine wave. + These kinds of geometries are useful as a more complex geometry for testing algorithms. + + + Martin Davis + + + + + Creates a sine star with the given parameters. + + The origin point. + The size of the star. + The number of points in the star. + The number of arms to generate. + The arm length ratio. + A sine star shape. + + + + Creates a factory which will create sine stars using the default + + + + + Creates a factory which will create sine stars using the given + + The factory to use + + + Gets/Sets the number of arms in the star + + + + Gets or sets the ratio of the length of each arm to the radius of the star. + A smaller number makes the arms shorter. + + Value should be between 0.0 and 1.0 + + + + Generates the geometry for the sine star + + The geometry representing the sine star + + + + Builds an array of all visited items. + + + + + Builds an array of all visited items. + + + + + Visits an item. + + The item to visit. + + + + Gets the array of visited items. + + + + + An BinTree (or "Binary Interval Tree") + is a 1-dimensional version of a quadtree. + It indexes 1-dimensional intervals (which may + be the projection of 2-D objects on an axis). + It supports range searching + (where the range may be a single point). + + + + This structure is dynamic - + new items can be added at any time, + and it will support deletion of items + (although this is not currently implemented). + + + This implementation does not require specifying the extent of the inserted + items beforehand. It will automatically expand to accommodate any extent + of dataset. + This index is different to the Interval Tree of Edelsbrunner + or the Segment Tree of Bentley. + + + + + Ensure that the Interval for the inserted item has non-zero extents. + Use the current minExtent to pad it, if necessary. + + + + + + + + + + + + + + + + + + + + Compute the total number of nodes in the tree. + + The number of nodes in the tree. + + + + + + + + + + + Removes a single item from the tree. + + itemEnv the Envelope of the item to be removed + the item to remove + true if the item was found (and thus removed) + + + + + + + + + + + + + + + + + Queries the tree to find all candidate items which + may overlap the query interval. + If the query interval is null, all items in the tree are found. + min and max may be the same value. + + The interval to query for or null + + + + Adds items in the tree which potentially overlap the query interval + to the given collection. + If the query interval is null, add all items in the tree. + + A query interval, or null + The candidate items found + + + + + + + + + + Represents an (1-dimensional) closed interval on the Real number line. + + + + + Gets or sets a value indicating the minimum value of the closed interval. + + + + + Gets or sets a value indicating the maximum value of the closed interval. + + + + + Gets the width of the interval ( - ) + + + + + Gets the centre of the interval ( + * 0.5d) + + + + + Creates a new interval instance, setting ==0d; + + + + + Creates a new interval instance, setting = and =; + + The minimum value + The maximum value + + + + Creates a new interval instance, setting = and =. + + + + + + Method to initialize the interval with the given and values.
+ If < , their values are exchanged. +
+ The minimum value + The maximum value +
+ + + Method to expand this interval to contain . + + The interval to contain. + + + + Function to test if this overlaps . + + The interval to test + true if this interval overlaps + + + + Function to test if this overlaps the interval R[, ]. + + The mimimum value of the interval + The maximum value of the interval + true if this interval overlaps the interval R[, ] + + + + Function to test if this contains . + + This is more rigid than + The interval to test + true if this interval contains + + + + Function to test if this contains the interval R[, ]. + + This is more rigid than + The mimimum value of the interval + The maximum value of the interval + true if this interval contains the interval R[, ] + + + + Function to test if this contains the value . + + The value to test + true if this interval contains the value + + + + A Key is a unique identifier for a node in a tree. + It contains a lower-left point and a level number. The level number + is the power of two for the size of the node envelope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return a square envelope containing the argument envelope, + whose extent is a power of two and which is based at a power of 2. + + + + + + + + + + + + + A node of a Bintree. + + + + + Creates a node + + The interval of the node item + A new node + + + + Creates a larger node, that contains both and + If is null, a node for is created. + + The original node + The additional interval + A new node + + + + Creates a new node instance + + The node's interval + The node's level + + + + Gets the node's + + + + + + + + + + + + Returns the subnode containing the envelope. + Creates the node if + it does not already exist. + + + + + + Returns the smallest existing + node containing the envelope. + + + + + + + + + + + + Get the subnode for the index. + If it doesn't exist, create it. + + + + + + + + + + + + The base class for nodes in a Bintree. + + + + + Returns the index of the subnode that wholely contains the given interval. + If none does, returns -1. + + + + + + + + + + + + Subnodes are numbered as follows: + 0 | 1 + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adds items in the tree which potentially overlap the query interval + to the given collection. + If the query interval is null, add all items in the tree. + + A query interval, or null + The candidate items found + + + + Removes a single item from this subtree. + + The envelope containing the item + The item to remove + true if the item was found and removed + + + + Gets whether this node is prunable + + + + + Gets whether this node has any children + + + + + + + + + + Gets whether this node has any subnodes + + + + + + + + + + + + + + + The root node of a single Bintree. + It is centred at the origin, + and does not have a defined extent. + + + + + Insert an item into the tree this is the root of. + + + + + + + Insert an item which is known to be contained in the tree rooted at + the given Node. Lower levels of the tree will be created + if necessary to hold the item. + + + + + + + + The root node matches all searches. + + + + + + MonotoneChains are a way of partitioning the segments of a linestring to + allow for fast searching of intersections. + + + + They have the following properties: + + the segments within a monotone chain never intersect each other + the envelope of any contiguous subset of the segments in a monotone chain + is equal to the envelope of the endpoints of the subset. + + + + Property 1 means that there is no need to test pairs of segments from within + the same monotone chain for intersection. + Property 2 allows an efficient + binary search to be used to find the intersection points of two monotone chains. + For many types of real-world data, these properties eliminate a large number of + segment comparisons, producing substantial speed gains. + + One of the goals of this implementation of MonotoneChains is to be + as space and time efficient as possible. One design choice that aids this + is that a MonotoneChain is based on a subarray of a list of points. + This means that new arrays of points (potentially very large) do not + have to be allocated. + + MonotoneChains support the following kinds of queries: + + Envelope selectdetermine all the segments in the chain which + intersect a given envelope. + Overlapdetermine all the pairs of segments in two chains whose + envelopes overlap. + + + + This implementation of MonotoneChains uses the concept of internal iterators + ( and ) + to return the resultsets for the above queries. + This has time and space advantages, since it + is not necessary to build lists of instantiated objects to represent the segments + returned by the query. + Queries made in this manner are thread-safe. + + + MonotoneChains support being assigned an integer id value + to provide a total ordering for a set of chains. + This can be used during some kinds of processing to + avoid redundant comparisons + (i.e.by comparing only chains where the first id is less than the second). + + + MonotoneChains support using an tolerance distance for overlap tests. + This allows reporting overlap in situations where + intersection snapping is being used. + If this is used the chain envelope must be computed + providing an expansion distance using . + + + + + + Creates a new MonotoneChain based on the given array of points. + + The points containing the chain + The index of the first coordinate in the chain + The index of the last coordinate in the chain + A user-defined data object + + + + Gets or sets the Id of this chain + + + Useful for assigning an ordering to a set of + chains, which can be used to avoid redundant processing. + + + + + Gets or sets the overlap distance used in overlap tests + with other chains. + + + + + Gets the chain's user-defined context data value. + + + + + Gets the envelope of this chain + + + + + Gets the envelope for this chain, + expanded by a given distance. + + Distance to expand the envelope by + The expanded envelope of the chain + + + + Gets the index of the start of the monotone chain + in the underlying array of points. + + + + + Gets the index of the end of the monotone chain + in the underlying array of points. + + + + + Gets the line segment starting at + + The index of the segment + The line segment to extract to + + + + Return the subsequence of coordinates forming this chain. + Allocates a new array to hold the Coordinates. + + + + + Determine all the line segments in the chain whose envelopes overlap + the searchEnvelope, and process them. + + + The monotone chain search algorithm attempts to optimize + performance by not calling the select action on chain segments + which it can determine are not in the search envelope. + However, it *may* call the select action on segments + which do not intersect the search envelope. + This saves on the overhead of checking envelope intersection + each time, since clients may be able to do this more efficiently. + + The search envelope + The select action to execute on selected segments + + + + + + + + + + + + + Determines the line segments in two chains which may overlap, + and passes them to an overlap action. + + + The monotone chain search algorithm attempts to optimize + performance by not calling the overlap action on chain segments + which it can determine do not overlap. + However, it* may* call the overlap action on segments + which do not actually interact. + This saves on the overhead of checking intersection + each time, since clients may be able to do this more efficiently. + + The chain to compare to + The overlap action to execute on selected segments + + + + Determines the line segments in two chains which may overlap, + using an overlap distance tolerance, + and passes them to an overlap action. + + The chain to compare to + The overlap tolerance distance (may be 0) + The overlap action to execute on selected segments + + + + Uses an efficient mutual binary search strategy + to determine which pairs of chain segments + may overlap, and calls the given overlap action on them. + + The start index of this chain section + The end index of this chain section + The target monotone chain + The start index of the target chain section + The end index of the target chain section + The overlap tolerance distance (may be 0) + The overlap action to execute on selected segments + + + + Tests whether the envelope of a section of the chain + overlaps(intersects) the envelope of a section of another target chain. + This test is efficient due to the monotonicity property + of the sections(i.e.the envelopes can be are determined + from the section endpoints + rather than a full scan). + + The start index of this chain section + The end index of this chain section + The target monotone chain + The start index of the target chain section + The end index of the target chain section + The overlap tolerance distance (may be 0) + true if the section envelopes overlap + + + The 1st coordinate of the 1st segment + The 2nd coordinate of the 1st segment + The 1st coordinate of the 2nd segment + The 2nd coordinate of the 2nd segment + The overlap tolerance distance (may be 0) + + + + Constructs s + for sequences of s. + + + + + Only static methods! + + + + + Computes a list of the s + for a list of coordinates. + + The list of points to compute chains for + A list of the monotone chains for the points + + + + Return a list of the MonotoneChains + for the given list of coordinates. + + The list of points to compute chains for + A data object to attach to each chain + A list of the monotone chains for the points + + + + Return an array containing lists of start/end indexes of the monotone chains + for the given list of coordinates. + The last entry in the array points to the end point of the point array, + for use as a sentinel. + + + + + + Finds the index of the last point in a monotone chain + starting at a given point. + Any repeated points (0-length segments) will be included + in the monotone chain returned. + + The coordinates + The start index + + The index of the last point in the monotone chain starting at start. + + + + + The action for the internal iterator for performing + overlap queries on a MonotoneChain. + + + + + + + + + + + + + + + This function can be overridden if the original chains are needed. + + + The index of the start of the overlapping segment from mc1. + + The index of the start of the overlapping segment from mc2. + + + + This is a convenience function which can be overridden to obtain the actual + line segments which overlap. + + + + + + + The action for the internal iterator for performing + envelope select queries on a MonotoneChain. + + + + + + + + + + This method is overridden to process a segment + in the context of the parent chain. + + The parent chain + The index of the start vertex of the segment being processed + + + + This is a convenience method which can be overridden to obtain the actual + line segment which is selected. + + + + + + A Hilbert-Packed R-tree. This is a static R-tree + which is packed by using the Hilbert ordering + of the tree items. + + The tree is constructed by sorting the items + by the Hilbert code of the midpoint of their envelope. + Then, a set of internal layers is created recursively + as follows: + + The items/nodes of the previous are partitioned into blocks of size nodeCapacity + For each block a layer node is created with range equal to the envelope of the items/nodess in the block + + The internal layers are stored using an array to + store the node bounds. + The link between a node and its children is + stored implicitly in the indexes of the array. + For efficiency, the offsets to the layers + within the node array are pre-computed and stored. + + NOTE: Based on performance testing, + the HPRtree is somewhat faster than the STRtree. + It should also be more memory-efficent, + due to fewer object allocations. + + However, it is not clear whether this + will produce a significant improvement + for use in JTS operations. + + + Martin Davis + + + + Creates a new index with the default node capacity. + + + + + Creates a new index with the given node capacity. + + The node capacity to use + + + Gets the number of items in the index. + The number of items + + + + + + + + + + + + + Tests whether two envelopes intersect. + Avoids the null check in . + An envelope + An envelope + true if the envelopes intersect + + + + Not supported, will always return false + + + + Builds the index, if not already built. + + + + + Computes the number of blocks (nodes) required to + cover a given number of children. + + + + the number of nodes needed to cover the children + + + + Gets the extents of the internal index nodes + + A list of the internal node extents + + + + This property is named Item in JTS + + + + + + + + A visitor for nodes and items in an index. + + + + + + + + + + + A visitor for items in a . + + + + + Visits an item in the index. + + The index item to be visited. + + + + A visitor for items in a + Not used, commited by accident! + + The type of the items in the index + [Obsolete] + + + + Gets a value indicating if no more items need to be visited + + + + + + + + A static index on a set of 1-dimensional intervals, + using an R-Tree packed based on the order of the interval midpoints. + + + It supports range searching, + where the range is an interval of the real line (which may be a single point). + A common use is to index 1-dimensional intervals which + are the projection of 2-D objects onto an axis of the coordinate system. + + This index structure is static + - items cannot be added or removed once the first query has been made. + The advantage of this characteristic is that the index performance + can be optimized based on a fixed set of items. + + Martin Davis + + + + + If root is null that indicates + that the tree has not yet been built, + OR nothing has been added to the tree. + In both cases, the tree is still open for insertions. + + + + + Adds an item to the index which is associated with the given interval + + The lower bound of the item interval + The upper bound of the item interval + The item to insert + if the index has already been queried + + + + Search for intervals in the index which intersect the given closed interval + and apply the visitor to them. + + The lower bound of the query interval + The upper bound of the query interval + The visitor to pass any matched items to + + + + The basic insertion and query operations supported by classes + implementing spatial index algorithms. + A spatial index typically provides a primary filter for range rectangle queries. A + secondary filter is required to test for exact intersection. Of course, this + secondary filter may consist of other tests besides intersection, such as + testing other kinds of spatial relationships. + + + + + Adds a spatial item with an extent specified by the given Envelope to the index. + + + + + Queries the index for all items whose extents intersect the given search Envelope + Note that some kinds of indexes may also return objects which do not in fact + intersect the query envelope. + + The envelope to query for. + A list of the items found by the query. + + + + Queries the index for all items whose extents intersect the given search , + and applies an to them. + Note that some kinds of indexes may also return objects which do not in fact + intersect the query envelope. + + The envelope to query for. + A visitor object to apply to the items found. + + + + Removes a single item from the tree. + + The Envelope of the item to remove. + The item to remove. + true if the item was found. + + + + A visitor for s in a index. + + 1.7 + + + + Visits a node. + + The node to visit + + + + A node of a , which represents one or more points in the same location. + + The type of the object + dskea + + + + Creates a new KdNode. + + coordinate of point + coordinate of point + A data objects to associate with this node + + + + Creates a new KdNode. + + The point location of new node + A data objects to associate with this node + + + + Gets x-ordinate of this node + + The x-ordinate + + + + Gets y-ordinate of this node + + The y-ordinate + + + + Gets the split value at a node, depending on + whether the node splits on X or Y. + The X (or Y) ordinates of all points in the left subtree + are less than the split value, and those + in the right subtree are greater than or equal to the split value. + + A flag whether the node splits a X or Y + The splitting value + + + + Gets the location of this node + + The Coordinate + + + + Gets the user data object associated with this node. + + The user data + + + + Gets or sets the left node of the tree + + The left node + + + + Gets or sets the right node of the tree + + The right node + + + + Gets the number of inserted points that are coincident at this location. + + + + + Gets whether more than one point with this value have been inserted (up to the tolerance) + + + + + + Tests whether the node's left subtree may contain values + in a given range envelope. + + A flag whether the node splits on X or Y + The range envelope + true if the left subtree is in range + + + + Tests whether the node's right subtree may contain values + in a given range envelope. + + A flag whether the node splits on X or Y + The range envelope + trueif the right subtree is in range + + + + Tests whether a point is strictly to the left + of the splitting plane for this node. + If so it may be in the left subtree of this node, + Otherwise, the point may be in the right subtree. + The point is to the left if its X (or Y) ordinate + is less than the split value. + + A flag whether the node splits on X or Y + The query point + true if the point is strictly to the left. + + + + + An implementation of a + KD - Tree + over two dimensions(X and Y). + KD-trees provide fast range searching and fast lookup for point data. + The tree is built dynamically by inserting points. + The tree supports queries by range and for point equality. + For querying an internal stack is used instead of recursion to avoid overflow. + + + This implementation supports detecting and snapping points which are closer + than a given distance tolerance. + If the same point (up to tolerance) is inserted + more than once , it is snapped to the existing node. + In other words, if a point is inserted which lies + within the tolerance of a node already in the index, + it is snapped to that node. + When an inserted point is snapped to a node then a new node is not created + but the count of the existing node is incremented. + If more than one node in the tree is within tolerance of an inserted point, + the closest and then lowest node is snapped to. + + The structure of a KD-Tree depends on the order of insertion of the points. + A tree may become umbalanced if the inserted points are coherent + (e.g.monotonic in one or both dimensions). + A perfectly balanced tree has depth of only log2(N), + but an umbalanced tree may be much deeper. + This has a serious impact on query efficiency. + One solution to this is to randomize the order of points before insertion + (e.g. by using Fisher - Yates shuffling). + + The type of the user data object + David Skea + Martin Davis + + + + Converts a collection of s to an array of s. + + A collection of nodes + An array of the coordinates represented by the nodes + + + + Converts a collection of {@link KdNode}s + to an array of s, + specifying whether repeated nodes should be represented + by multiple coordinates. + + a collection of nodes + true if repeated nodes should + be included multiple times + An array of the coordinates represented by the nodes + + + + Creates a new instance of a KdTree with a snapping tolerance of 0.0. + (I.e. distinct points will not be snapped) + + + + + Creates a new instance of a KdTree with a snapping distance + tolerance. Points which lie closer than the tolerance to a point already + in the tree will be treated as identical to the existing point. + + The tolerance distance for considering two points equal + + + + Tests whether the index contains any items. + + + + + Gets a value indicating the root node of the tree + + The root node of the tree + + + + Inserts a new point in the kd-tree, with no data. + + The point to insert + The kdnode containing the point + + + + Inserts a new point into the kd-tree. + + The point to insert + A data item for the point + + A new KdNode if a new point is inserted, else an existing + node is returned with its counter incremented. This can be checked + by testing returnedNode.getCount() > 1. + + + + + Finds the node in the tree which is the best match for a point + being inserted. + The match is made deterministic by returning the lowest of any nodes which + lie the same distance from the point. + There may be no match if the point is not within the distance tolerance of any + existing node. + + The point being inserted + + + the best matching node + null if no match was found + + + + + + Inserts a point known to be beyond the distance tolerance of any existing node. + The point is inserted at the bottom of the exact splitting path, + so that tree shape is deterministic. + + The point to insert + The data associated with + + + The data for the point + The created node + + + + + + Performs a range search of the points in the index and visits all nodes found. + + The range rectangle to query + A visitor to visit all nodes found by the search + + + + Performs a range search of the points in the index. + + The range rectangle to query + A collection of the KdNodes found + + + + Performs a range search of the points in the index. + + The range rectangle to query + A collection to accumulate the result nodes into + + + + Searches for a given point in the index and returns its node if found. + + the point to query + the point node, if it is found in the index, or if not + + + + Gets a value indicating the depth of the tree + + The depth of the tree + + + + Gets a value indicating the number of items in the tree. + + The number of items in the tree. + + + + Extensions methods for the . + + + + + Performs a nearest neighbor search of the points in the index. + + The KdTree to look for the nearest neighbor + The point to search the nearset neighbor for + + + + DoubleBits manipulates Double numbers + by using bit manipulation and bit-field extraction. + For some operations (such as determining the exponent) + this is more accurate than using mathematical operations + (which suffer from round-off error). + The algorithms and constants in this class + apply only to IEEE-754 double-precision floating point format. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Determines the exponent for the number. + + + + + Determines the exponent for the number. + + + + + + + + + + + + + + + + + + This computes the number of common most-significant bits in the mantissa. + It does not count the hidden bit, which is always 1. + It does not determine whether the numbers have the same exponent - if they do + not, the value computed by this function is meaningless. + + + The number of common most-significant mantissa bits. + + + + A representation of the Double bits formatted for easy readability. + + + + + Provides a test for whether an interval is + so small it should be considered as zero for the purposes of + inserting it into a binary tree. + The reason this check is necessary is that round-off error can + cause the algorithm used to subdivide an interval to fail, by + computing a midpoint value which does not lie strictly between the + endpoints. + + + + + Only static methods! + + + + + This value is chosen to be a few powers of 2 less than the + number of bits available in the double representation (i.e. 53). + This should allow enough extra precision for simple computations to be correct, + at least for comparison purposes. + + + + + Computes whether the interval [min, max] is effectively zero width. + I.e. the width of the interval is so much less than the + location of the interval that the midpoint of the interval cannot be + represented precisely. + + + + + A Key is a unique identifier for a node in a quadtree. + It contains a lower-left point and a level number. The level number + is the power of two for the size of the node envelope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return a square envelope containing the argument envelope, + whose extent is a power of two and which is based at a power of 2. + + + + + + + + + + + + + Represents a node of a Quadtree. Nodes contain + items which have a spatial extent corresponding to the node's position + in the quadtree. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the subquad containing the envelope . + Creates the subquad if + it does not already exist. + + The envelope to search for + The subquad containing the search envelope. + + + + Returns the smallest existing + node containing the envelope. + + + + + + + + + + + + Get the subquad for the index. + If it doesn't exist, create it. + + + + + + + + + + + + + Gets a value indicating the level of this node + + The level of this node + + + + The base class for nodes in a Quadtree. + + + + + Gets the index of the subquad that wholly contains the given envelope. + If none does, returns -1. + + The index of the subquad that wholly contains the given envelope
+ or -1 if no subquad wholly contains the envelope
+
+ + + + + + + + subquads are numbered as follows: + 2 | 3 + --+-- + 0 | 1 + + + + + + + + + + + + + + + + + + + + + Removes a single item from this subtree. + + The envelope containing the item. + The item to remove. + true if the item was found and removed. + + + + + + + + + + + + + + Gets a value indicating that this node is empty, i.e. it does not contain an items or sub-nodes. + + + + + Insert items in this into the parameter! + + IList for adding items. + Parameter IList with this items. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A Quadtree is a spatial index structure for efficient range querying + of items bounded by 2D rectangles.
+ s can be indexed by using their s.
+ Any type of object can also be indexed, as long as it has an extent that can be + represented by an . + + This Quadtree index provides a primary filter + for range rectangle queries. The various query methods return a list of + all items which may intersect the query rectangle. Note that + it may thus return items which do not in fact intersect the query rectangle. + A secondary filter is required to test for actual intersection + between the query rectangle and the envelope of each candidate item. + The secondary filter may be performed explicitly, + or it may be provided implicitly by subsequent operations executed on the items + (for instance, if the index query is followed by computing a spatial predicate + between the query geometry and tree items, + the envelope intersection check is performed automatically. + + This implementation does not require specifying the extent of the inserted + items beforehand. It will automatically expand to accommodate any extent + of dataset. + + This data structure is also known as an MX-CIF quadtree + following the terminology usage of Samet and others. +
+
+ + + Ensure that the envelope for the inserted item has non-zero extents. + Use the current minExtent to pad the envelope, if necessary. + + + + + + + minExtent is the minimum envelope extent of all items + inserted into the tree so far. It is used as a heuristic value + to construct non-zero envelopes for features with zero X and/or Y extent. + Start with a non-zero extent, in case the first feature inserted has + a zero extent in both directions. This value may be non-optimal, but + only one feature will be inserted with this value. + + + + + Constructs a Quadtree with zero items. + + + + + Returns the number of levels in the tree. + + + + + Tests whether the index contains any items. + + + + + Returns the number of items in the tree. + + + + + + + + + + + + Removes a single item from the tree. + + The Envelope of the item to be removed. + The item to remove. + true if the item was found (and thus removed). + + + + Queries the tree and returns items which may lie in the given search envelope. + + + Precisely, the items that are returned are all items in the tree + whose envelope may intersect the search Envelope. + Note that some items with non-intersecting envelopes may be returned as well; + the client is responsible for filtering these out. + In most situations there will be many items in the tree which do not + intersect the search envelope and which are not returned - thus + providing improved performance over a simple linear scan. + + The envelope of the desired query area. + A List of items which may intersect the search envelope + + + + Queries the tree and visits items which may lie in the given search envelope. + + + Precisely, the items that are visited are all items in the tree + whose envelope may intersect the search Envelope. + Note that some items with non-intersecting envelopes may be visited as well; + the client is responsible for filtering these out. + In most situations there will be many items in the tree which do not + intersect the search envelope and which are not visited - thus + providing improved performance over a simple linear scan. + + The envelope of the desired query area. + A visitor object which is passed the visited items + + + + Return a list of all items in the Quadtree. + + + + + + + + + + + Gets a value indicating the root node of this QuadTree + + The root node of this QuadTree + + + + Item visitor that specifically excludes a predefined area. + + The type of the items to visit + + + + Initialize with + + + + + > + + + + Get a value indicating the gathered items + + + + + QuadRoot is the root of a single Quadtree. + It is centred at the origin, + and does not have a defined extent. + + + + + Insert an item into the quadtree this is the root of. + + + + + Insert an item which is known to be contained in the tree rooted at + the given QuadNode root. Lower levels of the tree will be created + if necessary to hold the item. + + + + + + + + + + + + A node of an . A node is one of: + + empty + an interior node containing child s + a leaf node containing data items (s). + + A node stores the bounds of its children, and its level within the index tree. + + + + + Constructs an AbstractNode at the given level in the tree + + + 0 if this node is a leaf, 1 if a parent of a leaf, and so on; the + root node will have the highest level. + + + + + Returns either child s, or if this is a leaf node, real data (wrapped + in s). + + + + + Returns a representation of space that encloses this Boundable, + preferably not much bigger than this Boundable's boundary yet fast to + test for intersection with the bounds of other Boundables. The class of + object returned depends on the subclass of AbstractSTRtree. + + + An Envelope (for STRtrees), an Interval (for SIRtrees), or other + object (for other subclasses of AbstractSTRtree). + + + + + Gets the bounds of this node + + + + + Returns 0 if this node is a leaf, 1 if a parent of a leaf, and so on; the + root node will have the highest level. + + + + + Gets the count of the s at this node. + + + + + Tests whether there are any s at this node. + + + + + Adds either an AbstractNode, or if this is a leaf node, a data object + (wrapped in an ItemBoundable). + + The child to add. + + + + Base class for STRtree and SIRtree. STR-packed R-trees are described in: + P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With + Application To GIS. Morgan Kaufmann, San Francisco, 2002. + + This implementation is based on s rather than just s, + because the STR algorithm operates on both nodes and + data, both of which are treated as s. + + + + + + A test for intersection between two bounds, necessary because subclasses + of AbstractSTRtree have different implementations of bounds. + + + + + For STRtrees, the bounds will be Envelopes; + for SIRtrees, Intervals; + for other subclasses of AbstractSTRtree, some other class. + + The bounds of one spatial object. + The bounds of another spatial object. + Whether the two bounds intersect. + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have. + + + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and the root node + + The maximum number of child nodes in a node + The root node that links to all other nodes in the tree + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and all leaf nodes in the tree + + The maximum number of child nodes in a node + The list of leaf nodes in the tree + + + + Creates parent nodes, grandparent nodes, and so forth up to the root + node, for the data that has been inserted into the tree. Can only be + called once, and thus can be called only after all of the data has been + inserted into the tree. + + + + + + + + + + + + Sorts the childBoundables then divides them into groups of size M, where + M is the node capacity. + + + + + + + Creates the levels higher than the given level. + + The level to build on. + the level of the Boundables, or -1 if the boundables are item + boundables (that is, below level 0). + The root, which may be a ParentNode or a LeafNode. + + + + Gets the root node of the tree. + + + + + Gets the maximum number of child nodes that a node may have. + + + + + Tests whether the index contains any items. + This method does not build the index, + so items can still be inserted after it has been called. + + + + + Gets the number of elements in the tree + + + + + Also builds the tree, if necessary. + + + + + + Gets a tree structure (as a nested list) + corresponding to the structure of the items and nodes in this tree. + The returned Lists contain either Object items, + or Lists which correspond to subtrees of the tree + Subtrees which do not contain any items are not included. + Builds the tree if necessary. + + a List of items and/or Lists + + + + A test for intersection between two bounds, necessary because subclasses + of AbstractSTRtree have different implementations of bounds. + + + + + Removes an item from the tree. + (Builds the tree, if necessary.) + + + + + Gets a value indicating the boundable items that have to be included in the index + + A list of boundable items + + + + A pair of s, whose leaf items + support a distance metric between them. + Used to compute the distance between the members, + and to expand a member relative to the other + in order to produce new branches of the + Branch-and-Bound evaluation tree. + Provides an ordering based on the distance between the members, + which allows building a priority queue by minimum distance. + + Martin Davis + + + + Creates an instance of this class with the given s and the function. + + The first boundable + The second boundable + The item distance function + + + + Gets one of the member s in the pair + (indexed by [0, 1]). + + The index of the member to return (0 or 1) + The chosen member + + + + Computes the maximum distance between any + two items in the pair of nodes. + + the maximum distance between items in the pair + + + + Computes the distance between the s in this pair. + The boundables are either composites or leaves. + If either is composite, the distance is computed as the minimum distance + between the bounds. + If both are leaves, the distance is computed by . + + The distance between the s in this pair. + + + + Gets the minimum possible distance between the Boundables in + this pair. + If the members are both items, this will be the + exact distance between them. + Otherwise, this distance will be a lower bound on + the distances between the items in the members. + + The exact or lower bound distance for this pair + + + + Compares two pairs based on their minimum distances + + + + + Tests if both elements of the pair are leaf nodes + + + + + For a pair which is not a leaf + (i.e. has at least one composite boundable) + computes a list of new pairs + from the expansion of the larger boundable + with distance less than minDistance + and adds them to a priority queue. + + Note that expanded pairs may contain + the same item/node on both sides. + This must be allowed to support distance + functions which have non-zero distances + between the item and itself (non-zero reflexive distance). + + The priority queue to add the new pairs to. + The limit on the distance between added pairs. + + + + The Class BoundablePairDistanceComparator. It implements .Net and is used + as a parameter to sort the BoundablePair list. + + + + The normal order + + + + Instantiates a new boundable pair distance comparator. + + + A value of true puts the lowest record at the head of this queue. + This is the natural order. will get the least element. + + + + + + + + Utility functions for working with s. + + mdavis + + + + Computes the maximum distance between the points defining two envelopes. + This is the distance between the two corners which are farthest apart. + + Note that this is NOT the MinMax distance, which is a tighter bound on + the distance between the points in the envelopes. + + An envelope + An envelope + The maximum distance between the points defining the envelopes + + + + Computes the Min-Max Distance between two s. + It is equal to the minimum of the maximum distances between all pairs of + edge segments from the two envelopes. + This is the tight upper bound on the distance between + geometric items bounded by the envelopes. + + Theoretically this bound can be used in the R-tree nearest-neighbour branch-and-bound search + instead of . + However, little performance improvement is observed in practice. + + An envelope + An envelope + The min-max-distance between the envelopes + + + + Computes the maximum distance between two line segments. + + x-ordinate of first endpoint of segment 1 + y-ordinate of first endpoint of segment 1 + x-ordinate of second endpoint of segment 1 + y-ordinate of second endpoint of segment 1 + x-ordinate of first endpoint of segment 2 + y-ordinate of first endpoint of segment 2 + x-ordinate of second endpoint of segment 2 + y-ordinate of second endpoint of segment 2 + Maximum distance between the segments + + + + An function for + items which are using the method. + + To make this distance function suitable for + using to query a single index tree, + the distance metric is anti-reflexive. + That is, if the two arguments are the same Geometry object, + the distance returned is . + + Martin Davis + + + + Computes the distance between two items, + using the method. + + An item which is a geometry. + An item which is a geometry. + if either item is not a Geometry + The distance between the two items. + + + + A function method which computes the distance + between two s in an . + Used for Nearest Neighbour searches. + + To make a distance function suitable for + querying a single index tree + via , + the function should have a non-zero reflexive distance. + That is, if the two arguments are the same object, + the distance returned should be non-zero. + If it is required that only pairs of distinct items be returned, + the distance function must be anti-reflexive, + and must return for identical arguments. + + Martin Davis + + + + Computes the distance between two items. + + The first item. + The second item. + If the metric is not applicable to the arguments + The distance between and . + + + + A contiguous portion of 1D-space. Used internally by SIRtree. + + + + + + + + + + + + + + + + + + Gets the centre of the interval. + + + + + + + + this + + + + + + + this + + + + + + + + + + + + + + + + + + + + + Boundable wrapper for a non-Boundable spatial object. Used internally by + AbstractSTRtree. + + + + + + + + + + + + The bounds + + + + + The item + + + + + One-dimensional version of an STR-packed R-tree. SIR stands for + "Sort-Interval-Recursive". STR-packed R-trees are described in: + P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With + Application To GIS. Morgan Kaufmann, San Francisco, 2002. + + + + + + + + + + + + + + + + + Constructs an SIRtree with the default (10) node capacity. + + + + + Constructs an SIRtree with the given maximum number of child nodes that + a node may have. + + + + + + + + + + + + Inserts an item having the given bounds into the tree. + + + + + + + + Returns items whose bounds intersect the given value. + + + + + + Returns items whose bounds intersect the given bounds. + + Possibly equal to x2. + Possibly equal to x1. + + + + + + + + + + + + + + + A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. + For two-dimensional spatial data. + + The STR packed R-tree is simple to implement and maximizes space + utilization; that is, as many leaves as possible are filled to capacity. + Overlap between nodes is far less than in a basic R-tree. + However, the index is semi-static; once the tree has been built + (which happens automatically upon the first query), items may + not be added.
+ Items may be removed from the tree using . + + Described in: P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With + Application To GIS. Morgan Kaufmann, San Francisco, 2002. + + Note that inserting items into a tree is not thread-safe. + Inserting performed on more than one thread must be synchronized externally. + + Querying a tree is thread-safe. The building phase is done synchronously, + and querying is stateless. +
+
+ + + Constructs an STRtree with the default (10) node capacity. + + + + + Constructs an STRtree with the given maximum number of child nodes that + a node may have. + + The minimum recommended capacity setting is 4. + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and the root node + + The minimum recommended capacity setting is 4 + The maximum number of child nodes in a node + The root node that links to all other nodes in the tree + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and all leaf nodes in the tree + + The minimum recommended capacity setting is 4 + The maximum number of child nodes in a node + The list of leaf nodes in the tree + + + + + + + + + + + + + + + + + + + + + + + + + + Creates the parent level for the given child level. First, orders the items + by the x-values of the midpoints, and groups them into vertical slices. + For each slice, orders the items by the y-values of the midpoints, and + group them into runs of size M (the node capacity). For each run, creates + a new (parent) node. + + + + + + + + + + + + + + + + + + + + + + + + + Must be sorted by the x-value of the envelope midpoints. + + + + + + + + + + + + + + + + + Inserts an item having the given bounds into the tree. + + + + + + + Returns items whose bounds intersect the given envelope. + + + + + + Returns items whose bounds intersect the given envelope. + + + + + + + Removes a single item from the tree. + + The Envelope of the item to remove. + The item to remove. + true if the item was found. + + + + + + + + + + Finds the two nearest items in the tree, + using as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + + If the tree is empty, the return value is null. + If the tree contains only one item, the return value is a pair containing that item. + If it is required to find only pairs of distinct items, + the function must be anti-reflexive. + + A distance metric applicable to the items in this tree + The pair of the nearest items or null if the tree is empty + + + + Finds the item in this tree which is nearest to the given , + using as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + + The query does not have to be + contained in the tree, but it does + have to be compatible with the + distance metric. + + The envelope of the query item + The item to find the nearest neighbour of + A distance metric applicable to the items in this tree and the query item + The nearest item in this tree or null if the tree is empty + + + + Finds the two nearest items from this tree + and another tree, + using as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + The result value is a pair of items, + the first from this tree and the second + from the argument tree. + + Another tree + A distance metric applicable to the items in the trees + The pair of the nearest items, one from each tree or null if no pair of distinct items can be found. + + + + Tests whether some two items from this tree and another tree + lie within a given distance. + is used as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + + Another tree + A distance metric applicable to the items in the trees + The distance limit for the search + true if there are items within the distance + + + + Performs a withinDistance search on the tree node pairs. + This is a different search algorithm to nearest neighbour. + It can utilize the between + tree nodes to confirm if two internal nodes must + have items closer than the maxDistance, + and short-circuit the search. + + The initial pair containing the tree root nodes + The maximum distance to search for + true if two items lie within the given distance + + + + Finds k items in this tree which are the top k nearest neighbors to the given item, + using itemDist as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + This method implements the KNN algorithm described in the following paper: + + Roussopoulos, Nick, Stephen Kelley, and Frédéric Vincent. "Nearest neighbor queries." + ACM sigmod record. Vol. 24. No. 2. ACM, 1995. + + The query item does not have to be + contained in the tree, but it does + have to be compatible with the itemDist + distance metric. + + The envelope of the query item + The item to find the nearest neighbour of + A distance metric applicable to the items in this tree and the query item + The K nearest items in kNearestNeighbour + K nearest items in this tree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ProjectionEvents are ordered first by their x-value, and then by their eventType. + It is important that Insert events are sorted before Delete events, so that + items whose Insert and Delete events occur at the same x-value will be + correctly handled. + + + + + + A sweepline implements a sorted index on a set of intervals. + It is used to compute all overlaps between the interval in the index. + + + + + + + + + + + Because Delete Events have a link to their corresponding Insert event, + it is possible to compute exactly the range of events which must be + compared to a given Insert event object. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Extends the class to allow writing values in the BigEndian format. + + + While extends + adding methods for writing integer values () + and double values () in the BigEndian format, + this implementation overrides methods, such + and and more, + for writing values in the BigEndian format. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The supplied stream. + output is null. + + The stream does not support writing, or the stream is already closed. + + + + Initializes a new instance of the class. + + The supplied stream. + The character encoding. + output or encoding is null. + + The stream does not support writing, or the stream is already closed. + + + + Writes a two-byte signed integer to the current stream using BigEndian encoding + and advances the stream position by two bytes. + + The two-byte signed integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a two-byte unsigned integer to the current stream using BigEndian encoding + and advances the stream position by two bytes. + + The two-byte unsigned integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a four-byte signed integer to the current stream using BigEndian encoding + and advances the stream position by four bytes. + + The four-byte signed integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a four-byte unsigned integer to the current stream using BigEndian encoding + and advances the stream position by four bytes. + + The four-byte unsigned integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes an eight-byte signed integer to the current stream using BigEndian encoding + and advances the stream position by eight bytes. + + The eight-byte signed integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes an eight-byte unsigned integer to the current stream using BigEndian encoding + and advances the stream position by eight bytes. + + The eight-byte unsigned integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a four-byte floating-point value to the current stream using BigEndian encoding + and advances the stream position by four bytes. + + The four-byte floating-point value to write. + The stream is closed. + An I/O error occurs. + + + + Writes an eight-byte floating-point value to the current stream using BigEndian encoding + and advances the stream position by eight bytes. + + The eight-byte floating-point value to write. + The stream is closed. + An I/O error occurs. + + + + Extends the class to allow reading values in the specified format. + + + While extends + adding methods for reading integer values () + and double values () in the specified format, + this implementation overrides methods, such + and and more, + for reading values in the specified by format. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The supplied stream. + The byte order. + The stream does not support reading, the stream is null, or the stream is already closed. + + + + Encoding type + + + + + Reads a 2-byte signed integer from the current stream using the specified encoding + and advances the current position of the stream by two bytes. + + + A 2-byte signed integer read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 2-byte unsigned integer from the current stream using the specified encoding + and advances the position of the stream by two bytes. + + + A 2-byte unsigned integer read from this stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 4-byte signed integer from the current stream using the specified encoding + and advances the current position of the stream by four bytes. + + + A 4-byte signed integer read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 4-byte unsigned integer from the current stream using the specified encoding + and advances the position of the stream by four bytes. + + + A 4-byte unsigned integer read from this stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads an 8-byte signed integer from the current stream using the specified encoding + and advances the current position of the stream by eight bytes. + + + An 8-byte signed integer read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads an 8-byte unsigned integer from the current stream using the specified encoding + and advances the position of the stream by eight bytes. + + + An 8-byte unsigned integer read from this stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 4-byte floating point value from the current stream using the specified encoding + and advances the current position of the stream by four bytes. + + + A 4-byte floating point value read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads an 8-byte floating point value from the current stream using the specified encoding + and advances the current position of the stream by eight bytes. + + + An 8-byte floating point value read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a string from the current stream. + The string is prefixed with the length, encoded as an integer seven bits at a time. + + The string being read. + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a decimal value from the current stream + and advances the current position of the stream by sixteen bytes. + + + A decimal value read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Byte order + + + + + BigEndian + + + + + LittleEndian + + + + + Lightweight class that handles OGC Geometry type declaration + + + + + Initializes this instance + + The value describing the + + + + Inititalizes this instance based on a geometry and an Ordinates flag. + + The geometry. + The ordinates flag. + + + + Inititalizes this instance based on an + + The OGC geometry type + + + + Inititalizes this instance based on an and an SRID indicator + + The OGC geometry type + Indicator if a SRID is supplied. + + + + Inititalizes this instance based on an and an SRID indicator + + The OGC geometry type + The ordinates flag. + Indicator if a SRID is supplied. + + + + Gets or sets the base geometry type + + + + + Gets the OGC Well-Known-Binary type code + + + + + Gets the PostGIS Enhanced Well-Known-Binary type code + + + + + Gets or sets whether z-ordinate values are stored along with the geometry. + + + + + Gets or sets whether m-ordinate values are stored along with the geometry. + + + + + Gets whether SRID value is stored along with the geometry. + + + + + Gets or sets whether z-ordinate values are stored along with the geometry. + + + + + Gets or sets whether m-ordinate values are stored along with the geometry. + + + + + Gets or sets whether z-ordinates are stored along with the geometry. + PostGis EWKB format. + + + + + Gets or sets whether z-ordinates are stored along with the geometry. + PostGis EWKB format. + + + + + Gets or sets whether z-ordinates are stored along with the geometry. + PostGis EWKB format. + + + + + Reads a GML document and creates a representation of the features based on NetTopologySuite model. + Uses GML 2.1.1 Geometry.xsd schema for base for features. + + + + + builder. + + + + + Initialize reader with a standard . + + + + + Initialize reader with the given . + + + + + Read a GML document and returns relative . + + + + + + + Read a GML document and returns relative . + + + + + + + Reads the coordinate. + + The reader. + + + + + Extract a from a x,y string value. + + + + + + + Extract a from a pos entity string value. + + + + + + + Extract a from a x,y string value. + + + + + Identifies a version of the GML specification. + + + + + Version 2.1.1 (OGC 02-009). + + + + + Version 3.2.2 (OGC 07-036r1 / ISO 19136:2007). + + + + + Writes the GML representation of the features of NetTopologySuite model. + Uses GML 2.1.1 Geometry.xsd schema for base for features. + + Thanks to rstuven for improvements :) + + + + + + Formatter for double values of coordinates + + + + + Initializes a new instance of the class. + + + + + Returns an XmlReader with feature informations. + Use XmlDocument.Load(XmlReader) for obtain a XmlDocument to work. + + + + + + + Writes a GML feature into a generic Stream, such a FileStream or other streams. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sets corrent length for Byte Stream. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the EPSG code exposing the SRID of the geometry + + The SRID of the geometry + + + + + Writes the GML representation of the features of NetTopologySuite model. + Uses GML 3.2.2 gml.xsd schema for base for features. + + + + + Initializes a new instance of the class. + + + + + Constructs objects from the OGC KML representation. + Works only with KML geometry elements and may also parse attributes within these elements + + + + + Creates a reader that creates objects using the default . + + + + + Creates a reader that creates objects using the given . + + The factory used to create Geometrys. + + + + Creates a reader that creates objects using the default . + + Names of attributes that should be parsed (i.e. extrude, altitudeMode, tesselate, etc). + + + + Creates a reader that creates objects using the given . + + The factory used to create Geometrys. + Names of attributes that should be parsed (i.e. extrude, altitudeMode, tesselate, etc). + + + + Reads a KML representation of a from a . + + If any attribute names were specified during {@link KMLReader} construction, + they will be stored as in . + + The string that specifies kml representation of geometry. + A Geometry + Thrown if a parsing problem occurs. + + + + Reads a KML representation of a from a . + + If any attribute names were specified during {@link KMLReader} construction, + they will be stored as in . + + The text stream reader. + A Geometry + Thrown if a parsing problem occurs. + + + + Writes a formatted string containing the KML representation + of a JTS . + The output is KML fragments which can be substituted + wherever the KML abstract + element can be used. + + + Output elements are indented to provide a + nicely-formatted representation. + An output line prefix and maximum + number of coordinates per line can be specified. + + + The Z ordinate value output can be forced to be a specific value. + The and modes can be set. + If set, the corresponding sub-elements will be output. + + + + + The KML standard value clampToGround for use in . + + + + + The KML standard value relativeToGround for use in . + + + + + The KML standard value absolute for use in . + + + + + Writes a Geometry as KML to a string, using + a specified Z value. + + the geometry to write + the Z value to use + a string containing the KML geometry representation + + + + Writes a Geometry as KML to a string, using + a specified Z value, precision, extrude flag, + and altitude mode code. + + the geometry to write + the Z value to use + the maximum number of decimal places to write + the extrude flag to write + the altitude model code to write + a string containing the KML geometry representation + + + + A tag string which is prefixed to every emitted text line. + This can be used to indent the geometry text in a containing document. + + + + + The maximum number of coordinates to output per line. + + + + + The Z value to be output for all coordinates. + This overrides any Z value present in the Geometry coordinates. + + + + + The flag to be output in the extrude element. + + + + + The flag to be output in the tesselate element. + + + + + The value output in the altitudeMode element. + + + + + The maximum number of decimal places to output in ordinate values. + Useful for limiting output size. + + + negative values set the precision to , + like standard behavior. + + + + + Writes a in KML format as a string. + + the geometry to write + a string containing the KML geometry representation + + + + Writes the KML representation of a to a . + + the geometry to write + the writer to write to + + + + Appends the KML representation of a to a . + + the geometry to write + the buffer to write into + + + + Takes a list of coordinates and converts it to KML. + + + 2D and 3D aware. Terminates the coordinate output with a newline. + + + + + Formats numeric values for ordinates + in a consistent, accurate way. + + The format has the following characteristics: + + It is consistent in all locales (in particular, the decimal separator is always a period) + Scientific notation is never output, even for very large numbers. This means that it is possible that output can contain a large number of digits. + The maximum number of decimal places reflects the available precision + NaN values are represented as "NaN" + Inf values are represented as "Inf" or "-Inf" + + + mdavis + + + + The output representation of + + + + + The output representation of + + + + + The output representation of + + + + + The maximum number of fraction digits to support output of reasonable ordinate values. + + The default is chosen to allow representing the smallest possible IEEE-754 double-precision value, + although this is not expected to occur (and is not supported by other areas of the JTS/NTS code). + + + + + The default formatter using the maximum number of digits in the fraction portion of a number. + + + + + Creates an OrdinateFormat using the default maximum number of fraction digits. + + + + + Creates an OrdinateFormat using the given maximum number of fraction digits. + + The maximum number of fraction digits to output + + + + Returns a string representation of the given ordinate numeric value. + + The ordinate value + The formatted number string + + + + Thrown by a WKTReader when a parsing problem occurs. + + + + + Creates a ParseException with the given detail message. + + A description of this ParseException. + + + + Creates a ParseException with es detail message. + + An exception that occurred while a WKTReader was + parsing a Well-known Text string. + + + + Creates a ParseException with s detail message + + + The inner exception + + + + WKB Geometry Types + + + + + Point. + + + + + LineString. + + + + + Polygon. + + + + + MultiPoint. + + + + + MultiLineString. + + + + + MultiPolygon. + + + + + GeometryCollection. + + + + + Point with Z coordinate. + + + + + LineString with Z coordinate. + + + + + Polygon with Z coordinate. + + + + + MultiPoint with Z coordinate. + + + + + MultiLineString with Z coordinate. + + + + + MultiPolygon with Z coordinate. + + + + + GeometryCollection with Z coordinate. + + + + + Point with M ordinate value. + + + + + LineString with M ordinate value. + + + + + Polygon with M ordinate value. + + + + + MultiPoint with M ordinate value. + + + + + MultiLineString with M ordinate value. + + + + + MultiPolygon with M ordinate value. + + + + + GeometryCollection with M ordinate value. + + + + + Point with Z coordinate and M ordinate value. + + + + + LineString with Z coordinate and M ordinate value. + + + + + Polygon with Z coordinate and M ordinate value. + + + + + MultiPoint with Z coordinate and M ordinate value. + + + + + MultiLineString with Z coordinate and M ordinate value. + + + + + MultiPolygon with Z coordinate and M ordinate value. + + + + + GeometryCollection with Z coordinate and M ordinate value. + + + + + Reads a sequence of {@link Geometry}s in WKBHex format + from a text file. + Each WKBHex geometry must be on a single line + The geometries in the file may be separated by any amount + of whitespace and newlines. + + Martin Davis + + + + Creates a new given the + to use to parse the geometries. + + The geometry reader to use + + + + Gets or sets a value indicating the maximum number of geometries to read + + + + + Gets or sets the number of geometries to skip before storing. + + + + + Reads a sequence of geometries.
+ If an is specified, geometries read up to the offset count are skipped. + If a is specified, no more than geometries are read. +
+ The path to the file + Thrown if no filename was specified + Thrown if the filename specified does not exist + Thrown if an I/O exception was encountered + Thrown if an error occurred reading a geometry +
+ + + Reads a sequence of geometries.
+ If an is specified, geometries read up to the offset count are skipped. + If a is specified, no more than geometries are read. +
+ The path to the file + Thrown if no stream was passed + Thrown if passed stream is not readable or seekable + Thrown if an I/O exception was encountered + Thrown if an error occured reading a geometry +
+ + + Reads a sequence of geometries.
+ If an is specified, geometries read up to the offset count are skipped. + If a is specified, no more than geometries are read. +
+ The stream reader to use. + Thrown if an I/O exception was encountered + Thrown if an error occured reading a geometry +
+ + + Tests if reader has reached limit + + A collection of already read geometries + true if number of geometries has been read. + + + + Tests if reader is at EOF. + + + + + Converts a Well-Known Binary byte data to a Geometry. + + + This class reads the format describe in {@link WKBWriter}. + It partially handles theExtended WKB format used by PostGIS, + by parsing and storing optional SRID values. + If a SRID is not specified in an element geometry, it is inherited + from the parent's SRID. + The default SRID value depends on . + + Although not defined in the WKB spec, empty points + are handled if they are represented as a Point with NaN X and Y ordinates. + + The reader repairs structurally-invalid input + (specifically, LineStrings and LinearRings which contain + too few points have vertices added, + and non-closed rings are closed). + + The reader handles most errors caused by malformed or malicious WKB data. + It checks for obviously excessive values of the fields + numElems, numRings, and numCoords. + It also checks that the reader does not read beyond the end of the data supplied. + A is thrown if this situation is detected. + + + + + Converts a hexadecimal string to a byte array. + The hexadecimal digit symbols are case-insensitive. + + A string containing hex digits + An array of bytes with the value of the hex string + + + + Initialize reader with a standard . + + + + + Creates an instance of this class using the provided NtsGeometryServices + + + + + + Reads a in binary WKB format from an array of s. + + The byte array to read from + The geometry read + if the WKB data is ill-formed. + + + + Reads a in binary WKB format from an . + + The stream to read from + The geometry read + if the WKB data is ill-formed. + + + + WKB Coordinate Systems + + + + + 2D coordinate system + + + + + 3D coordinate system + + + + + 2D coordinate system with additional measure value + + + + + 3D coordinate system with additional measure value + + + + + + + + + + + + + + + + + + Function to read a coordinate sequence. + + The reader + The number of ordinates + The coordinate system + The read coordinate sequence. + + + + Function to read a coordinate sequence that is supposed to form a ring. + + The reader + The number of ordinates + The coordinate system + The read coordinate sequence. + + + + Function to read a coordinate sequence that is supposed to serve a line string. + + The reader + The number of ordinates + The coordinate system + The read coordinate sequence. + + + + Function to convert from to + + The coordinate system + The corresponding + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Gets or sets a value indicating if a possibly encoded SRID value should be handled. + + + + + Gets a value indicating which ordinates can be handled. + + + + + Gets a value indicating which ordinates should be handled. + + + + + Gets or sets a value indicating if the reader should attempt to repair malformed input. + + + Malformed in this case means the ring has too few points (4), + or is not closed. + + + + + Gets or sets whether invalid linear rings should be fixed + + + + + Function to determine whether an ordinate should be handled or not. + + + + + + + Writes a Well-Known Binary byte data representation of a Geometry. + + + There are a few cases which are not specified in the standard. + The implementation uses a representation which is compatible with + other common spatial systems (notably, PostGIS). + + sare written as s. + Empty geometries are output as follows + + PointA WKBPoint with double.NaN ordinate values + LineStringA WKBLineString with zero points + Polygoncurrently output as a WKBPolygon with one LinearRing with zero points. + Note: This is different to other systems. It will change to a WKBPolygon with zero LinearRings. + Multi geometriesA WKBMulti with zero elements + GeometryCollectionA WKBGeometryCollection with zero elements + + + + This implementation supports the Extended WKB standard. + Extended WKB allows writing 3-dimensional coordinates + and the geometry SRID value. + The presence of 3D coordinates is indicated + by setting the high bit of the wkbType word. + The presence of a SRID is indicated + by setting the third bit of the wkbType word. + EWKB format is upward-compatible with the original SFS WKB format. + + SRID output is optimized, if specified. + The top-level geometry has the SRID included. Child geometries + have it included if their value differs from its parent. + + This class supports reuse of a single instance to read multiple + geometries. This class is not thread - safe; each thread should create its own + instance. + + + + Converts a byte array to a hexadecimal string. + A byte array + + + + Writes the WKB Header for the geometry + + The writer + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Gets or sets the binary encoding type + + + + + Standard byte size for each complex point. + Each complex point (LineString, Polygon, ...) contains: + 1 byte for ByteOrder and + 4 bytes for WKBType. + 4 bytes for SRID value + + + + + Calculates the number of bytes required to store (E)WKB Header information. + + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The size of the + + + + Initializes writer with LittleIndian byte order. + + + + + Initializes writer with the specified byte order. + + Encoding type + + + + Initializes writer with the specified byte order. + + Encoding type + SRID values, present or not, should be emitted. + + + + Initializes writer with the specified byte order. + + Encoding type + SRID values, present or not, should be emitted. + Z values, present or not, should be emitted + + + + Initializes writer with the specified byte order. + + Encoding type + SRID values, present or not, should be emitted. + Z values, present or not, should be emitted + M values, present or not, should be emitted + + + + Writes a WKB representation of a given point. + + + + + + + Writes a WKB representation of a given point. + + + + + + + + + + + + + + + + + + + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Writes the ByteOrder defined in . + + The writer to use + + + + Write a . + + The coordinate + The writer. + + + + Write a . + + The coordinate sequence to write + A flag indicating if the size of should be written, too. + The writer. + + + + Write a point in its WKB format + + The point + The writer + + + + Write a point in its WKB format + + The point + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a LineString in its WKB format + + The LineString + The writer + + + + Write a LineString in its WKB format + + The LineString + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write LinearRing information + + The linear ring + The writer + + + + Write a Polygon in its WKB format + + The Polygon + The writer + + + + Write a Polygon in its WKB format + + The Polygon + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a MultiPoint in its WKB format + + The MultiPoint + The writer + + + + Write a MultiPoint in its WKB format + + The MultiPoint + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a MultiLineString in its WKB format + + The MultiLineString + The writer + + + + Write a MultiLineString in its WKB format + + The MultiLineString + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a MultiPolygon in its WKB format + + The MultiPolygon + The writer + + + + Write a MultiPolygon in its WKB format + + The MultiPolygon + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a GeometryCollection in its WKB format + + The GeometryCollection + The writer + + + + Write a GeometryCollection in its WKB format + + The GeometryCollection + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Gets a buffer for the to write to. + + The geometry to write + A buffer + + + + Gets a buffer for the to write to. + + The geometry to write + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + A buffer + + + + Computes the length of a buffer to write in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Gets a value whether or not EWKB featues may be used. + EWKB features are + + 0x80000000 flag if geometry's z-ordinate values are written + 0x40000000 flag if geometry's m-ordinate values are written + 0x20000000 flag if geometry's SRID value is written + + + + + Gets a value indicating if only original WKT elements should be handled + + + + + Gets or sets a value indicating if an encoded SRID value should be handled or ignored. + + + + + Gets the that this class can write. + + + + + Gets or sets the maximum to write out. + The default is equivalent to . + + + + The purpose of this property is to restrict what gets written out to ensure that, + e.g., Z values are never written out even if present on a geometry instance. Ordinates + that are not present on a geometry instance will be omitted regardless of this value. + + + Flags not present in are silently ignored. + + + and are always present. + + + + + + Constants used in the WKT (Well-Known Text) format. + + Martin Davis + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for empty geometries + + + + + Token text indicating that geometries have measure-ordinate values + + + + + Token text indicating that geometries have z-ordinate values + + + + + Token text indicating that geometries have both z- and measure-ordinate values + + + + + Reads a sequence of s in WKT format from a text file. + + The geometries in the file may be separated by any amount of whitespace and newlines. + + Martin Davis + + + + + Creates a new given the to read from and a to use to parse the geometries. + + the to read from + the geometry reader to use + + + + Creates a new , given the name of the file to read from. + + The name of the file to read from + The geometry reader to use + + + + Creates a new , given a to read from. + + The stream to read from + The geometry reader to use + + + + Creates a new , given a to read with. + + The stream reader of the file to read from + The geometry reader to use + + + + Gets/Sets the maximum number of geometries to read. + + + + + Gets/Sets allow ignoring WKT parse errors + after at least one geometry has been read, + to return a partial result. + + + + + Gets/Sets the number of geometries to skip before reading. + + + + + Reads a sequence of geometries. + + + + If an offset is specified, geometries read up to the offset count are skipped. + If a limit is specified, no more than geometries are read. + + Thrown if an I/O exception was encountered + Thrown if an error occurred reading a geometry + The list of geometries read + + + + Tests if reader is at EOF. + + + + + Converts a Well-Known Text string to a Geometry. + + The WKTReader allows + extracting Geometry objects from either input streams or + internal strings. This allows it to function as a parser to read Geometry + objects from text blocks embedded in other data formats (e.g. XML). + + The Well-known + Text format is defined in the + OpenGIS Simple Features Specification for SQL . + + As of version 2.0, NTS can read WKT syntax + which specifies coordinate dimension Z, M or ZM as modifiers(e.g.POINT Z) + or in the name of the geometry type(e.g.LINESTRINGZM). + If the coordinate dimension is specified it will be set in the created geometry. + If the coordinate dimension is not specified, the default behaviour is to + create XYZ geometry(this is backwards compatible with older JTS versions). + This can be altered to create XY geometry by + setting to false. + + NOTE: There is an inconsistency in the SFS. + The WKT grammar states that MultiPoints are represented by + MULTIPOINT ( ( x y), (x y) ), + but the examples show MultiPoints as MULTIPOINT ( x y, x y ). + Other implementations follow the latter syntax, so NTS will adopt it as well. + A WKTReader is parameterized by a GeometryFactory, + to allow it to create Geometry objects of the appropriate + implementation. In particular, the GeometryFactory will + determine the PrecisionModel and SRID that is used. + The WKTReader will convert the input numbers to the precise + internal representation. + + reads also non-standard tags. + + + + + + Creates a WKTReader that creates objects using a basic GeometryFactory. + + + + + Creates a WKTReader that creates objects using a basic GeometryFactory. + + + + + Creates a WKTReader that creates objects using the given + GeometryFactory. + + The factory used to create Geometrys. + + + + Gets or sets a value indicating whether or not coordinates may have 3 ordinate values + even though no Z or M ordinate indicator is present. The default value is + . + + + + + Gets or sets a value indicating whether or not point coordinates in a MultiPoint + geometry must not be enclosed in paren. The default value is . + + + + + Gets or sets the factory to create geometries + + + + + Gets or sets the default SRID + + + + + Gets or sets a value indicating if the reader should attempt to repair malformed input. + + + Malformed in this case means the ring has too few points (4), + or is not closed. + + + + + Converts a Well-known Text representation to a Geometry. + + + one or more Geometry Tagged Text strings (see the OpenGIS + Simple Features Specification) separated by whitespace. + + + A Geometry specified by wellKnownText + + + + + Converts a Well-known Text representation to a Geometry. + + + one or more Geometry Tagged Text strings (see the OpenGIS + Simple Features Specification) separated by whitespace. + + + A Geometry specified by wellKnownText + + + + + Converts a Well-known Text representation to a Geometry. + + + A Reader which will return a "Geometry Tagged Text" + string (see the OpenGIS Simple Features Specification). + + A Geometry read from reader. + + + + + Reads a Coordinate from a stream using the given . + + All ordinate values are read, but -depending on the + of the underlying - not necessarily all can be handled. + Those are silently dropped. + + + A geometry factory + the tokenizer to use. + a bit-mask defining the ordinates to read. + a value indicating if a starting "(" should be probed. + a of length 1 containing the read ordinate values. + if an I/O error occurs. + if an unexpected token was encountered. + + + + Reads a Coordinate from a stream using the given . + + All ordinate values are read, but -depending on the + of the underlying - not necessarily all can be handled. + Those are silently dropped. + + + A geometry factory + the tokenizer to use. + a bit-mask defining the ordinates to read. + a of length 1 containing the read ordinate values. + if an I/O error occurs. + if an unexpected token was encountered. + + + + Reads a CoordinateSequence from a stream using the given + for an old-style JTS MultiPoint (Point coordinates not enclosed in parentheses). + + All ordinate values are read, but -depending on the + of the underlying - not necessarily all can be handled. + Those are silently dropped. + + + A geometry factory + the tokenizer to use. + a bit-mask defining the ordinates to read. + a of length 1 containing the read ordinate values. + if an I/O error occurs. + if an unexpected token was encountered. + + + + Computes the required dimension based on the given ordinate bit-mask. + It is assumed that is set. + + the ordinate bit-mask. + the number of dimensions required to store ordinates for the given bit-mask. + + + + Merges an array of one-coordinate-s into one + . + + A geometry factory + an array of coordinate sequences. Each sequence contains exactly one coordinate. + a bit-mask of required ordinates. + a coordinate sequence containing all coordinate. + + + + + + + + + + + + + + + + + + Returns the next number in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be a number. + + The next number in the stream. + if the next token is not a valid number + + + + Returns the next WKTConstants.EMPTY or "(" in the stream as uppercase text. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be or "(". + + + The next WKTConstants.EMPTY or "(" in the stream as uppercase text. + + + + Returns the next ordinate flag information in the stream as uppercase text. + This can be Z, M or ZM. + + tokenizer over a stream of text in Well-known Text + the next ordinate flags. + if an I/O error occurs + if the next token is not EMPTY or L_PAREN + + + + Returns the next word in the stream. + + tokenizer over a stream of text in Well-known Text format. The next token must be a word. + the next word in the stream as uppercase text + if the next token is not a word + if an I/O error occurs + + + + Returns the next ")" or "," in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be ")" or ",". + + + The next ")" or "," in the stream. + + + + Returns the next ")" in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be ")". + + + The next ")" in the stream. + + + + Returns the next word in the stream as uppercase text. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be a word. + + + to advance the stream, to just peek. + + The next word in the stream as uppercase text. + + + + Creates a Geometry using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <Geometry Tagged Text. + + A Geometry specified by the next token + in the stream. + + + + Creates a Point using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <Point Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + A Point specified by the next token in + the stream. + + + + Creates a LineString using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <LineString Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A LineString specified by the next + token in the stream. + + + + Creates a LinearRing using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <LineString Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + A LinearRing specified by the next + token in the stream. + + + + Creates a MultiPoint using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <MultiPoint Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A MultiPoint specified by the next + token in the stream. + + + + Creates a Polygon using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a Polygon Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A Polygon specified by the next token + in the stream. + + + + + Creates a MultiLineString using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a MultiLineString Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A MultiLineString specified by the + next token in the stream. + + + + Creates a MultiPolygon using the next token in the stream. + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a MultiPolygon Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A MultiPolygon specified by the next + token in the stream, or if if the coordinates used to create the + Polygon shells and holes do not form closed linestrings. + + + + Creates a GeometryCollection using the next token in the + stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <GeometryCollection Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A GeometryCollection specified by the + next token in the stream. + + + + Outputs the textual representation of a . + The outputs coordinates rounded to the precision + model. No more than the maximum number of necessary decimal places will be + output. + The Well-known Text format is defined in the OpenGIS Simple Features + Specification for SQL. + A non-standard "LINEARRING" tag is used for LinearRings. The WKT spec does + not define a special tag for LinearRings. The standard tag to use is + "LINESTRING". + + + + + Generates the WKT for a Point specified by a . + + The point coordinate. + The WKT + + + + Generates the WKT for a N-point LineString specified by a . + + The sequence to write. + The WKT + + + + Generates the WKT for a LINESTRING specified by an array of s. + + An array of coordinates + The WKT + + + + Generates the WKT for a LineString specified by two s. + + The first coordinate. + The second coordinate. + The WKT + + + + Creates the NumberFormatInfo used to write doubles + with a sufficient number of decimal places. + + + The PrecisionModel used to determine + the number of decimal places to write. + + + A NumberFormatInfo that write doubles + without scientific notation. + + + + + A filter implementation to test if a coordinate sequence actually has meaningful values + for an ordinate bit-pattern + + + + + Initializes a new instance of the flag. + + + The index for the ordinates to test. + + + if implies + , otherwise. + + + + + + + + + + + + + + Gets the evaluated ordinate bit-pattern of ordinates with valid values masked by + . + + + + + Creates an instance of this class which is writing at most 2 dimensions. + + + + + Creates an instance of this class which is writing at most dimensions. + + + + + Gets/sets whether the output will be formatted + + + + + Gets/sets the maximum number of coordinates per line written in formatted output. + + If the provided coordinate number is < 0, coordinates will be written all on one line. + + + Gets/sets the tab size to use for indenting. + If the size is non-positive + + + + Gets or sets the to be written. Possible members are: + + + + + + + Values of and are always assumed and + not particularly checked for. + + + + + Gets or sets a that should be used on the ordinates written. + + If none/ is assigned, the precision model of the + is used. + + + Note: The precision model is applied to all ordinate values, not just x and y. + + + + + + Creates a new instance of the class suitable for MSSQL's non- + standard WKT format. + + + A new instance of the class suitable for MSSQL's non-standard + WKT format. + + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process. + A Geometry Tagged Text string (see the OpenGIS Simple Features Specification). + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process. + A Stream to write into + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process. + + A "Geometry Tagged Text" string (see the OpenGIS Simple Features Specification) + + + + Same as write, but with newlines and spaces to make the + well-known text more readable. + + A Geometry to process + + A "Geometry Tagged Text" string (see the OpenGIS Simple + Features Specification), with newlines and spaces. + + + + + Same as write, but with newlines and spaces to make the + well-known text more readable. + + A Geometry to process + + + A Geometry Tagged Text string (see the OpenGIS Simple + Features Specification), with newlines and spaces. + + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process + A flag indicating that the output should be formatted. + the output writer to append to. + The precision model to use. + + A "Geometry Tagged Text" string (see the OpenGIS Simple + Features Specification). + + + + + Converts a to <Geometry Tagged Text> format, then appends + it to the writer. + + the to process. + A flag indicating that the output should be formatted. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a to <Geometry Tagged Text> format, then appends + it to the writer. + + the to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted. + The indentation level + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a Coordinate to Point Tagged Text format, + then appends it to the writer. + + The Point to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a LineString to <LineString Tagged Text + format, then appends it to the writer. + + The LineString to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a LinearRing to <LinearRing Tagged Text + format, then appends it to the writer. + + The LinearRing to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a Polygon to Polygon Tagged Text format, + then appends it to the writer. + + The Polygon to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPoint to <MultiPoint Tagged Text + format, then appends it to the writer. + + The MultiPoint to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiLineString to MultiLineString Tagged + Text format, then appends it to the writer. + + The MultiLineString to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPolygon to MultiPolygon Tagged Text + format, then appends it to the writer. + + The MultiPolygon to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a GeometryCollection to GeometryCollection + Tagged Text format, then appends it to the writer. + + The GeometryCollection to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Appends the i'th coordinate from the sequence to the writer + + If the has coordinates that are NaN, + these are not written, even though suggests this. + + + the to process + A bit pattern of output ordinates + the index of the coordinate to write + writer the output writer to append to + The format to use for writing ordinate values + + + + + Converts a to a . + + The to convert. + A + + The as a . + + + + + Appends additional ordinate information. This function may + + + + append 'Z' if in the value is included. + + + + + append 'M' if in the value is included. + + + + + append 'ZM' if in the and + values are included. + + + + + A bit-pattern of ordinates to write. + the output writer to append to. + if an error occurs while using the writer. + + + + Appends all members of a to the stream. Each + is separated from another using a colon, the ordinates of a + are separated by a space. + + the to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + flag indicating that the first of the sequence should be indented for better visibility. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a Polygon to Polygon Text format, then + appends it to the writer. + + The Polygon to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + flag indicating that the first of the sequence should be indented for better visibility. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPoint to <MultiPoint Text format, then + appends it to the writer. + + The MultiPoint to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiLineString to <MultiLineString Text + format, then appends it to the writer. + + The MultiLineString to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPolygon to <MultiPolygon Text format, + then appends it to the writer. + + The MultiPolygon to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a GeometryCollection to GeometryCollectionText + format, then appends it to the writer. + + The GeometryCollection to process. + + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Extracts the subline of a linear between + two s on the line. + + + + + Computes the subline of a between + two s on the line. + If the start location is after the end location, + the computed linear geometry has reverse orientation to the input line. + + The line to use as the baseline. + The start location. + The end location. + The extracted subline. + + + + Initializes a new instance of the class. + + + + + + Extracts a subline of the input. + If is minor that , + the linear geometry computed will be reversed. + + The start location. + The end location. + A linear geometry. + + + + + + + + + + + Assumes input is valid + (e.g. minor or equals to ). + + + + + + + + Supports linear referencing along a linear + using the length along the line as the index. + Negative length values are taken as measured in the reverse direction + from the end of the geometry. + Out-of-range index values are handled by clamping + them to the valid range of values. + Non-simple lines (i.e. which loop back to cross or touch + themselves) are supported. + + + + + Constructs an object which allows a linear + to be linearly referenced using length as an index. + + The linear geometry to reference along. + + + + Computes the for the point + on the line at the given index. + If the index is out of range the first or last point on the + line will be returned. + + + The Z-ordinate of the computed point will be interpolated from + the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point. + The at the given index. + + + + Computes the for the point on the line at the given index, offset by the given distance. + + + If the index is out of range the first or last point on the line will be returned. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point + The distance the point is offset from the segment (positive is to the left, negative is to the right) + The Coordinate at the given index + + + + Computes the for the interval + on the line between the given indices. + If the lies before the , + the computed geometry is reversed. + + + + + + + + + + + + + + + Computes the minimum index for a point on the line. + If the line is not simple (i.e. loops back on itself) + a single point may have more than one possible index. + In this case, the smallest index is returned. + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + A point on the line. + The minimum index of the point. + + + + + Finds the index for a point on the line + which is greater than the given index. + If no such index exists, returns . + This method can be used to determine all indexes for + a point which occurs more than once on a non-simple line. + It can also be used to disambiguate cases where the given point lies + slightly off the line and is equidistant from two different + points on the line. + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + A point on the line. + The value the returned index must be greater than. + The index of the point greater than the given minimum index. + + + + + Computes the indices for a subline of the line. + (The subline must conform to the line; that is, + all vertices in the subline (except possibly the first and last) + must be vertices of the line and occur in the same order). + + A subLine of the line. + A pair of indices for the start and end of the subline.. + + + + Computes the index for the closest point on the line to the given point. + If more than one point has the closest distance the first one along the line is returned. + (The point does not necessarily have to lie precisely on the line.) + + + + + + + Returns the index of the start of the line. + + + + + Returns the index of the end of the line. + + + + + Tests whether an index is in the valid index range for the line. + + The index to test. + true if the index is in the valid range. + + + + Computes a valid index for this line + by clamping the given index to the valid range of index values + + A valid index value + + + + + + + + + Initializes a new instance of the class. + + A linear geometry. + + + + Find the nearest location along a linear to a given point. + + The coordinate to locate. + The location of the nearest point. + + + + Finds the nearest index along the linear + to a given after the specified minimum index. + If possible the location returned will be strictly + greater than the . + If this is not possible, the value returned + will equal . + (An example where this is not possible is when + = [end of line] ). + + The coordinate to locate. + The minimum location for the point location. + The location of the nearest point. + + + + + + + + + + + + + + + + + + + + + Computes the for a given length + along a linear + Negative lengths are measured in reverse from end of the linear geometry. + Out-of-range values are clamped. + + + + + Computes the for a + given length along a linear . + + The linear geometry to use. + The length index of the location. + The for the length. + + + + Computes the for a + given length along a linear , + with control over how the location + is resolved at component endpoints. + + The linear geometry to use + The length index of the location + If true lengths are resolved to the lowest possible index + + + + Computes the length for a given + on a linear . + + The linear geometry to use. + The index of the location. + The length for the . + + + + Initializes a new instance of the class. + + A linear geometry. + + + + Compute the corresponding to a length. + Negative lengths are measured in reverse from end of the linear geometry. + Out-of-range values are clamped. + Ambiguous indexes are resolved to the lowest possible location value. + + The length index. + The corresponding . + + + + Compute the corresponding to a length. + Negative lengths are measured in reverse from end of the linear geometry. + Out-of-range values are clamped. + Ambiguous indexes are resolved to the lowest or highest possible location value, + depending on the value of resolveLower + + The length index + + The corresponding . + + + + + + + + + + + + + + + + + + Builds a linear geometry ( or ) + incrementally (point-by-point). + + + + + Creates an instance of this class. + + The geometry factory to use. + + + + Allows invalid lines to be fixed rather than causing Exceptions. + An invalid line is one which has only one unique point. + + + + + Allows invalid lines to be ignored rather than causing Exceptions. + An invalid line is one which has only one unique point. + + + + + Adds a point to the current line. + + The to add. + + + + Adds a point to the current line. + + The to add. + If true, allows the insertions of repeated points. + + + + + + + + + Terminate the current . + + + + + + + + + + + + Builds and returns the . + + + + + + An iterator over the components and coordinates of a linear geometry + (s and s. + + + + + + + + + + + + Invariant: currentLine <> null if the iterator is pointing at a valid coordinate + + + + + Creates an iterator initialized to the start of a linear . + + The linear geometry to iterate over. + if is not + + + + Creates an iterator starting at a on a linear . + + The linear geometry to iterate over. + The location to start at. + if is not + + + + Creates an iterator starting at + a component and vertex in a linear . + + The linear geometry to iterate over. + The component to start at. + The vertex to start at. + if is not + + + + + + + + + Tests whether there are any vertices left to iterator over. + Specifically, HasNext() returns true if the + current state of the iterator represents a valid location + on the linear geometry. + + true if there are more vertices to scan. + + + + Jump to the next element of the iteration. + + + + + Checks whether the iterator cursor is pointing to the + endpoint of a component . + + + + + The component index of the vertex the iterator is currently at. + + + + + The vertex index of the vertex the iterator is currently at. + + + + + Gets the component the iterator is current at. + + + + + Gets the first of the current segment + (the coordinate of the current vertex). + + + + + Gets the second of the current segment + (the coordinate of the next vertex). + If the iterator is at the end of a line, null is returned. + + + + + Represents a location along a or .
+ The referenced geometry is not maintained within this location, + but must be provided for operations which require it. + Various methods are provided to manipulate the location value + and query the geometry it references. +
+
+ + + Gets a location which refers to the end of a linear . + + The linear geometry. + A new LinearLocation. + + + + Computes the of a point a given fraction + along the line segment (p0, p1). + + + + If the fraction is greater than 1.0 the last + point of the segment is returned. + If the fraction is less than or equal to 0.0 the first point + of the segment is returned. + + The Z ordinate is interpolated from the Z-ordinates of the given points, + if they are specified. + + The first point of the line segment. + The last point of the line segment. + The length to the desired point. + + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + Index of the segment. + The segment fraction. + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + Index of the component. + Index of the segment. + The segment fraction. + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + Index of the component. + Index of the segment. + The segment fraction. + If true, ensures the individual values are locally valid. + + + + Creates a new location equal to a given one. + + A linear location + + + + Ensures the individual values are locally valid. + Does not ensure that the indexes are valid for + a particular linear geometry. + + + + + Ensures the indexes are valid for a given linear . + + A linear geometry. + + + + Snaps the value of this location to + the nearest vertex on the given linear , + if the vertex is closer than . + + A linear geometry. + The minimum allowable distance to a vertex. + + + + Gets the length of the segment in the given + Geometry containing this location. + + A linear geometry. + The length of the segment. + + + + Sets the value of this location to + refer to the end of a linear geometry. + + The linear geometry to use to set the end. + + + + Gets the component index for this location. + + + + + Gets the segment index for this location. + + + + + Gets the segment fraction for this location. + + + + + Tests whether this location refers to a vertex: + returns true if the location is a vertex. + + + + + Gets the along the + given linear which is + referenced by this location. + + A linear geometry. + The at the location. + + + + Gets a representing the segment of the given linear which contains this location. + + A linear geometry + the LineSegment containing the location + + + + Tests whether this location refers to a valid + location on the given linear . + + A linear geometry. + true if this location is valid. + + + + Compares the current instance with another object of the same type. + + + The LineStringLocation with which this + Coordinate is being compared. + + + A negative integer, zero, or a positive integer as this + LineStringLocation is less than, equal to, + or greater than the specified LineStringLocation. + + + is not the same type as this instance. + + + + + Compares the current instance with another object of the same type. + + + The LineStringLocation with which this + Coordinate is being compared. + + + A negative integer, zero, or a positive integer as this + LineStringLocation is less than, equal to, + or greater than the specified LineStringLocation. + + + + + Compares this object with the specified index values for order. + + The component index. + The segment index. + The segment fraction. + + A negative integer, zero, or a positive integer as this LineStringLocation + is less than, equal to, or greater than the specified locationValues. + + + + + Compares two sets of location values for order. + + The first component index. + The first segment index. + The first segment fraction. + The second component index. + The second segment index. + The second segment fraction. + + A negative integer, zero, or a positive integer + as the first set of location values is less than, equal to, + or greater than the second set of locationValues. + + + + + Tests whether two locations are on the same segment in the parent . + + A location on the same geometry + true if the locations are on the same segment of the parent geometry + + + + Tests whether this location is an endpoint of + the linear component it refers to. + + The linear geometry referenced by this location + True if the location is a component endpoint + + + + Converts a linear location to the lowest equivalent location index. + The lowest index has the lowest possible component and segment indices. + Specifically: + * if the location point is an endpoint, a location value is returned as (nseg-1, 1.0) + * if the location point is ambiguous (i.e. an endpoint and a startpoint), the lowest endpoint location is returned + If the location index is already the lowest possible value, the original location is returned. + + The linear geometry referenced by this location. + The lowest equivalent location. + + + + + + + Gets the count of the number of line segments + in a . + This is one less than the number of coordinates. + + A LineString + The number of segments + + + + Supports linear referencing along a linear + using s as the index. + + + + + Constructs an object which allows linear referencing along + a given linear . + + The linear geometry to reference alo + + + + Computes the for the point on the line at the given index. + If the is out of range, + the first or last point on the line will be returned. + + + The Z-ordinate of the computed point will be interpolated from + the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point. + The at the given index. + + + + Computes the for the point + on the line at the given index, offset by the given distance. + If the index is out of range the first or last point on the + line will be returned. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + The Z-ordinate of the computed point will be interpolated from + the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point + The distance the point is offset from the segment + (positive is to the left, negative is to the right) + The Coordinate at the given index + + + + Computes the for the point on the line at the given index, offset by the given distance. + + + If the index is out of range the first or last point on the line will be returned. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point + The distance the point is offset from the segment (positive is to the left, negative is to the right) + The Coordinate at the given index + + + + Computes the for the interval + on the line between the given indices. + If the start location is after the end location, + the computed linear geometry has reverse orientation to the input line. + + The index of the start of the interval. + The index of the end of the interval. + The linear interval between the indices. + + + + Computes the index for a given point on the line. + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + A point on the line. + The index of the point. + + + + + Computes the indices for a subline of the line. + (The subline must conform to the line; that is, + all vertices in the subline (except possibly the first and last) + must be vertices of the line and occur in the same order). + + A subLine of the line. + A pair of indices for the start and end of the subline. + + + + Finds the index for a point on the line which is greater than the given index. + If no such index exists, returns . + + + + This method can be used to determine all indexes for + a point which occurs more than once on a non-simple line. + It can also be used to disambiguate cases where the given point lies + slightly off the line and is equidistant from two different + points on the line. + + + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + + A point on the line + The value the returned index must be greater than + The index of the point greater than the given minimum index + + + + + Computes the index for the closest point on the line to the given point. + If more than one point has the closest distance the first one along the line is returned. + (The point does not necessarily have to lie precisely on the line.) + + A point on the line. + The index of the point. + + + + Returns the index of the start of the line. + + + + + Returns the index of the end of the line. + + + + + Tests whether an index is in the valid index range for the line. + + The index to test. + true if the index is in the valid range. + + + + Computes a valid index for this line by clamping + the given index to the valid range of index values. + + + A valid index value. + + + + Determines the location of a subline along a linear . + The location is reported as a pair of s. + NOTE: Currently this algorithm is not guaranteed to + return the correct substring in some situations where + an endpoint of the test line occurs more than once in the input line. + (However, the common case of a ring is always handled correctly). + + + + + + + + + + + + + Initializes a new instance of the class. + + The linear geom. + + + + + + + + + + + Computes the of the point + on a linear nearest a given . + The nearest point is not necessarily unique; this class + always computes the nearest point closest + to the start of the geometry. + + + + + + + + + + + + + Initializes a new instance of the class. + + A linear geometry. + + + + Find the nearest location along a linear to a given point. + + The coordinate to locate. + The location of the nearest point. + + + + Find the nearest along the linear + to a given after the specified minimum . + If possible the location returned will be strictly greater than the . + If this is not possible, the value returned will equal . + (An example where this is not possible is when = [end of line] ). + + The coordinate to locate. + The minimum location for the point location. + The location of the nearest point. + + + + Implements extended-precision floating-point numbers + which maintain 106 bits (approximately 30 decimal digits) of precision. + + A DoubleDouble uses a representation containing two double-precision values. + A number x is represented as a pair of doubles, x.hi and x.lo, + such that the number represented by x is x.hi + x.lo, where +
+                |x.lo| <= 0.5*ulp(x.hi)
+            
+ and ulp(y) means "unit in the last place of y". + The basic arithmetic operations are implemented using + convenient properties of IEEE-754 floating-point arithmetic. + + The range of values which can be represented is the same as in IEEE-754. + The precision of the representable numbers + is twice as great as IEEE-754 double precision. + + The correctness of the arithmetic algorithms relies on operations + being performed with standard IEEE-754 double precision and rounding. + This is the Java standard arithmetic model, but for performance reasons + Java implementations are not + constrained to using this standard by default. + Some processors (notably the Intel Pentium architecture) perform + floating point operations in (non-IEEE-754-standard) extended-precision. + A JVM implementation may choose to use the non-standard extended-precision + as its default arithmetic mode. + To prevent this from happening, this code uses the + Java strictfp modifier, + which forces all operations to take place in the standard IEEE-754 rounding model. + + The API provides both a set of value-oriented operations + and a set of mutating operations. + Value-oriented operations treat DoubleDouble values as + immutable; operations on them return new objects carrying the result + of the operation. This provides a simple and safe semantics for + writing DoubleDouble expressions. However, there is a performance + penalty for the object allocations required. + The mutable interface updates object values in-place. + It provides optimum memory performance, but requires + care to ensure that aliasing errors are not created + and constant values are not changed. + + This implementation uses algorithms originally designed variously by + Knuth, Kahan, Dekker, and Linnainmaa. + Douglas Priest developed the first C implementation of these techniques. + Other more recent C++ implementation are due to Keith M. Briggs and David Bailey et al. +

References

+ + Priest, D., Algorithms for Arbitrary Precision Floating Point Arithmetic, + in P. Kornerup and D. Matula, Eds., Proc. 10th Symposium on Computer Arithmetic, + IEEE Computer Society Press, Los Alamitos, Calif., 1991. + Yozo Hida, Xiaoye S. Li and David H. Bailey, + Quad-Double Arithmetic: Algorithms, Implementation, and Application, + manuscript, Oct 2000; Lawrence Berkeley National Laboratory Report BNL-46996. + David Bailey, High Precision Software Directory; + http://crd.lbl.gov/~dhbailey/mpdist/index.html + +
+ Martin Davis +
+ + The value nearest to the constant Pi. + + + The value nearest to the constant 2 * Pi. + + + The value nearest to the constant Pi / 2. + + + + The value nearest to the constant e (the natural logarithm base). + + + + + A value representing the result of an operation which does not return a valid number. + + + + + The smallest representable relative difference between two values + + + + + Converts the string argument to a DoubleDouble number. + + A string containing a representation of a numeric value + The extended precision version of the value + Thrown if is not a valid representation of a number + + + + Operator to parse a DoubleDouble from a string + + The DoubleDouble string + + + + Converts the double argument to a DoubleDouble number. + + A numeric value + The extended precision version of the value + + + + Operator to convert the double value to a DoubleDouble value. + + The DoubleDouble string + + + + The value to split a double-precision value on during multiplication + + + + + The high-order component of the double-double precision value. + + + + + The low-order component of the double-double precision value. + + + + + Creates a new with value x. + + The initial value + + + + Creates a new with value (hi, lo). + + The high order component + The low order component + + + + Creates a with a value equal to the argument + + The initial value + + + + Creates a new with value equal to the argument. + + The value to initialize by + if is not a valid representation of a number + + + + Creates a new with the value of the argument. + + The value to copy + A copy of + + + + Creates and returns a copy of this value. + + A copy of this value + + + + Returns the sum of and . + + The left hand side + The right hand side + The sum of and + + + + Returns the sum of and . + + The left hand side + The right hand side + The sum of and + + + + Returns the difference of and . + + The left hand side + The right hand side + The difference of and + + + + Returns the difference of and . + + The left hand side + The right hand side + The difference of and + + + + Subtracts the argument from the value of this. + + The subtrahend + The result of this - y + + + + Multiplies by . + + A DoubleDouble value. + A double value. + The result of the multiplication. + + + + Multiplies by . + + A DoubleDouble value. + A DoubleDouble value. + The result of the multiplication. + + + + Divides by . + + A DoubleDouble numerator. + A double divisor. + The result of the division. + + + + Divides by . + + A DoubleDouble numerator. + A DoubleDouble divisor. + The result of the division. + + + + Returns a whose value is 1 / this. + + The reciprocal of this value + + + + Computes the determinant of the 2x2 matrix with the given entries. + + A matrix entry + A matrix entry + A matrix entry + A matrix entry + The determinant of the matrix of values + + + + Computes the determinant of the 2x2 matrix with the given entries. + + A matrix entry + A matrix entry + A matrix entry + A matrix entry + The determinant of the matrix of values + + + + Computes the minimum of this and another DD number. + + A DD number + The minimum of the two numbers + + + + Computes the maximum of this and another DD number. + + A DD number + The maximum of the two numbers + + + + Returns the largest (closest to positive infinity) + value that is not greater than the argument + and is equal to a mathematical integer. + Special cases: + + If this value is NaN, returns NaN. + + + The largest (closest to positive infinity) + value that is not greater than the argument + and is equal to a mathematical integer. + + + + + Returns the smallest (closest to negative infinity) value + that is not less than the argument and is equal to a mathematical integer. + Special cases: + + If this value is NaN, returns NaN. + + + + The smallest (closest to negative infinity) value + that is not less than the argument and is equal to a mathematical integer. + + + + + Returns an integer indicating the sign of this value. + + + if this value is > 0, returns 1 + if this value is < 0, returns -1 + if this value is = 0, returns 0 + if this value is NaN, returns 0 + + + + An integer indicating the sign of this value + + + + Rounds this value to the nearest integer. + The value is rounded to an integer by adding 1/2 and taking the floor of the result. + Special cases: + + If this value is NaN, returns NaN. + + + This value rounded to the nearest integer + + + + Returns the integer which is largest in absolute value and not further + from zero than this value. + + Special cases: + + If this value is NaN, returns NaN. + + + + The integer which is largest in absolute value and not further from zero than this value + + + + + Returns the absolute value of this value. + + Special cases: + + if this value is NaN, it is returned. + + + The absolute value of this value + + + + Computes the square of this value. + + The square of this value + + + + Computes the square of this value. + + The square of this value. + + + + Computes the positive square root of this value. + If the number is NaN or negative, NaN is returned. + + If this is NaN or less than zero, the result is NaN. + + + + Computes the positive square root of a DoubleDouble value. + If the number is NaN or negative, NaN is returned. + + A numeric value + the positive square root of this number. + If the argument is NaN or less than zero, the result is NaN. + + + + Computes the value of this number raised to an integral power. + Follows semantics of .Net Math.Pow as closely as possible. + + The integer exponent + x raised to the integral power exp + + + + Converts this value to the nearest number. + + The nearest value + + + + Converts this value to the nearest value. + + The nearest value + + + + Gets a value indicating whether this object is zero (0) or not + + + + + Gets a value indicating whether this object is negative or not + + + + + Gets a value indicating whether this object is positive or not + + + + + Gets a value indicating whether this object is positive or not + + + + + Checks if is infinity. + + A DoubleDouble value + true if value is infinity. + + + + Tests whether this value is equal to another DoubleDouble value. + + A DoubleDouble value + true if this value == . + + + + Equality operator for DoubleDouble values + + A DoubleDouble value + A DoubleDouble value + true if == . + + + + Inequality operator for DoubleDouble values + + A DoubleDouble value + A DoubleDouble value + true if != . + + + + Tests whether this value is greater than another DoubleDouble value. + + A DoubleDouble value + true if this value > . + + + + Tests whether this value is greater than or equals to another DoubleDouble value. + + A DoubleDouble value + true if this value >= . + + + + Tests whether this value is less than another DoubleDouble value. + + A DoubleDouble value + true if this value is < + + + + Tests whether this value is less than or equal to another DoubleDouble value. + + A DoubleDouble + true if this value is <= + + + + Compares two DoubleDouble objects numerically. + + An other DoubleDouble value + + -1,0 or 1 depending on whether this value is less than, equal to + or greater than the value of + + + + + + + Dumps the components of this number to a string. + + A string showing the components of the number + + + + Returns a string representation of this number, in either standard or scientific notation. + If the magnitude of the number is in the range [ 10-3, 108 ] + standard notation will be used. Otherwise, scientific notation will be used. + + A string representation of this number + + + + Returns the string representation of this value in standard notation. + + The string representation in standard notation + + + + Returns the string representation of this value in scientific notation. + + The string representation in scientific notation + + + + Extracts the significant digits in the decimal representation of the argument. + A decimal point may be optionally inserted in the string of digits + (as long as its position lies within the extracted digits + - if not, the caller must prepend or append the appropriate zeroes and decimal point). + + + + The string containing the significant digits and possibly a decimal point + + + + Returns the string for this value if it has a known representation (e.g. NaN or 0.0). + + The string for this special number
+ or null if the number is not a special number
+
+ + + Determines the decimal magnitude of a number. + The magnitude is the exponent of the greatest power of 10 which is less than + or equal to the number. + + The number to find the magnitude of + The decimal magnitude of + + + + Converts a string representation of a real number into a DoubleDouble value. + The format accepted is similar to the standard Java real number syntax. + It is defined by the following regular expression: +
+            [+|-] {digit} [ . {digit} ] [ ( e | E ) [+|-] {digit}+
+            
+
+ The string to parse + The value of the parsed number + Thrown if str is not a valid representation of a number +
+ + + + + + + + + Various utility functions for mathematical and numerical operations. + + + + + Clamps a double value to a given range. + + The value to clamp + The minimum value of the range + The maximum value of the range + The clamped value + + + + Clamps a int value to a given range. + + The value to clamp + The minimum value of the range + The maximum value of the range + The clamped value + + + + Clamps an integer to a given maximum limit. + + The value to clamp + The maximum value of the range + The clamped value + + + + Computes the ceiling function of the dividend of two integers. + + The numerator + The denominator + The ceiling of num / denom + + + + Computes the base-10 logarithm of a double value. + + + If the argument is NaN or less than zero, then the result is NaN. + If the argument is positive infinity, then the result is positive infinity. + If the argument is positive zero or negative zero, then the result is negative infinity. + + + + A positive number + The value log a, the base-10 logarithm of the input value + + + + Computes an index which wraps around a given maximum value. + For values >= 0, this is equals to val % max. + For values < 0, this is equal to max - (-val) % max + + The index to wrap + The maximum value (or modulus) + The wrapped index + + + + Computes the average of two numbers. + + A number + A number + The average of the inputs + + + + Computes the maximum fo three values + + A number + A number + A number + The maximum value of , and + + + + Computes the maximum of four values + + A number + A number + A number + A number + The maximum value of , , and + + + + Computes the minimum of four values + + A number + A number + A number + The minimum value of , and + + + + Computes the minimum of four values + + A number + A number + A number + A number + The minimum value of , , and + + + The inverse of the Golden Ratio phi. + + + + + + Implements some 2D matrix operations + (in particular, solving systems of linear equations). + + Martin Davis + + + + Solves a system of equations using Gaussian Elimination. + In order to avoid overhead the algorithm runs in-place + on - if should not be modified the client must supply a copy. + + An nxn matrix in row/column order )modified by this method) + A vector of length n + A vector containing the solution (if any)
or null if the system has no or no unique solution +
+ If the matrix has the wrong size +
+ + + Enumeration for the 3 coordinate planes + + + + + Models a plane in 3-dimensional Cartesian space. + + Martin Davis + + + + Computes the oriented distance from a point to the plane.
+ The distance is: + + positive if the point lies above the plane (relative to the plane normal) + zero if the point is on the plane + negative if the point lies below the plane (relative to the plane normal) + +
+ The point to compute the distance for + The oriented distance to the plane +
+ + + Computes the axis plane that this plane lies closest to. + + Geometries lying in this plane undergo least distortion + (and have maximum area) + when projected to the closest axis plane. + This provides optimal conditioning for + computing a Point-in-Polygon test. + + The index of the closest axis plane + + + + A 2-dimensional mathematical vector represented by double-precision X and Y components. + + mbdavis + + + + Creates a new vector with all components set to Zero + + + + + Creates a new vector with given X and Y components. + + The x component + The y component + A new vector + + + + Creates a new vector from an existing one. + + The vector to copy + A new vector + + + + Creates a vector from a . + + The coordinate to copy + A new vector + + + Creates a vector with the direction and magnitude + of the difference between the + and s. + + The origin coordinate + The destination coordinate + A new vector + + + The X component of this vector + + + The Y component of this vector. + + + + Creates an new vector instance + + + + + Creates a new vector instance using the provided and ordinates + + The x-ordinate value + The y-ordinate value + + + + Creates a new vector instance based on . + + The vector + + + Creates a new vector with the direction and magnitude + of the difference between the + and s. + + The origin coordinate + The destination coordinate + + + + Creates a vector from a . + + The coordinate + A new vector + + + + Gets the x-ordinate value + + + + + Gets the y-ordinate value + + + + + Gets the ordinate values by index + + The index + Thrown if index < 0 or > 1 + + + + Adds to this vector instance. + + The vector to add + The result vector + + + + Subtracts from this vector instance + + The vector to subtract + The result vector + + + + Multiplies the vector by a scalar value. + + The value to multiply by + A new vector with the value v * d + + + + Divides the vector by a scalar value. + + The value to divide by + A new vector with the value v / d + + + + Negates this vector + + A new vector with [-_x, -_y] + + + + + + + + + + + + + + + + Normalizes the vector + + A new normalized vector + + + + + + + + + + + Computes the weighted sum of this vector + with another vector, + with this vector contributing a fraction + of frac to the total. + + In other words, +
+            sum = frac * this + (1 - frac) * v
+            
+
+ The vector to sum + The fraction of the total contributed by this vector + The weighted sum of the two vectors +
+ + + Computes the distance between this vector and another one. + + A vector + The distance between the vectors + + + + Computes the dot-product of two vectors + + A vector + The dot product of the vectors + + + + Computes the angle this vector describes to the horizontal axis + + The angle + + + + + + + + + + + + + + + + + + Rotates this vector by + + The angle + The rotated vector + + + + Rotates a vector by a given number of quarter-circles (i.e. multiples of 90 + degrees or Pi/2 radians). A positive number rotates counter-clockwise, a + negative number rotates clockwise. Under this operation the magnitude of + the vector and the absolute values of the ordinates do not change, only + their sign and ordinate index. + + The number of quarter-circles to rotate by + The rotated vector. + + + + + + + + + + + Gets a made of this vector translated by . + + The translation coordinate + A coordinate + + + + Gets a from this vector + + A coordinate + + + + Creates a copy of this vector + + A copy of this vector + + + + Gets a string representation of this vector + + A string representing this vector + + + + Tests if a vector has the same values for the x and y components. + + A with which to do the comparison. + true if is a with the same values for the X and Y components. + + + + Gets a hashcode for this vector. + + A hashcode for this vector + + + + Adds two vectors. + + The first vector to add. + The second vector to add. + The sum of the two vectors. + + + + Modulates a vector with another by performing component-wise multiplication"/>. + + The first vector to multiply. + The second vector to multiply. + The multiplication of the two vectors. + + + + Subtracts two vectors. + + The first vector to subtract. + The second vector to subtract. + The difference of the two vectors. + + + + Reverses the direction of a given vector. + + The vector to negate. + A vector facing in the opposite direction. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Tests for equality between two objects. + + The first value to compare. + The second value to compare. + true if has the same value as + ; otherwise, false. + + + + Tests for inequality between two objects. + + The first value to compare. + The second value to compare. + true if has a different value + than ; otherwise, false. + + + + Represents a vector in 3-dimensional Cartesian space. + + Martin Davis + + + + Creates a new vector with all components set to Zero + + + + + Computes the dot product of the 3D vectors AB and CD. + + The start point of the 1st vector + The end point of the 1st vector + The start point of the 2nd vector + The end point of the 2nd vector + The dot product + + + + Calculates the cross product of two vectors. + + First source vector. + Second source vector. + + + + Creates a new vector with given , and components. + + The x component + The y component + The z component + A new vector + + + + Creates a vector from a 3D . + + The coordinate should have the + X,Y and Z ordinates specified. + + The coordinate to copy + A new vector + + + + Computes the 3D dot-product of two s + + The 1st vector + The 2nd vector + The dot product of the (coordinate) vectors + + + + Creates a new 3D vector from a . The coordinate should have + the X,Y and Z ordinates specified. + + The coordinate to copy + + + + Creates a new vector with the direction and magnitude + of the difference between the + and s. + + The origin coordinate + The destination coordinate + + + + Creates a new vector with the given , and components + + The x component + The y component + The z component + + + + Creates a new using a plus a value for component + + A vector containing the values with which to initialize the X and Y components. + Initial value for the Z component of the vector. + + + + Gets a value indicating the x-ordinate + + + + + Gets a value indicating the y-ordinate + + + + + Gets a value indicating the z-ordinate + + + + + Computes a vector which is the sum + of this vector and the given vector. + + The vector to add + The sum of this and v + + + + Computes a vector which is the difference + of this vector and the given vector. + + The vector to subtract + The difference of this and v + + + + Creates a new vector which has the same direction + and with length equals to the length of this vector + divided by the scalar value d. + + The scalar divisor + A new vector with divided length + + + + Computes the dot-product of this and + + The 2nd vector + The dot product of the vectors + + + + Computes the cross-product of this and + + The 2nd vector + The cross product of the vectors + + + + Computes the length of this vector + + The length of this vector + + + + Computes the length of vector . + + A coordinate representing a 3D Vector + The length of + + + + Computes a vector having identical direction + but normalized to have length 1. + + A new normalized vector + + + + Computes a vector having identical direction as v + but normalized to have length 1. + + A coordinate representing a 3D vector + A coordinate representing the normalized vector + + + + + + + + + + + + + Adds two vectors. + + The first vector to add. + The second vector to add. + The sum of the two vectors. + + + + Modulates a vector with another by performing component-wise multiplication. + + The first vector to multiply. + The second vector to multiply. + The multiplication of the two vectors. + + + + Assert a vector (return it unchanged). + + The vector to assert (unchanged). + The asserted (unchanged) vector. + + + + Subtracts two vectors. + + The first vector to subtract. + The second vector to subtract. + The difference of the two vectors. + + + + Reverses the direction of a given vector. + + The vector to negate. + A vector facing in the opposite direction. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Tests for equality between two objects. + + The first value to compare. + The second value to compare. + true if has the same value as ; otherwise, false. + + + + Tests for inequality between two objects. + + The first value to compare. + The second value to compare. + true if has a different value than ; otherwise, false. + + + + Functions for performing vector mathematics. + + + + + Computes the normal vector to the triangle p0-p1-p2. In order to compute the normal each + triangle coordinate must have a Z value. If this is not the case, the returned Coordinate + will have NaN values. The returned vector has unit length. + + A point + A point + A point + The normal vector to the triangle -- + + + + Normalizes the vector + + The normalized + + + + Computes the cross product of and + + A vector + A vector + The cross product of and + + + + Computes the dot product of and + + A vector + A vector + The dot product of and + + + + Computes the determinant of a 2x2 matrix + + The m[0,0] value + The m[0,1] value + The m[1,0] value + The m[1,1] value + The determinant + + + + Represents a read-only list of contiguous line segments. + This can be used for detection of intersections or nodes. + s can carry a context object, which is useful + for preserving topological or parentage information. + + If adding nodes is required use . + + + + + + Creates a new segment string from a list of vertices. + + the vertices of the segment string + the user-defined data of this segment string (may be null) + + + Gets the user-defined data for this segment string. + + + + + Gets the octant of the segment starting at vertex index + + the index of the vertex starting the segment. Must not be the last index in the vertex list + octant of the segment at the vertex + + + + + + + Validates that a collection of s is correctly noded. + Indexing is used to improve performance. + + + + By default validation stops after a single + non-noded intersection is detected. + Alternatively, it can be requested to detect all intersections + by using the property. + + The validator does not check for topology collapse situations + (e.g. where two segment strings are fully co-incident). + + The validator checks for the following situations which indicated incorrect noding: + + Proper intersections between segments (i.e. the intersection is interior to both segments) + Intersections at an interior vertex (i.e. with an endpoint or another interior vertex) + + + + The client may either test the condition, + or request that a suitable be thrown. + + + + + + + Gets a list of all intersections found. + Intersections are represented as s. + List is empty if none were found. + A collection of SegmentStrings + a list of + + + + + Creates a new noding validator for a given set of linework. + + A collection of s + + + + Gets or sets whether all intersections should be found. + + + + + Gets a list of all intersections found. + + Intersections are represented as s. + List is empty if none were found. + + + + + + Checks for an intersection and reports if one is found. + + + + + Returns an error message indicating the segments containing the intersection. + + an error message documenting the intersection location + + + + Checks for an intersection and throws + a TopologyException if one is found. + + if an intersection is found + + + + Finds if two sets of s intersect. + + + Uses indexing for fast performance and to optimize repeated tests + against a target set of lines. + Short-circuited to return as soon an intersection is found. + + Immutable and thread-safe. + + + + + Creates an intersection finder against a given set of segment strings. + + The segment strings to search for intersections + + + Gets the segment set intersector used by this class. + This allows other uses of the same underlying indexed structure. + + + + Tests for intersections with a given set of target s. + + The SegmentStrings to test + true if an intersection was found + + + + Tests for intersections with a given set of target s. + using a given SegmentIntersectionDetector. + + The SegmentStrings to test + The intersection detector to use + true if the detector reports intersections + + + + An interface for classes which support adding nodes to a segment string. + + + + Adds an intersection node for a given point and segment to this segment string. + + the location of the intersection + the index of the segment containing the intersection + + + + Computes all intersections between segments in a set of s. + Intersections found are represented as s and added to the + s in which they occur. + As a final step in the noding a new set of segment strings split at the nodes may be returned. + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Finds interior intersections + between line segments in s, + and adds them as nodes + using . + This class is used primarily for Snap-Rounding. + For general-purpose noding, use . + + + + + + Creates an intersection finder which finds all proper intersections. + + The to use. + + + + + + + + + This method is called by clients + of the class to process + intersections for two segments of the s being intersected.
+ Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). +
+ + + + +
+ + + Always process all intersections + + + + + Computes the possible intersections between two line segments in s + and adds them to each string + using . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initializes a new instance of the class. + + + + + + + + + + + Returns the proper intersection point, or null if none was found. + + + + + + + + + + A proper intersection is an intersection which is interior to at least two + line segments. Note that a proper intersection is not necessarily + in the interior of the entire , since another edge may have + an endpoint equal to the intersection, which according to SFS semantics + can result in the point being on the Boundary of the . + + + + + A proper interior intersection is a proper intersection which is not + contained in the set of boundary nodes set for this . + + + + + An interior intersection is an intersection which is + in the interior of some segment. + + + + + A trivial intersection is an apparent self-intersection which in fact + is simply the point shared by adjacent line segments. + Note that closed edges require a special check for the point shared by the beginning and end segments. + + + + + + + + + + This method is called by clients + of the class to process + intersections for two segments of the being intersected.
+ Note that some clients (such as MonotoneChain") may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). +
+ + + + +
+ + + Always process all intersections + + + + + Processes possible intersections detected by a . + + + + The is passed to a . + + The + method is called whenever the + detects that two s might intersect. + + This class may be used either to find all intersections, or + to detect the presence of an intersection. In the latter case, + Noders may choose to short-circuit their computation by calling the + property. + + + + This class is an example of the Strategy pattern. + + This class may be used either to find all intersections, or + to detect the presence of an intersection. In the latter case, + Noders may choose to short-circuit their computation by calling the + property. + + + + + + This method is called by clients + of the interface to process + intersections for two segments of the s being intersected. + + + + + + + + + Reports whether the client of this class needs to continue testing + all intersections in an arrangement. + + if there is no need to continue testing segments + + + + An interface for classes which represent a sequence of contiguous line segments. + SegmentStrings can carry a context object, which is useful + for preserving topological or parentage information. + + + + + Gets/Sets the user-defined data for this segment string. + + + + + Points that make up ISegmentString + + + + + Size of Coordinate Sequence + + + + + States whether ISegmentString is closed + + + + + Nodes a set of s completely. + The set of s is fully noded; + i.e. noding is repeated until no further intersections are detected. + + Iterated noding using a precision model is not guaranteed to converge, + due to round off error. This problem is detected and an exception is thrown. + Clients can choose to rerun the noding using a lower precision model. + + + + + + + + + + + Initializes a new instance of the class. + + + + + + Gets/Sets the maximum number of noding iterations performed before + the noding is aborted. Experience suggests that this should rarely need to be changed + from the default. The default is . + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Fully nodes a list of s, i.e. performs noding iteratively + until no intersections are found between segments. + Maintains labelling of edges correctly through the noding. + + A collection of SegmentStrings to be noded. + If the iterated noding fails to converge. + + + + Node the input segment strings once + and create the split edges between the nodes. + + + + + + + Nodes a set of s using a index based + on s and a . + The used should be something that supports + envelope (range) queries efficiently (such as a Quadtree" + or . + + The noder supports using an overlap tolerance distance. + This allows determining segment intersection using a buffer for uses + involving snapping with a distance tolerance. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The to use. + + + + Initializes a new instance of the class. + + The to use. + The expansion distance for overlap tests + + + + + + + + + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + + + + + + + + + + + + + + + + + Initializes a new instance of the class. + + The + + + + + + + + + + + + + Intersects two sets of s using a index based + on s and a . + + Thread-safe and immutable. + + + + + Constructs a new intersector for a given set of s. + + The base segment strings to intersect + + + + Gets the index constructed over the base segment strings + + NOTE: To retain thread-safety, treat returned value as immutable + + + + Calls + for all candidate intersections between + the given collection of SegmentStrings and the set of indexed segments. + + A set of segments to intersect + The SegmentIntersector to use + + + + Segment overlap action class + + + + + Creates an instance of this class using the provided + + The segment intersector to use + + + + Represents a list of contiguous line segments, and supports noding the segments. + The line segments are represented by an array of s. + Intended to optimize the noding of contiguous segments by + reducing the number of allocated objects. + s can carry a context object, which is useful + for preserving topological or parentage information. + All noded substrings are initialized with the same context object. + + For read-only applications use , + which is (slightly)more lightweight. + + + + + + Gets the s which result from splitting this string at node points. + + A collection of NodedSegmentStrings + A collection of NodedSegmentStrings representing the substrings + + + + Adds the noded s which result from splitting this string at node points. + + A collection of NodedSegmentStrings + A list which will collect the NodedSegmentStrings representing the substrings + + + + Creates an instance from a list of vertices and optional data object. + + The vertices of the segment string. + The user-defined data of this segment string (may be null). + + + + Creates a new instance from a . + + The segment string to use. + + + + Gets/Sets the user-defined data for this segment string. + + In JTS this property is called Data + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets a list of coordinates with all nodes included. + + An array of coordinates including nodes + + + + + + + + + Gets the octant of the segment starting at vertex index. + + + The index of the vertex starting the segment. + Must not be the last index in the vertex list + + The octant of the segment at the vertex + + + + Adds EdgeIntersections for one or both + intersections found for a segment of an edge to the edge intersection list. + + + + + + + + Add an for intersection intIndex. + An intersection that falls exactly on a vertex + of the is normalized + to use the higher of the two possible segmentIndexes. + + + + + + + + + + + + + + + + + + + Finds non-noded intersections in a set of {@link SegmentString}s, + if any exist. + + Non-noded intersections include: + + Interior intersectionswhich lie in the interior of a segment + (with another segment interior or with a vertex or endpoint) + Vertex intersectionswhich occur at vertices in the interior of s + (with a segment string endpoint or with another interior vertex) + + The finder can be limited to finding only interior intersections + by setting . + + By default only the first intersection is found, + but all can be found by setting . + + + + + Creates a finder which tests if there is at least one intersection. + Uses short-circuiting for efficient performance. + The intersection found is recorded. + + A line intersector. + A finder which tests if there is at least one intersection. + + + + Creates a finder which tests if there is at least one intersection. + The intersections are recorded for later inspection. + + A line intersector. + A finder which finds all intersections. + + + + Creates a finder which finds all interior intersections. + The intersections are recorded for later inspection. + + A line intersector + A finder which finds all interior intersections. + + + + Creates a finder which counts all intersections. + The intersections are note recorded to reduce memory usage. + + A line intersector. + A finder which counts all intersections. + + + + Creates a finder which counts all interior intersections. + The intersections are note recorded to reduce memory usage. + + A line intersector. + A finder which counts all interior intersections. + + + + Creates an intersection finder which finds an interior intersection if one exists + + the LineIntersector to use + + + + Gets/Sets whether all intersections should be computed. + + When this is false (the default value), the value of + is true after the first intersection is found. + Default is false. + + + + + + Gets or sets a value indicating whether only interior (proper) intersections will be found. + + + + + Gets/Sets whether intersection points are recorded. + + If the only need is to count intersection points, this can be set to false. + Default is true. + + + + + + Gets/Sets whether only end segments should be tested for intersection. + This is a performance optimization that may be used if + the segments have been previously noded by an appropriate algorithm. + It may be known that any potential noding failures will occur only in + end segments. + + + + + Tests whether an intersection was found. + + + + + Gets the intersections found. + + A list of . + + + + Gets the count of intersections found. + + The intersection count. + + + + Gets the computed location of the intersection. + Due to round-off, the location may not be exact. + + + + + Gets the computed location of the intersection. + Due to round-off, the location may not be exact. + + + + + Gets the endpoints of the intersecting segments. + + + + + This method is called by clients of the class to process + intersections for two segments of the s being intersected.
+ Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). +
+ + + + +
+ + + Tests if an intersection occurs between a segmentString interior vertex and another vertex. + Note that intersections between two endpoint vertices are valid noding, + and are not flagged. + + A segment vertex + A segment vertex + A segment vertex + A segment vertex + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if an intersection is found/ + + + + Tests if two vertices with at least one in a segmentString interior + are equal. + + A segment vertex + A segment vertex + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if an intersection is found + + + + Tests whether a segment in a is an end segment. + (either the first or last). + + a segment string + the index of a segment in the segment string + true if the segment is an end segment + + + + + + + + + Validates that a collection of s is correctly noded. + Throws an appropriate exception if an noding error is found. + + + + + Creates a new validator for the given collection + of s. + + The seg strings. + + + + Checks whether the supplied segment strings + are correctly noded. Throws an exception if they are not. + + + + + Checks if a segment string contains a segment pattern a-b-a (which implies a self-intersection). + + + + + Checks all pairs of segments for intersections at an interior point of a segment. + + + + + Checks for intersections between an endpoint of a segment string + and an interior vertex of another segment string + + + + + Octants in the Cartesian plane. + Octants are numbered as follows: + + \2|1/ + 3 \|/ 0 + ---+-- + 4 /|\ 7 + /5|6\ + + If line segments lie along a coordinate axis, the octant is the lower of the two possible values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Methods for computing and working with of the Cartesian plane. + + + + + Returns the octant of a directed line segment (specified as x and y + displacements, which cannot both be 0). + + + + + + + + Returns the octant of a directed line segment from p0 to p1. + + + + + + + + Allows comparing arrays in an orientation-independent way. + + + + + Creates a new } + for the given array. + + + + + + Computes the canonical orientation for a coordinate array. + + + + true if the points are oriented forwards
+ or falseif the points are oriented in reverse. +
+
+ + + Compares two s for their relative order. + + + + -1 this one is smaller;
+ 0 the two objects are equal;
+ 1 this one is greater. +
+
+ + + + + + + + + + + + + Wraps a and transforms its input into the integer domain. + This is intended for use with Snap-Rounding noders, + which typically are only intended to work in the integer domain. + + Clients should be aware that rescaling can involve loss of precision, + which can cause zero-length line segments to be created. + These in turn can cause problems when used to build a planar graph. + This situation should be checked for and collapsed segments removed if necessary. + + + + + + Initializes a new instance of the class. + + The noder to use + The scale factor to use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A noder which extracts all line segments + as s. + This enables fast overlay of geometries which are known to be already fully noded. + In particular, it provides fast union of polygonal and linear coverages. + Unioning a noded set of lines is an effective way + to perform line merging and line dissolving. + + No precision reduction is carried out. + If that is required, another noder must be used (such as a snap-rounding noder), + or the input must be precision-reduced beforehand. + + Martin Davis + + + + Detects and records an intersection between two s, + if one exists. Only a single intersection is recorded. + + + This strategy can be configured to search for proper intersections. + In this case, the presence of any intersection will still be recorded, + but searching will continue until either a proper intersection has been found + or no intersections are detected. + + + + + Creates an intersection finder using a + + + + + Creates an intersection finder using a given + + The LineIntersector to use + + + + Gets or sets whether processing must continue until a proper intersection is found + + + + + Gets or sets whether processing can terminate once any intersection is found. + + + + + Tests whether an intersection was found. + + + + + Tests whether a proper intersection was found. + + + + + Tests whether a non-proper intersection was found. + + + + + Gets the computed location of the intersection. Due to round-off, the location may not be exact. + + + + Gets the endpoints of the intersecting segments. + + An array of the segment endpoints (p00, p01, p10, p11) + + + + This method is called by clients of the class to process + intersections for two segments of the s being intersected. + + + Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). + + + + + Tests whether processing can terminate, + because all required information has been obtained + (e.g. an intersection of the desired type has been detected). + + + + + Represents an intersection point between two s. + + + + + + + + + + + + + + + Initializes a new instance of the class. + + + + + + + + + Gets the giving the location of this node. + + + + + + + + + + + + + + + + + + + + + -1 this SegmentNode is located before the argument location;
+ 0 this SegmentNode is at the argument location;
+ 1 this SegmentNode is located after the argument location. +
+
+ + + + + + + + > + + + + A list of the s present along a noded . + + + + + Initializes a new instance of the class. + + The edge. + + + + + + + + + + Adds an intersection into the list, if it isn't already there. + The input segmentIndex and dist are expected to be normalized. + + + + The SegmentIntersection found or added. + + + + Returns an iterator of SegmentNodes. + + An iterator of SegmentNodes. + + + + Adds nodes for the first and last points of the edge. + + + + + Adds nodes for any collapsed edge pairs. + Collapsed edge pairs can be caused by inserted nodes, or they can be + pre-existing in the edge vertex list. + In order to provide the correct fully noded semantics, + the vertex at the base of a collapsed pair must also be added as a node. + + + + + Adds nodes for any collapsed edge pairs + which are pre-existing in the vertex list. + + + + + + Adds nodes for any collapsed edge pairs caused by inserted nodes + Collapsed edge pairs occur when the same coordinate is inserted as a node + both before and after an existing edge vertex. + To provide the correct fully noded semantics, + the vertex must be added as a node as well. + + + + + + + + + + + + + + + Creates new edges for all the edges that the intersections in this + list split the parent edge into. + Adds the edges to the provided argument list + (this is so a single list can be used to accumulate all split edges + for a set of s). + + + + + + Create a new "split edge" with the section of points between + (and including) the two intersections. + The label for the new edge is the same as the label for the parent edge. + + + + + + + + Extracts the points for a split edge running between two nodes. + The extracted points should contain no duplicate points. + There should always be at least two points extracted + (which will be the given nodes). + + The start node of the split edge + The end node of the split edge + The points for the split edge + + + Gets the list of coordinates for the fully noded segment string, + including all original segment string vertices and vertices + introduced by nodes in this list. + Repeated coordinates are collapsed. + + An array of s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Implements a robust method of comparing the relative position of two points along the same segment. + The coordinates are assumed to lie "near" the segment. + This means that this algorithm will only return correct results + if the input coordinates have the same precision and correspond to rounded values + of exact coordinates lying on the segment. + + + + + Compares two s for their relative position along a segment + lying in the specified . + + + + + + -1 if node0 occurs first, or
+ 0 if the two nodes are equal, or
+ 1 if node1 occurs first. +
+
+ + + + + + + + + + + + + + + + + + + An intersector for the red-blue intersection problem. + In this class of line arrangement problem, + two disjoint sets of linestrings are intersected. + + Implementing classes must provide a way + of supplying the base set of segment strings to + test against (e.g. in the constructor, + for straightforward thread-safety). + + In order to allow optimizing processing, + the following condition is assumed to hold for each set: + + the only intersection between any two linestrings occurs at their endpoints. + + Implementations can take advantage of this fact to optimize processing + (i.e. by avoiding testing for intersections between linestrings + belonging to the same set). + + + + + Computes the intersections with a given set of s, + using the supplied . + + A collection of s to node + The intersection detector to either record intersection occurrences + or add intersection nodes to the input segment strings. + + + + Dissolves a noded collection of s to produce + a set of merged linework with unique segments. + + + A custom merging strategy + can be supplied. + This strategy will be called when two identical (up to orientation) + strings are dissolved together. + The default merging strategy is simply to discard one of the merged strings. + + A common use for this class is to merge noded edges + while preserving topological labelling. + This requires a custom merging strategy to be supplied + to merge the topology labels appropriately. + + + + + + A merging strategy which can be used to update the context data of s + which are merged during the dissolve process. + + mbdavis + + + + Updates the context data of a + when an identical (up to orientation) one is found during dissolving. + + The segment string to update. + The segment string being dissolved. + + true if the strings are in the same direction, + false if they are opposite. + + + + + Creates a dissolver with a user-defined merge strategy. + + + + + + Creates a dissolver with the default merging strategy. + + + + + Dissolve all s in the input . + + + + + + + + + + + + + Dissolve the given . + + + + + + + + + Gets the collection of dissolved (i.e. unique) s + + + + + Utility methods for processing s + + Martin Davis + + + + Extracts all linear components from a given + to s.
+ The 's data item is set to be the source . +
+ The to extract from. + a list of s. +
+ + + Extracts all linear components from a given + to s.
+ The 's data item is set to be the source . +
+ The to extract from. + a list of s. +
+ + + Extracts all linear components from a given to s. + The 's data item is set to be the source Geometry. + + The to extract from. + a list of s. + + + + Converts a collection of s into a . + The geometry will be either a + or a (possibly empty). + + A collection of . + A geometry factory + A or a . + + + + Nodes a set of s by + performing a brute-force comparison of every segment to every other one. + This has n^2 performance, so is too slow for use on large numbers of segments. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + + + + + + + + Intersects two sets of s using + brute-force comparison. + + + + + Constructs a new intersector for a given set of s. + + The base segment strings to intersect + + + + Calls + for all candidate intersections between + the given collection of SegmentStrings and the set of base segments. + + A collection of s to node + The intersection detector to either record intersection occurences + or add intersection nodes to the input segment strings. + + + + Processes all of the segment pairs in the given segment strings + using the given SegmentIntersector. + + A segment string + A segment string + The segment intersector to use + + + + Base class for s which make a single pass to find intersections. + This allows using a custom + (which for instance may simply identify intersections, rather than insert them). + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The to use. + + + + Gets/sets the to use with this noder. + A will normally add intersection nodes + to the input segment strings, but it may not - it may + simply record the presence of intersections. + However, some s may require that intersections be added. + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Nodes the linework in a list of s using Snap-Rounding + to a given . + + The input coordinates do not need to be rounded to the + precision model. + All output coordinates are rounded to the precision model. + + This class does not dissolve the output linework, + so there may be duplicate linestrings in the output. + Subsequent processing (e.g. polygonization) may require + the linework to be unique. Using UnaryUnion is one way + to do this (although this is an inefficient approach). + + + + + Creates a new noder which snap-rounds to a grid specified by the given + + The precision model for the grid to snap-round to. + + + + Gets or sets whether noding validity is checked after noding is performed. + + + + + Nodes the linework of a set of Geometrys using SnapRounding. + + A collection of Geometrys of any type + A list of LineStrings representing the noded linework of the input + + + + Implements a "hot pixel" as used in the Snap Rounding algorithm. + A hot pixel is a square region centred + on the rounded valud of the coordinate given, + and of width equal to the size of the scale factor. + It is a partially open region, which contains + the interior of the tolerance square and + the boundary + minus the top and right segments. + This ensures that every point of the space lies in a unique hot pixel. + It also matches the rounding semantics for numbers. + + The hot pixel operations are all computed in the integer domain + to avoid rounding problems. + + Hot Pixels support being marked as nodes. + This is used to prevent introducing nodes at line vertices + which do not have other lines snapped to them. + + + + The scaled x-ordinate of the hot pixel point () + + + The scaled y-ordinate of the hot pixel point () + + + + Initializes a new instance of the class. + + The coordinate at the center of the hot pixel + The scale factor determining the pixel size + The intersector to use for testing intersection with line segments + + + + Creates a new hot pixel centered on a rounded point, using a given scale factor. + The scale factor must be strictly positive(non-zero). + + The coordinate at the center of the hot pixel (already rounded) + The scale factor determining the pixel size + + + + Gets the coordinate this hot pixel is based at. + + + + + Gets the scale factor for the precision grid for this pixel. + + + + + Gets the width of the hot pixel in the original coordinate system. + + + + + Gets or sets a value indicating whether this pixel has been marked as a node. + + true if the pixel is marked as a node + + + + Scale without rounding. + This ensures intersections are checked against original + linework. + This is required to ensure that intersections are not missed + because the segment is moved by snapping. + + + + + Returns a "safe" envelope that is guaranteed to contain the hot pixel. + The envelope returned will be larger than the exact envelope of the pixel. + + An envelope which contains the pixel + + + + Tests whether a coordinate lies in (intersects) this hot pixel. + + The coordinate to test + true if the coordinate intersects this hot pixel + + + + Tests whether the line segment (p0-p1) + intersects this hot pixel. + + The first coordinate of the line segment to test + The second coordinate of the line segment to test + true if the line segment intersects this hot pixel. + + + + + + + + + + + + Test whether the given segment intersects + the closure of this hot pixel. + This is NOT the test used in the standard snap-rounding + algorithm, which uses the partially closed tolerance square instead. + This routine is provided for testing purposes only. + + + + + + + + Adds a new node (equal to the snap pt) to the specified segment + if the segment passes through the hot pixel + + + + true if a node was added to the segment + + + + An index which creates unique s for provided points, + and performs range queries on them. + The points passed to the index do not needed to be + rounded to the specified scale factor; this is done internally + when creating the HotPixels for them. + + Martin Davis + + + + Creates a new hot pixel index using the provided . + + The precision model + + + + Utility class to enumerate through a shuffled array of + s using the + Fisher-Yates shuffle algorithm + + + + + Creates an instance of this class using the provided s. + + An array of coordinates + + + + Creates an instance of this class using the provided s. + + An array of coordinates + + + + + + + + + + + + + + + + + + + Adds a series of points as non-node pixels + + The points to add + + + + Adds a list of points as node pixels. + + The points to add + + + + Adds a point as a Hot Pixel.
+ If the point has been added already, it is marked as a node. +
+ The point to add + The hot-pixel for the point +
+ + + Visits all the hot pixels which may intersect a segment (p0-p1). + The visitor must determine whether each hot pixel actually intersects + the segment. + + The segment start point + The segment end point + The visitor to apply + + + + "Snaps" all s in a containing + s to a given . + + + + + Initializes a new instance of the class. + + + + + + + + + + + + + + + + + + + + + + + Snaps (nodes) all interacting segments to this hot pixel. + The hot pixel may represent a vertex of an edge, + in which case this routine uses the optimization + of not noding the vertex itself + + The hot pixel to snap to. + The edge containing the vertex, if applicable, or null. + + true if a node was added for this pixel. + + + + Snaps (nodes) all interacting segments to this hot pixel. + The hot pixel may represent a vertex of an edge, + in which case this routine uses the optimization + of not noding the vertex itself + + The hot pixel to snap to. + true if a node was added for this pixel. + + + + Returns a "safe" envelope that is guaranteed to contain the hot pixel. + The envelope returned is larger than the exact envelope of the + pixel by a safe margin. + + An envelope which contains the hot pixel + + + + + + + + + Initializes a new instance of the class. + + + + + + + + Reports whether the HotPixel caused a node to be added in any target + segmentString(including its own). If so, the HotPixel must be added as a + node as well. + + + true if a node was added in any target segmentString. + + + + + Check if a segment of the monotone chain intersects + the hot pixel vertex and introduce a snap node if so. + Optimized to avoid noding segments which + contain the vertex (which otherwise + would cause every vertex to be noded). + + A monotone chain + A start index + + + + Adds a new node (equal to the snap pt) to the specified segment + if the segment passes through the hot pixel + + if a node was added to the segment + + + + Uses Snap Rounding to compute a rounded, + fully noded arrangement from a set of s. + Implements the Snap Rounding technique described in + papers by Hobby, Guibas and Marimont, and Goodrich et al. + Snap Rounding assumes that all vertices lie on a uniform grid; + hence the precision model of the input must be fixed precision, + and all the input vertices must be rounded to that precision. + + This implementation uses a monotone chains and a spatial index to + speed up the intersection tests. + +

KNOWN BUGS

+ This implementation is not fully robust. + instead. +
+ +
+ + + Initializes a new instance of the class. + + The to use. + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + + + + + + + + Computes all interior intersections in the collection of s, + and returns their s. + + Does NOT node the segStrings. + + + + A list of Coordinates for the intersections. + + + + Snaps segments to nodes created by segment intersections. + + + + + + Snaps segments to all vertices + + The list of segment strings to snap together + + + + Snaps segments to the vertices of a Segment String. + + + + + + Uses Snap Rounding to compute a rounded, + fully noded arrangement from a set of s. + + Implements the Snap Rounding technique described in + the papers by Hobby, Guibas & Marimont, and Goodrich et al. + Snap Rounding enforces that all vertices lie on a uniform grid, + which is determined by the provided . + Input vertices do not have to be rounded to this grid; + this will be done during the snap-rounding process. + + This implementation uses simple iteration over the line segments. + This is not an efficient approach for large sets of segments. + This implementation appears to be fully robust using an integer precision model. + It will function with non-integer precision models, but the + results are not 100% guaranteed to be correctly noded. + + + + + + Initializes a new instance of the class. + + The to use. + + + + Returns a of fully noded s. + The s have the same context as their parent. + + A Collection of NodedSegmentStrings representing the substrings + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + A collection of NodedSegmentStrings + + + + + + + + + + Gets a list of the rounded coordinates. + Duplicate (collapsed) coordinates are removed. + + The coordinates to round + An array of rounded coordinates + + + + Computes all interior intersections in the collection of s, + and returns their s. + + Also adds the intersection nodes to the segments. + + + A list of s for the intersections. + + + + Computes nodes introduced as a result of snapping segments to snap points (hot pixels). + + + + + + + + + + + + This is where all the work of snapping to hot pixels gets done + (in a very inefficient brute-force way). + + + + + Computes nodes introduced as a result of + snapping segments to vertices of other segments. + + The list of segment strings to snap together + + + + Performs a brute-force comparison of every segment in each . + This has n^2 performance. + + + + + + + Finds intersections between line segments which will be snap-rounded, + and adds them as nodes to the segments. + + Intersections are detected and computed using full precision. + Snapping takes place in a subsequent phase. + + The intersection points are recorded, so that HotPixels can be created for them. + + To avoid robustness issues with vertices which lie very close to line segments + a heuristic is used: + nodes are created if a vertex lies within a tolerance distance + of the interior of a segment. + The tolerance distance is chosen to be significantly below the snap-rounding grid size. + This has empirically proven to eliminate noding failures. + + + + + Creates an intersector which finds all snapped interior intersections, + and adds them as nodes. + + The precision model to use + + + + Creates an intersector which finds all snapped interior intersections, + and adds them as nodes. + + the intersection distance tolerance + + + + Gets the created intersection nodes, + so they can be processed as hot pixels. + + A list of intersection points + + + + This method is called by clients + of the class to process + intersections for two segments of the + s being intersected. + Note that some clients (such as MonotoneChain s) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g.by an disjoint envelope test). + + + + + If an endpoint of one segment is near + the interior of the other segment, add it as an intersection. + EXCEPT if the endpoint is also close to a segment endpoint + (since this can introduce "zigs" in the linework). + + This resolves situations where + a segment A endpoint is extremely close to another segment B, + but is not quite crossing.Due to robustness issues + in orientation detection, this can + result in the snapped segment A crossing segment B + without a node being introduced. + + + + + Always process all intersections + + Always false + + + + Uses Snap Rounding to compute a rounded, + fully noded arrangement from a set of s, + in a performant way, and avoiding unnecessary noding. + + Implements the Snap Rounding technique described in + the papers by Hobby, Guibas & Marimont, and Goodrich et al. + Snap Rounding enforces that all output vertices lie on a uniform grid, + which is determined by the provided . + + Input vertices do not have to be rounded to the grid beforehand; + this is done during the snap-rounding process. + In fact, rounding cannot be done a priori, + since rounding vertices by themselves can distort the rounded topology + of the arrangement (i.e. by moving segments away from hot pixels + that would otherwise intersect them, or by moving vertices + across segments). + + To minimize the number of introduced nodes, + the Snap-Rounding Noder avoids creating nodes + at edge vertices if there is no intersection or snap at that location. + However, if two different input edges contain identical segments, + each of the segment vertices will be noded. + This still provides fully-noded output. + This is the same behaviour provided by other noders, + such as + and . + + 1.17 + + + + The division factor used to determine + nearness distance tolerance for intersection detection. + + + + + Gets a Collection of NodedSegmentStrings representing the substrings + + + + + Computes the nodes in the snap-rounding line arrangement. + The nodes are added to the s provided as the input. + + A Collection of NodedSegmentStrings + + + + Detects interior intersections in the collection of {@link SegmentString}s, + and adds nodes for them to the segment strings. + Also creates HotPixel nodes for the intersection points. + + The input NodedSegmentStrings + + + + Creates HotPixels for each vertex in the input segStrings. + The HotPixels are not marked as nodes, since they will + only be nodes in the final line arrangement + if they interact with other segments(or they are already + created as intersection nodes). + + The input NodedSegmentStrings + + + + Gets a list of the rounded coordinates. + Duplicate (collapsed) coordinates are removed. + + The coordinates to round + Array of rounded coordinates + + + + Computes new segment strings which are rounded and contain + intersections added as a result of snapping segments to snap points (hot pixels). + + Segments to snap + The snapped segment strings + + + + Add snapped vertices to a segment string. + If the segment string collapses completely due to rounding, + null is returned. + + The segment string to snap + + The snapped segment string, or null if it collapses completely + + + + + Snaps a segment in a segmentString to HotPixels that it intersects. + + The segment start coordinate + The segment end coordinate + The segment string to add intersections to + The index of the segment/ + + + + Add nodes for any vertices in hot pixels that were + added as nodes during segment noding. + + A noded segment string + + + + Finds intersections between line segments which are being snapped, + and adds them as nodes. + + 1.17 + + + + Creates an intersector which finds all snapped intersections, + and adds them as nodes. + + The snapping tolerance distance + A snap index to use + + + + This method is called by clients + of the class to process + intersections for two segments of the s being intersected. + Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). + + + + + If an endpoint of one segment is near + the interior of the other segment, add it as an intersection. + EXCEPT if the endpoint is also close to a segment endpoint + (since this can introduce "zigs" in the linework). + + This resolves situations where + a segment A endpoint is extremely close to another segment B, + but is not quite crossing. Due to robustness issues + in orientation detection, this can + result in the snapped segment A crossing segment B + without a node being introduced. + + + + + Test if two segments are adjacent segments on the same SegmentString. + Note that closed edges require a special check for the point shared by the beginning + and end segments. + + + + > + Always process all intersections> + false + + + + Nodes a set of segment strings + snapping vertices and intersection points together if + they lie within the given snap tolerance distance. + Vertices take priority over intersection points for snapping. + Input segment strings are generally only split at true node points + (i.e.the output segment strings are of maximal length in the output arrangement). + + The snap tolerance should be chosen to be as small as possible + while still producing a correct result. + It probably only needs to be small enough to eliminate + "nearly-coincident" segments, for which intersection points cannot be computed accurately. + This implies a factor of about 10e-12 + smaller than the magnitude of the segment coordinates. + + With an appropriate snap tolerance this algorithm appears to be very robust. + So far no failure cases have been found, + given a small enough snap tolerance. + + The correctness of the output is not verified by this noder. + If required this can be done by . + + 1.17 + + + + Creates a snapping noder using the given snap distance tolerance. + + Points are snapped if within this distance + + + > + A collection of s representing the substrings + + + Computes the noding of a set of s + A Collection of s + + + + Seeds the snap index with a small set of vertices + chosen quasi-randomly using a low-discrepancy sequence. + Seeding the snap index KdTree induces a more balanced tree. + This prevents monotonic runs of vertices + unbalancing the tree and causing poor query performance. + + The segStrings to be noded + + + + Computes all interior intersections in the collection of s, + and returns their s. + + Also adds the intersection nodes to the segments. + + A list of noded substrings + + + + An index providing fast creation and lookup of snap points. + + + + + Since points are added incrementally, this index needs to be dynamic. + This class also makes use of the KdTree support for a tolerance distance + for point equality. + + + + + Creates a snap point index using a specified distance tolerance. + + Points are snapped if within this distance + + + + Snaps a coordinate to an existing snap point, + if it is within the snap tolerance distance. + Otherwise adds the coordinate to the snap point index. + + The point to snap + The point it snapped to, or the input point + + + + Gets a value indicating the snapping tolerance value for the index + + + + + Gets a value indicating the depth of the tree + + + + + A wrapper for s which validates + the output arrangement is correctly noded. + An arrangement of line segments is fully noded if + there is no line segment + which has another segment intersecting its interior. + If the noding is not correct, a is thrown + with details of the first invalid location found. + + Martin Davis + + + + + Creates a noding validator wrapping the given + + The noder to validate + + + + Checks whether the output of the wrapped noder is fully noded. + Throws an exception if it is not. + + + + + + + + + A geometry service provider class + + + When overriding this class, you need to provide a public constructor with the following arguments: + + CoordinateSequenceFactoryA factory to create coordinate sequences + PrecisionModelA precision model + intspatial reference id (srid) + GeometryOverlayA class that bundles an overlay operation function set + CoordinateEqualityComparerA class that performs checks s for equality. + + + + + + + Creates an instance of this class, using the + as default and a precision model.
+ No is specified.
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using the + as default and a precision model. + No is specified + + The function set to perform overlay operations + + + + Creates an instance of this class, using the as default.
+ No is specified.
+ The default precision model is defined by .
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using the as default.
+ A value of is assigned to .
+ The default precision model is defined by .
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using a precision model as default.
+ No is specified.
+ The default coordinate sequence factory is defined by .
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using the provided , + and spatial reference Id (). + + The coordinate sequence factory to use. + The precision model. + The default spatial reference ID + + + + Creates an instance of this class, using the provided , + , a spatial reference Id () and + a . + + The coordinate sequence factory to use. + The precision model. + The default spatial reference ID + The geometry overlay function set to use. + The equality comparer for coordinates + + + + Gets or sets the default instance of . + + + Thrown when trying to set the value to . + + + + + Gets or sets a value indicating the operations to use for geometry overlay. + + A set of geometry overlay functions. + + + + Gets an object that is used to test 2 coordinates for equality. + + A coordinate equality tester object + + + + Gets the default spatial reference id + + + + + Gets or sets the coordiate sequence factory to use + + + + + Gets or sets the default precision model + + + + + Creates a precision model based on given precision model type + + The precision model type + + + + Creates a precision model based on given precision model. + + The precision model + + + + Creates a precision model based on the given scale factor. + + The scale factor + The precision model. + + + + Creates or retrieves a geometry factory using , and + . + + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + The precision model to use. + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + The precision model to use. + The spatial reference id. + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + The precision model to use. + The spatial reference id. + + A geometry factory + + + + Creates a based on the given parameters. + + + The value for . + + + The value for . + + + The value for . + + + A that has the given values. + + + + This method is expected to be safe to call from any number of threads at once. + + + Implementations must make sure to use a constructor which + is properly assigning to the factory. + + + Although the result for a given set of parameters is cached, there is no guarantee that, + once this method is called with some set of parameters, it will never be called again + with an exactly equal set of parameters. When this does happen, an arbitrary result is + chosen as the winner (not necessarily the first one to start or finish), and all other + results are discarded. + + + + + + Computes the boundary of a . + Allows specifying the to be used. + This operation will always return a of the appropriate + dimension for the boundary (even if the input geometry is empty). + The boundary of zero-dimensional geometries (Points) is + always the empty . + + Martin Davis + + + + Computes a geometry representing the boundary of a geometry. + + The input geometry. + The computed boundary. + + + + Computes a geometry representing the boundary of a geometry, + using an explicit . + + The input geometry. + The Boundary Node Rule to use. + The computed boundary. + + + + Tests if a geometry has a boundary (it is non-empty).
+ The semantics are: + + Empty geometries do not have boundaries. + Points do not have boundaries. + For linear geometries the existence of the boundary + is determined by the . + Non-empty polygons always have a boundary. + +
+ The geometry providing the boundary + The Boundary Node Rule to use + true if the boundary exists +
+ + + Initializes a new instance of the class for the given geometry. + + The input geometry. + + + + Initializes a new instance of the class for the given geometry. + + The input geometry. + Tthe Boundary Node Rule to use. + + + + Gets the computed boundary. + + The boundary geometry. + + + + A map which maintains the edges in sorted order around the node. + + + + + Stores an integer count, for use as a Map entry. + + Martin Davis + + + + Builds the buffer geometry for a given input geometry and precision model. + Allows setting the level of approximation for circular arcs, + and the precision model in which to carry out the computation. + + + When computing buffers in floating point double-precision + it can happen that the process of iterated noding can fail to converge (terminate). + In this case a will be thrown. + Retrying the computation in a fixed precision + can produce more robust results. + + + + Compute the change in depth as an edge is crossed from R to L + + + + Initializes a new instance of the class using the given parameters. + + The buffer parameters to use. + + + + Sets the precision model to use during the curve computation and noding, + if it is different to the precision model of the Geometry. + + + If the precision model is less than the precision of the Geometry precision model, + the Geometry must have previously been rounded to that precision. + + + + + Sets the to use during noding. + This allows choosing fast but non-robust noding, or slower + but robust noding. + + + + + Sets whether the offset curve is generated + using the inverted orientation of input rings. + This allows generating a buffer(0) polygon from the smaller lobes + of self-crossing rings. + + + + + Inserted edges are checked to see if an identical edge already exists. + If so, the edge is not inserted, but its label is merged + with the existing edge. + + + + + Completes the building of the input subgraphs by depth-labelling them, + and adds them to the PolygonBuilder. + + + The subgraph list must be sorted in rightmost-coordinate order. + + the subgraphs to build + the PolygonBuilder which will build the final polygons + + + + Gets the standard result for an empty buffer. + Since buffer always returns a polygonal result, this is chosen to be an empty polygon. + + The empty result geometry + + + + Creates all the raw offset curves for a buffer of a Geometry. + Raw curves need to be noded together and polygonized to form the final buffer area. + + + + + + + The input geometry + The offset distance + A precision model + The buffer parameters + + + + Gets or sets a value indicating whether the offset curve is generated + using the inverted orientation of input rings. + This allows generating a buffer(0) polygon from the smaller lobes + of self-crossing rings. + + + + + Computes orientation of a ring using a signed-area orientation test. + For invalid (self-crossing) rings this ensures the largest enclosed area + is taken to be the interior of the ring. + This produces a more sensible result when + used for repairing polygonal geometry via buffer-by-zero. + For buffer use the lower robustness of orientation-by-area + doesn't matter, since narrow or flat rings + produce an acceptable offset curve for either orientation. + + The ring coordinates + true if the ring is CCW + + + + Computes the set of raw offset curves for the buffer. + Each offset curve has an attached {Label} indicating + its left and right location. + + A Collection of SegmentStrings representing the raw buffer curves. + + + + Creates a {SegmentString} for a coordinate list which is a raw offset curve, + and adds it to the list of buffer curves. + The SegmentString is tagged with a Label giving the topology of the curve. + The curve may be oriented in either direction. + If the curve is oriented CW, the locations will be: + Left: Location.Exterior. + Right: Location.Interior. + + + + + + + + + + + + + + + + + Add a Point to the graph. + + + + + + Keeps only valid coordinates, and removes repeated points. + + The coordinates to clean + An array of clean coordinates + + + + + + + + + + Adds an offset curve for a polygon ring. + The side and left and right topological location arguments + assume that the ring is oriented CW. + If the ring is in the opposite orientation, + the left and right locations must be interchanged and the side flipped. + + The coordinates of the ring (must not contain repeated points). + The distance at which to create the buffer. + The side of the ring on which to construct the buffer line. + The location on the L side of the ring (if it is CW). + The location on the R side of the ring (if it is CW). + + + + Tests whether the offset curve for a ring is fully inverted. + An inverted ("inside-out") curve occurs in some specific situations + involving a buffer distance which should result in a fully-eroded (empty) buffer. + It can happen that the sides of a small, convex polygon + produce offset segments which all cross one another to form + a curve with inverted orientation.
+ This happens at buffer distances slightly greater than the distance at + which the buffer should disappear.
+ The inverted curve will produce an incorrect non-empty buffer (for a shell) + or an incorrect hole (for a hole). + It must be discarded from the set of offset curves used in the buffer. + Heuristics are used to reduce the number of cases which area checked, + for efficiency and correctness. + + See +
+ the input ring + the buffer distance + the generated offset curve + true if the offset curve is inverted +
+ + + Computes the maximum distance out of a set of points to a linestring. + + The points + The linestring vertices + The maximum distance + + + + Tests whether a ring buffer is eroded completely (is empty) + based on simple heuristics. + + The is assumed to contain no repeated points. + It may be degenerate (i.e. contain only 1, 2, or 3 points). + In this case it has no area, and hence has a minimum diameter of 0. + + + + + + + + Tests whether a triangular ring would be eroded completely by the given + buffer distance. + This is a precise test. It uses the fact that the inner buffer of a + triangle converges on the inCentre of the triangle (the point + equidistant from all sides). If the buffer distance is greater than the + distance of the inCentre from a side, the triangle will be eroded completely. + This test is important, since it removes a problematic case where + the buffer distance is slightly larger than the inCentre distance. + In this case the triangle buffer curve "inverts" with incorrect topology, + producing an incorrect hole in the buffer. + + + + + + + + Simplifies a buffer input line to remove concavities with shallow depth. + + + + The most important benefit of doing this + is to reduce the number of points and the complexity of + shape which will be buffered. + It also reduces the risk of gores created by + the quantized fillet arcs (although this issue + should be eliminated in any case by the + offset curve generation logic). + + + A key aspect of the simplification is that it + affects inside (concave or inward) corners only. + Convex (outward) corners are preserved, since they + are required to ensure that the generated buffer curve + lies at the correct distance from the input geometry. + + + Another important heuristic used is that the end segments + of the input are never simplified. This ensures that + the client buffer code is able to generate end caps faithfully. + + + No attempt is made to avoid self-intersections in the output. + This is acceptable for use for generating a buffer offset curve, + since the buffer algorithm is insensitive to invalid polygonal + geometry. However, + this means that this algorithm + cannot be used as a general-purpose polygon simplification technique. + + + Martin Davis + + + + Simplify the input coordinate list. + If the distance tolerance is positive, + concavities on the LEFT side of the line are simplified. + If the supplied distance tolerance is negative, + concavities on the RIGHT side of the line are simplified. + + The coordinate list to simplify + simplification distance tolerance to use + The simplified coordinate list + + + + Simplify the input coordinate list. + + + If the distance tolerance is positive, concavities on the LEFT side of the line are simplified. + If the supplied distance tolerance is negative, concavities on the RIGHT side of the line are simplified. + + Simplification distance tolerance to use + + The simplified coordinates list + + + + + Uses a sliding window containing 3 vertices to detect shallow angles + in which the middle vertex can be deleted, since it does not + affect the shape of the resulting buffer in a significant way. + + + + + + Finds the next non-deleted index, or the end of the point array if none + + The start index to search from + The next non-deleted index, if any
+ or _inputLine.Length if there are no more non-deleted indices +
+
+ + + Checks for shallowness over a sample of points in the given section. + This helps to prevent the simplification from incrementally + "skipping" over points which are in fact non-shallow. + + A coordinate of section + A coordinate of section + The start index of section + The end index of section + The tolerated distance + + + + Computes the buffer of a geometry, for both positive and negative buffer distances. + + + + In GIS, the positive (or negative) buffer of a geometry is defined as + the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. + In the CAD/CAM world buffers are known as offset curves. + In morphological analysis the + operation of positive and negative buffering + is referred to as erosion and dilation + + + The buffer operation always returns a polygonal result. + The negative or zero-distance buffer of lines and points is always an empty . + + + Since true buffer curves may contain circular arcs, + computed buffer polygons are only approximations to the true geometry. + The user can control the accuracy of the approximation by specifying + the number of linear segments used to approximate arcs. + This is specified via + or . + + + The of a linear buffer may be specified. + The following end cap styles are supported: +
    +
  • - the usual round end caps
  • +
  • - end caps are truncated flat at the line ends
  • +
  • - end caps are squared off at the buffer distance beyond the line ends
  • +
+
+ + The of the corners in a buffer may be specified. + The following join styles are supported: +
    +
  • - the usual round join
  • +
  • - corners are "sharp" (up to a distance limit})
  • +
  • - corners are beveled (clipped off)
  • +
+
+ + The buffer algorithm may perform simplification on the input to increase performance. + The simplification is performed a way that always increases the buffer area + (so that the simplified input covers the original input). + The degree of simplification can be specified with , + with a used otherwise. + Note that if the buffer distance is zero then so is the computed simplify tolerance, + no matter what the simplify factor. + + + Buffer results are always valid geometry. + Given this, computing a zero-width buffer of an invalid polygonal geometry is + an effective way to "validify" the geometry. + Note however that in the case of self-intersecting "bow-tie" geometries, + only the largest enclosed area will be retained. + +
+
+ + + A number of digits of precision which leaves some computational "headroom" + for floating point operations. + + + This value should be less than the decimal precision of double-precision values (16). + + + + + Compute a scale factor to limit the precision of + a given combination of Geometry and buffer distance. + The scale factor is determined by + the number of digits of precision in the (geometry + buffer distance), + limited by the supplied value. + + The scale factor is based on the absolute magnitude of the (geometry + buffer distance). + since this determines the number of digits of precision which must be handled. + + the Geometry being buffered + the buffer distance + the max # of digits that should be allowed by + the precision determined by the computed scale factor + + a scale factor for the buffer computation + + + + Computes the buffer of a geometry for a given buffer distance. + + the geometry to buffer + the buffer distance + the buffer of the input geometry + + + + Computes the buffer for a geometry for a given buffer distance + and accuracy of approximation. + + the geometry to buffer + the buffer distance + the buffer parameters to use + the buffer of the input geometry + + + + Computes the buffer for a geometry for a given buffer distance + and accuracy of approximation. + + the geometry to buffer + the buffer distance + the number of segments used to approximate a quarter circle + the buffer of the input geometry + + + + Buffers a geometry with distance zero. + The result can be computed using the maximum-signed-area orientation, + or by combining both orientations. + + This can be used to fix an invalid polygonal geometry to be valid + (i.e.with no self-intersections). + For some uses(e.g.fixing the result of a simplification) + a better result is produced by using only the max-area orientation. + Other uses (e.g.fixing geometry) require both orientations to be used. + + This function is for INTERNAL use only. + + The polygonal geometry to buffer by zero + A flag indicating if both orientations of input rings should be used + The buffered polygonal geometry + + + + Combines the elements of two polygonal geometries together. + The input geometries must be non-adjacent, to avoid + creating an invalid result. + + A polygonal geometry (which may be empty) + Another polygonal geometry (which may be empty) + A combined polygonal geometry + + + + Initializes a buffer computation for the given geometry + + the geometry to buffer + + + + Initializes a buffer computation for the given geometry + with the given set of parameters + + the geometry to buffer + the buffer parameters to use + + + + Gets or sets the number of line segments in a quarter-circle + used to approximate angle fillets for round end caps and joins. + + + + + Returns the buffer computed for a geometry for a given buffer distance. + + the buffer distance + the buffer of the input geometry + + + + A value class containing the parameters which + specify how a buffer should be constructed. + + The parameters allow control over: + + Quadrant segments (accuracy of approximation for circular arcs) + End Cap style + Join style + Mitre limit + whether the buffer is single-sided + + + Martin Davis + + + + The default number of facets into which to divide a fillet of 90 degrees.
+ A value of 8 gives less than 2% max error in the buffer distance. + For a max error of < 1%, use QS = 12. + For a max error of < 0.1%, use QS = 18. +
+
+ + + The default number of facets into which to divide a fillet of 90 degrees.
+ A value of 8 gives less than 2% max error in the buffer distance. + For a max error of < 1%, use QS = 12. + For a max error of < 0.1%, use QS = 18. +
+
+ + + The default mitre limit + Allows fairly pointy mitres. + + + + + The default simplify factor. + Provides an accuracy of about 1%, which matches + the accuracy of the parameter. + + + + + Creates a default set of parameters + + + + + Creates a set of parameters with the given quadrantSegments value. + + The number of quadrant segments to use + + + + Creates a set of parameters with the + given quadrantSegments and endCapStyle values. + + the number of quadrant segments to use + the end cap style to use + + + + Creates a set of parameters with the + given parameter values. + + the number of quadrant segments to use + the end cap style to use + the join style to use + the mitre limit to use + + + + Gets or sets the number of line segments in a quarter-circle + used to approximate angle fillets in round endcaps and joins. + The value should be at least 1. + + This determines the + error in the approximation to the true buffer curve.
+ The default value of 8 gives less than 2% error in the buffer distance. + For an error of < 1%, use QS = 12. + For an error of < 0.1%, use QS = 18. + The error is always less than the buffer distance + (in other words, the computed buffer curve is always inside the true + curve). +
+
+ + + Computes the maximum distance error due to a given level of approximation to a true arc. + + The number of segments used to approximate a quarter-circle + The error of approximation + + + + Gets or sets the end cap style of the generated buffer. + + + + The styles supported are , + , and + . + + The default is . + + + + + Gets/Sets the join style for outside (reflex) corners between line segments. + + + The styles supported are , + and + The default is + + + + + Sets the limit on the mitre ratio used for very sharp corners. + + + + The mitre ratio is the ratio of the distance from the corner + to the end of the mitred offset corner. + When two line segments meet at a sharp angle, + a miter join will extend far beyond the original geometry. + (and in the extreme case will be infinitely far.) + To prevent unreasonable geometry, the mitre limit + allows controlling the maximum length of the join corner. + Corners with a ratio which exceed the limit will be beveled. + + + + + + Gets or sets whether the computed buffer should be single-sided. + A single-sided buffer is constructed on only one side of each input line. + + The side used is determined by the sign of the buffer distance: + + a positive distance indicates the left-hand side + a negative distance indicates the right-hand side + + The single-sided buffer of point geometries is the same as the regular buffer. + + The End Cap Style for single-sided buffers is always ignored, + and forced to the equivalent of . + + + + + + Factor used to determine the simplify distance tolerance + for input simplification. + Simplifying can increase the performance of computing buffers. + Generally the simplify factor should be greater than 0. + Values between 0.01 and .1 produce relatively good accuracy for the generate buffer. + Larger values sacrifice accuracy in return for performance. + + + + + Creates a copy + + + + + + A connected subset of the graph of + DirectedEdges and Nodes. + Its edges will generate either + a single polygon in the complete buffer, with zero or more holes, or + one or more connected holes. + + + + + + + + + + + + + + + + + + + + Gets the rightmost coordinate in the edges of the subgraph. + + + + + Creates the subgraph consisting of all edges reachable from this node. + Finds the edges in the graph and the rightmost coordinate. + + A node to start the graph traversal from. + + + + Adds all nodes and edges reachable from this node to the subgraph. + Uses an explicit stack to avoid a large depth of recursion. + + A node known to be in the subgraph. + + + + Adds the argument node and all its out edges to the subgraph + + The node to add. + The current set of nodes being traversed. + + + + + + + + + + + + + + + Compute depths for all dirEdges via breadth-first traversal of nodes in graph. + + Edge to start processing with. + + + + + + + + + + + + + + + + Find all edges whose depths indicates that they are in the result area(s). + Since we want polygon shells to be + oriented CW, choose dirEdges with the interior of the result on the RHS. + Mark them as being in the result. + Interior Area edges are the result of dimensional collapses. + They do not form part of the result area boundary. + + + + + BufferSubgraphs are compared on the x-value of their rightmost Coordinate. + This defines a partial ordering on the graphs such that: + g1 >= g2 - Ring(g2) does not contain Ring(g1) + where Polygon(g) is the buffer polygon that is built from g. + This relationship is used to sort the BufferSubgraphs so that shells are guaranteed to + be built before holes. + + + + + End cap style constants + + + + + Specifies a round line buffer end cap style. + + + + + Specifies a flat line buffer end cap style. + + + + + Specifies a square line buffer end cap style. + + + + + Join style constants + + + + + Specifies a round join style. + + + + + Specifies a mitre join style. + + + + + Specifies a bevel join style. + + + + + Computes an offset curve from a geometry. + The offset curve is a linear geometry which is offset a specified distance + from the input. + If the offset distance is positive the curve lies on the left side of the input; + if it is negative the curve is on the right side. + + The offset curve of a line is a . + The offset curve of a Point is an empty . + The offset curve of a Polygon is the boundary of the polygon buffer (which + may be a . + For a collection the output is a {@link MultiLineString} of the element offset curves. + + The offset curve is computed as a single contiguous section of the geometry buffer boundary. + In some geometric situations this definition is ill-defined. + This algorithm provides a "best-effort" interpretation. + In particular: + + For self-intersecting lines, the buffer boundary includes + offset lines for both left and right sides of the input line. + Only a single contiguous portion on the specified side is returned. + If the offset corresponds to buffer holes, only the largest hole is used. + + Offset curves support setting the number of quadrant segments, + the join style, and the mitre limit(if applicable) via + the . + + Martin Davis + + + + The nearness tolerance between the raw offset linework and the buffer curve. + + + + + Computes the offset curve of a geometry at a given distance. + + A geometry + the offset distance (positive = left, negative = right) + The offset curve + + + + Computes the offset curve of a geometry at a given distance, + and for a specified quadrant segments, join style and mitre limit. + + A geometry + The offset distance (positive = left, negative = right) + The quadrant segments + The join style + The mitre limit + The offset curve + + + + Creates a new instance for computing an offset curve for a geometryat a given distance. + with default quadrant segments( + and join style (). + + The geometry + A distance value + + + Creates a new instance for computing an offset curve for a geometry at a given distance. + allowing the quadrant segments and join style and mitre limit to be set + via {@link BufferParameters}. + + @param geom + @param distance + @param bufParams + + + + Gets the computed offset curve. + + The offset curve geometry + + + + Force LinearRings to be LineStrings. + + A geometry, which may be a LinearRing + A geometry which will be a LineString or MulitLineString + + + + Gets the raw offset line. + The quadrant segments and join style and mitre limit to be set + via . + + The raw offset line may contain loops and other artifacts which are + not present in the true offset curve. + The raw offset line is matched to the buffer ring (which is clean) + to extract the offset curve. + + The LineString to offset + The offset distance + The buffer parameters to use + The raw offset line + + + + Gets the raw offset line, with default buffer parameters. + + The LineString to offset + The offset distance + The raw offset line + + + + Extracts the largest polygon by area from a geometry. + Used here to avoid issues with non-robust buffer results which have spurious extra polygons. + + A geometry + The polygon element of largest area + + + + An action to match a raw offset curve segment + to segments in the buffer ring + and mark them as being in the offset curve. + + Martin Davis + + + + Extracts a section of a ring of coordinates, starting at a given index, + and keeping coordinates which are flagged as being required. + + The ring of points + The index of the start coordinate + A flag indicating if coordinate is to be extracted + + + + Computes the raw offset curve for a + single component (ring, line or point). + A raw offset curve line is not noded - + it may contain self-intersections (and usually will).g + The final buffer polygon is computed by forming a topological graph + of all the noded raw curves and tracing outside contours. + The points in the raw curve are rounded + to a given . + + + + + Gets the buffer parameters being used to generate the curve. + + + + + This method handles single points as well as LineStrings. + LineStrings are assumed not to be closed (the function will not + fail for closed lines, but will generate superfluous line caps). + + The vertices of the line to offset + The offset distance + A Coordinate array representing the curve
+ or null if the curve is empty +
+
+ + + Tests whether the offset curve for line or point geometries + at the given offset distance is empty (does not exist). + This is the case if: + + the distance is zero + the distance is negative, except for the case of singled-sided buffers + + + The offset curve distance + true if the offset curve is empty + + + + This method handles the degenerate cases of single points and lines, + as well as rings. + + A Coordinate array representing the curve
+ or null if the curve is empty
+
+ + + This method handles the degenerate cases of single points and lines, + as well as rings. + + A Coordinate array representing the curve
+ or null if the curve is empty
+
+ + + Computes the distance tolerance to use during input + line simplification. + + The buffer distance + The simplification tolerance + + + + Creates all the raw offset curves for a buffer of a Geometry. + Raw curves need to be noded together and polygonized to form the final buffer area. + + + + + + + + + + + + + Gets or sets a value indicating whether the offset curve is generated + using the inverted orientation of input rings. + This allows generating a buffer(0) polygon from the smaller lobes + of self-crossing rings. + + + + + Computes orientation of a ring using a signed-area orientation test. + For invalid (self-crossing) rings this ensures the largest enclosed area + is taken to be the interior of the ring. + This produces a more sensible result when + used for repairing polygonal geometry via buffer-by-zero. + For buffer use the lower robustness of orientation-by-area + doesn't matter, since narrow or flat rings + produce an acceptable offset curve for either orientation. + + The ring coordinates + true if the ring is CCW + + + + Computes the set of raw offset curves for the buffer. + Each offset curve has an attached {Label} indicating + its left and right location. + + A Collection of SegmentStrings representing the raw buffer curves. + + + + Creates a {SegmentString} for a coordinate list which is a raw offset curve, + and adds it to the list of buffer curves. + The SegmentString is tagged with a Label giving the topology of the curve. + The curve may be oriented in either direction. + If the curve is oriented CW, the locations will be: + Left: Location.Exterior. + Right: Location.Interior. + + + + + + + + + + + + + + + + + Add a Point to the graph. + + + + + + Keeps only valid coordinates, and removes repeated points. + + The coordinates to clean + An array of clean coordinates + + + + + + + + + + Adds an offset curve for a polygon ring. + The side and left and right topological location arguments + assume that the ring is oriented CW. + If the ring is in the opposite orientation, + the left and right locations must be interchanged and the side flipped. + + The coordinates of the ring (must not contain repeated points). + The distance at which to create the buffer. + The side of the ring on which to construct the buffer line. + The location on the L side of the ring (if it is CW). + The location on the R side of the ring (if it is CW). + + +
+ Tests whether the offset curve for a ring is fully inverted. + An inverted ("inside-out") curve occurs in some specific situations + involving a buffer distance which should result in a fully-eroded (empty) buffer. + It can happen that the sides of a small, convex polygon + produce offset segments which all cross one another to form + a curve with inverted orientation.
+ This happens at buffer distances slightly greater than the distance at + which the buffer should disappear.
+ The inverted curve will produce an incorrect non-empty buffer (for a shell) + or an incorrect hole (for a hole). + It must be discarded from the set of offset curves used in the buffer. + Heuristics are used to reduce the number of cases which area checked, + for efficiency and correctness. + + See
+
+ the input ring + the buffer distance + the generated offset curve + true if the offset curve is inverted + + + + Computes the maximum distance out of a set of points to a linestring. + + The points + The linestring vertices + The maximum distance + + + + Tests whether a ring buffer is eroded completely (is empty) + based on simple heuristics. + + The is assumed to contain no repeated points. + It may be degenerate (i.e. contain only 1, 2, or 3 points). + In this case it has no area, and hence has a minimum diameter of 0. + + + + + + + + Tests whether a triangular ring would be eroded completely by the given + buffer distance. + This is a precise test. It uses the fact that the inner buffer of a + triangle converges on the inCentre of the triangle (the point + equidistant from all sides). If the buffer distance is greater than the + distance of the inCentre from a side, the triangle will be eroded completely. + This test is important, since it removes a problematic case where + the buffer distance is slightly larger than the inCentre distance. + In this case the triangle buffer curve "inverts" with incorrect topology, + producing an incorrect hole in the buffer. + + + + + + + + A list of the vertices in a constructed offset curve. + + Automatically removes close adjacent vertices. + Martin Davis + + + + Gets/Sets the precision model to use when adding new points. + + + + + The distance below which two adjacent points on the curve are considered to be coincident. + + This is chosen to be a small fraction of the offset distance. + + + + Function to add a point + + + The point is only added if evaluates to false. + + The point to add. + + + + Tests whether the given point duplicates the previous point in the list (up to tolerance) + + The point to test + true if the point duplicates the previous point + + + + Automatically closes the ring (if it not alread is). + + + + + Gets the Coordinates for the curve. + + + + + + + + Generates segments which form an offset curve. + Supports all end cap and join options + provided for buffering. + This algorithm implements various heuristics to + produce smoother, simpler curves which are + still within a reasonable tolerance of the + true curve. + + Martin Davis + + + + Factor which controls how close offset segments can be to + skip adding a filler or mitre. + + + + + Factor which controls how close curve vertices on inside turns can be to be snapped + + + + + Factor which controls how close curve vertices can be to be snapped + + + + + Factor which determines how short closing segs can be for round buffers + + + + + The max error of approximation (distance) between a quad segment and the true fillet curve + + + + + The angle quantum with which to approximate a fillet curve + (based on the input # of quadrant segments) + + + + + The Closing Segment Length Factor controls how long + "closing segments" are. Closing segments are added + at the middle of inside corners to ensure a smoother + boundary for the buffer offset curve. + In some cases (particularly for round joins with default-or-better + quantization) the closing segments can be made quite short. + This substantially improves performance (due to fewer intersections being created). + + A closingSegFactor of 0 results in lines to the corner vertex + A closingSegFactor of 1 results in lines halfway to the corner vertex + A closingSegFactor of 80 results in lines 1/81 of the way to the corner vertex + (this option is reasonable for the very common default situation of round joins + and quadrantSegs >= 8) + + + + + + Gets whether the input has a narrow concave angle + (relative to the offset distance). + In this case the generated offset curve will contain self-intersections + and heuristic closing segments. + This is expected behaviour in the case of buffer curves. + For pure offset curves, + the output needs to be further treated + before it can be used. + + + + + Add last offset point + + + + + Adds the offset points for an outside (convex) turn + + + + + Adds the offset points for an inside (concave) turn. + + + + + + + Compute an offset segment for an input segment on a given side and at a given distance. + The offset points are computed in full double precision, for accuracy. + + The segment to offset + The side of the segment the offset lies on + The offset distance + The points computed for the offset segment + + + + Add an end cap around point , terminating a line segment coming from + + + + + + + Adds a mitre join connecting two convex offset segments. + The mitre is beveled if it exceeds the mitre limit factor. + The mitre limit is intended to prevent extremely long corners occurring. + If the mitre limit is very small it can cause unwanted artifacts around fairly flat corners. + This is prevented by using a simple bevel join in this case. + In other words, the limit prevents the corner from getting too long, + but it won't force it to be very short/flat. + + A corner point + The first offset segment + The second offset segment + The offset distance + + + + Adds a limited mitre join connecting two convex offset segments. + A limited mitre join is beveled at the distance + determined by the mitre limit factor, + or as a standard bevel join, whichever is further. + + The first offset segment + The second offset segment + The offset distance + The mitre limit distance + + + + Projects a point to a given distance in a given direction angle. + + The point to project + The projection distance + The direction angle (in radians) + The projected point + + + + Adds a bevel join connecting the two offset segments + around a reflex corner. + + The first offset segment + The second offset segment + + + + Add points for a circular fillet around a convex corner. + Adds the start and end points + + Base point of curve + Start point of fillet curve + Endpoint of fillet curve + The orientation of the fillet + The radius of the fillet + + + + Adds points for a circular fillet arc + between two specified angles. + The start and end point for the fillet are not added - + the caller must add them if required. + + The center point + Is -1 for a angle, 1 for a angle + The start angle of the fillet + The end angle of the fillet + The radius of the fillet + + + + Creates a circle around a point + + + + + Creates a square around a point + + + + + A dynamic list of the vertices in a constructed offset curve. + Automatically removes adjacent vertices + which are closer than a given tolerance. + + Martin Davis + + + + The distance below which two adjacent points on the curve + are considered to be coincident.
+ This is chosen to be a small fraction of the offset distance. +
+
+ + + Tests whether the given point is redundant + relative to the previous + point in the list (up to tolerance). + + + true if the point is redundant + + + + Computes the raw offset curve for a single component (ring, line or point). + + + A raw offset curve line is not noded - it may contain self-intersections (and usually will). + The final buffer polygon is computed by forming a topological graph + of all the noded raw curves and tracing outside contours. + The points in the raw curve are rounded to the required precision model. + + + + + The angle quantum with which to approximate a fillet curve + (based on the input # of quadrant segments) + + + + + The max error of approximation (distance) between a quad segment and the true fillet curve + + + + + Factor which controls how close curve vertices can be to be snapped + + + + + Factor which controls how close offset segments can be to + skip adding a filler or mitre. + + + + + Factor which controls how close curve vertices on inside turns can be to be snapped + + + + + Factor which determines how short closing segs can be for round buffers + + + + + The Closing Segment Factor controls how long + "closing segments" are. Closing segments are added + at the middle of inside corners to ensure a smoother + boundary for the buffer offset curve.
+ In some cases (particularly for round joins with default-or-better + quantization) the closing segments can be made quite short. + This substantially improves performance (due to fewer intersections being created). +
+ A closingSegFactor of 0 results in lines to the corner vertex
+ A closingSegFactor of 1 results in lines halfway to the corner vertex
+ A closingSegFactor of 80 results in lines 1/81 of the way to the corner vertex + (this option is reasonable for the very common default situation of round joins + and quadrantSegs >= 8) +
+
+ + + This method handles single points as well as lines. + Lines are assumed to not be closed (the function will not + fail for closed lines, but will generate superfluous line caps). + + a List of Coordinate[] + + + + This method handles the degenerate cases of single points and lines, as well as rings. + + a List of Coordinate[] + + + + This method handles the degenerate cases of single points and lines, as well as rings. + + a List of Coordinate[] + + + + Use a value which results in a potential distance error which is + significantly less than the error due to + the quadrant segment discretization. + For QS = 8 a value of 100 is reasonable. + This should produce a maximum of 1% distance error. + + + + + Computes the distance tolerance to use during input + line simplification. + + The buffer distance + The simplification tolerance + + + + Adds the offset points for an outside (convex) turn + + + + + + + + Adds the offset points for an inside (concave) turn. + + + + + + + Add last offset point + + + + + Compute an offset segment for an input segment on a given side and at a given distance. + The offset points are computed in full double precision, for accuracy. + + The segment to offset + The side of the segment () the offset lies on + The offset distance + The points computed for the offset segment + + + + Add an end cap around point p1, terminating a line segment coming from p0 + + + + + Adds a mitre join connecting the two reflex offset segments. + The mitre will be beveled if it exceeds the mitre ratio limit. + + The base point + The first offset segment + The second offset segment + The offset distance + + + + Adds a limited mitre join connecting the two reflex offset segments. + + + A limited mitre is a mitre which is beveled at the distance + determined by the mitre ratio limit. + + The first offset segment + The second offset segment + The offset distance + The mitre limit ratio + + + + Adds a bevel join connecting the two offset segments around a reflex corner. + + The first offset segment + The second offset segment + + + + Add points for a circular fillet around a reflex corner. Adds the start and end points + + Base point of curve + Start point of fillet curve + Endpoint of fillet curve + The orientation of the fillet + The radius of the fillet + + + + Adds points for a circular fillet arc between two specified angles. + + + The start and end point for the fillet are not added - the caller must add them if required. + + The point around which to add the fillet points + The start angle (in radians) + The end angle (in radians) + Is -1 for a CW angle, 1 for a CCW angle + The radius of the fillet + + + + Adds a CW circle around a point + + + + + Adds a CW square around a point + + + + + A RightmostEdgeFinder find the DirectedEdge in a list which has the highest coordinate, + and which is oriented L to R at that point. (I.e. the right side is on the RHS of the edge.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A spatial index over a segment sequence + using s. + + Martin Davis + + + + Locates a subgraph inside a set of subgraphs, + in order to determine the outside depth of the subgraph. + The input subgraphs are assumed to have had depths + already calculated for their edges. + + + + + + + + + + + + + + + + + + Finds all non-horizontal segments intersecting the stabbing line. + The stabbing line is the ray to the right of stabbingRayLeftPt. + + The left-hand origin of the stabbing line. + A List of {DepthSegments} intersecting the stabbing line. + + + + Finds all non-horizontal segments intersecting the stabbing line + in the list of dirEdges. + The stabbing line is the ray to the right of stabbingRayLeftPt. + + The left-hand origin of the stabbing line. + + The current list of DepthSegments intersecting the stabbing line. + + + + Finds all non-horizontal segments intersecting the stabbing line + in the input dirEdge. + The stabbing line is the ray to the right of stabbingRayLeftPt. + + The left-hand origin of the stabbing line. + + The current list of DepthSegments intersecting the stabbing line. + + + + A segment from a directed edge which has been assigned a depth value + for its sides. + + + + + Gets or sets the depth to the left of this segment + + + + + Initializes this DepthSegments + + A line segment + A depth value + + + + Defines a comparison operation on s + which orders them left to right. + + + Assumes the segments are normalized. + + The definition of ordering is: + + -1if DS1.seg is left of or below DS2.seg (DS1 < DS2). + 1if DS1.seg is right of or above DS2.seg (DS1 > DS2). + 0if the segments are identical + + Known Bugs: + + The logic does not obey the contract. + This is acceptable for the intended usage, but may cause problems if used with some + utilities in the .Net standard library (e.g. . + + + A DepthSegment + The comparison value + + + + Finds the approximate maximum distance from a buffer curve to + the originating geometry. + + The approximate maximum distance is determined by testing + all vertices in the buffer curve, as well + as midpoints of the curve segments. + Due to the way buffer curves are constructed, this + should be a very close approximation. + This is similar to the Discrete Oriented Hausdorff distance + from the buffer curve to the input. + + mbdavis + + + + Validates that a given buffer curve lies an appropriate distance + from the input generating it. + + + Useful only for round buffers (cap and join). + Can be used for either positive or negative distances. + + This is a heuristic test, and may return false positive results + (I.e. it may fail to detect an invalid result.) + It should never return a false negative result, however + (I.e. it should never report a valid result as invalid.) + + mbdavis + + + + Gets a geometry which indicates the location and nature of a validation failure. + + The indicator is a line segment showing the location and size + of the distance discrepancy. + + + A geometric error indicator + or null, if no error was found + + + + Checks that two geometries are at least a minimum distance apart. + + A geometry + A geometry + The minimum distance the geometries should be separated by + + + + Checks that the furthest distance from the buffer curve to the input + is less than the given maximum distance. + + + This uses the Oriented Hausdorff distance metric. It corresponds to finding + the point on the buffer curve which is furthest from some point on the input. + + A geometry + A geometry + The maximum distance that a buffer result can be from the input + + + + Validates that the result of a buffer operation + is geometrically correct, within a computed tolerance. + + + This is a heuristic test, and may return false positive results + (I.e. it may fail to detect an invalid result.) + It should never return a false negative result, however + (I.e. it should never report a valid result as invalid.) + This test may be (much) more expensive than the original buffer computation. + + Martin Davis + + + Checks whether the geometry buffer is valid, and returns an error message if not. + + + + + An appropriate error message
+ or nullif the buffer is valid
+ +
+ + + Gets the error message + + + + + Gets the error location + + + + + Gets a geometry which indicates the location and nature of a validation failure. + + If the failure is due to the buffer curve being too far or too close + to the input, the indicator is a line segment showing the location and size + of the discrepancy. + + + A geometric error indicator
+ or null, if no error was found
+
+ + + Computes the Euclidean distance (L2 metric) from a Point to a Geometry. + Also computes two points which are separated by the distance. + + + + + Contains a pair of points and the distance between them. + Provides methods to update with a new point pair with + either maximum or minimum distance. + + + + + Initializes the points, avoiding recomputing the distance. + + The first point + The second point + The distance between and + + + + Creates a buffer polygon with a varying buffer distance + at each vertex along a line. + + Only single lines are supported as input, since buffer widths + generally need to be specified individually for each line. + + Martin Davis + + + + Creates a buffer polygon along a line with the buffer distance interpolated + between a start distance and an end distance. + + The line to buffer + The buffer width at the start of the line + The buffer width at the end of the line + The variable-distance buffer polygon + + + + Creates a buffer polygon along a line with the buffer distance interpolated + between a start distance, a middle distance and an end distance. + The middle distance is attained at + the vertex at or just past the half-length of the line. + For smooth buffering of a (or the rings of a ) + the start distance and end distance should be equal. + + The line to buffer + The buffer width at the start of the line + The buffer width at the middle vertex of the line + The buffer width at the end of the line + The variable-distance buffer polygon + + + + Creates a buffer polygon along a line with the distance specified + at each vertex. + + The line to buffer + The buffer distance for each vertex of the line + The variable-width buffer polygon + + + + Computes a list of values for the points along a line by + interpolating between values for the start and end point. + The interpolation is + based on the distance of each point along the line + relative to the total line length. + + The line to interpolate along + The start value + The end value + The array of interpolated values + + + + Computes a list of values for the points along a line by + interpolating between values for the start, middle and end points. + The interpolation is + based on the distance of each point along the line + relative to the total line length. + The middle distance is attained at + the vertex at or just past the half-length of the line. + + The line to interpolate along + The start value + The mid value + The end value + The array of interpolated values + + + + Creates a generator for a variable-distance line buffer. + + The linestring to buffer + The buffer distance for each vertex of the line + + + + Computes the buffer polygon. + + A buffer polygon + + + + Computes a variable buffer polygon for a single segment, + with the given endpoints and buffer distances. + The individual segment buffers are unioned + to form the final buffer. + + The segment start point + The segment end point + The buffer distance at the start point + The buffer distance at the end point + The segment buffer + + + + Returns a circular polygon. + + The circle center point + The radius + A polygon, or null if the radius is 0 + + + + Adds a semi-circular cap CCW around the point . + + The centre point of the cap + The cap radius + the starting point of the cap + The ending point of the cap + The coordinate list to add to + + + + Computes the angle for the given cap point index. + + The fillet angle index + + + + Computes the canonical cap point index for a given angle. + The angle is rounded down to the next lower + index. + + In order to reduce the number of points created by overlapping end caps, + cap points are generated at the same locations around a circle. + The index is the index of the points around the circle, + with 0 being the point at (1,0). + The total number of points around the circle is + 4 * . + + The angle + The index for the angle. + + +
+ Computes the two circumference points defining the outer tangent line + between two circles. + + For the algorithm see Wikipedia. + + The centre of circle 1 + The radius of circle 1 + The centre of circle 2 + The radius of circle 2 + The outer tangent line segment, or null if none exists + + + + Snap trig values to integer values for better consistency. + + The result of a trigonometric function + snapped to the integer interval + + + + A wrapper which + projects 3D coordinates into one of the + three Cartesian axis planes, + using the standard orthonormal projection + (i.e. simply selecting the appropriate ordinates into the XY ordinates). + The projected data is represented as 2D coordinates. + + Martin Davis + + + + Creates a wrapper projecting to the XY plane. + + The sequence to be projected + A sequence which projects coordinates + + + + Creates a wrapper projecting to the XZ plane. + + The sequence to be projected + A sequence which projects coordinates + + + + Creates a wrapper projecting to the YZ plane. + + The sequence to be projected + A sequence which projects coordinates + + + + + + + Find two points on two 3D s which lie within a given distance, + or else are the nearest points on the geometries (in which case this also + provides the distance between the geometries). + + 3D geometries have vertex Z ordinates defined. + 3D s are assumed to lie in a single plane (which is enforced if not actually the case). + 3D s and s may have any configuration. + + The distance computation also finds a pair of points in the input geometries + which have the minimum distance between them. If a point lies in the interior + of a line segment, the coordinate computed is a close approximation to the + exact point. + + The algorithms used are straightforward O(n^2) comparisons. This worst-case + performance could be improved on by using Voronoi techniques or spatial + indexes. + + 1.13 + + + + Compute the distance between the nearest points of two geometries. + + A geometry + A geometry + The distance between the geometries + + + + Test whether two geometries lie within a given distance of each other. + + A geometry + A geometry + The distance to test + true if g0.distance(g1) <= + + + + Compute the the nearest points of two geometries. The points are + presented in the same order as the input Geometries. + + A geometry + A geometry + The nearest points in the geometries + + + + Constructs a DistanceOp that computes the distance and nearest points + between the two specified geometries. + + A geometry + A geometry + + + + Constructs a DistanceOp that computes the distance and nearest points + between the two specified geometries. + + A geometry + A geometry + The distance on which to terminate the search + + + + Report the distance between the nearest points on the input geometries. + + The distance between the geometries
+ or 0 if either input geometry is empty
+ Thrown if either input geometry is null. +
+ + + Report the coordinates of the nearest points in the input geometries. The + points are presented in the same order as the input Geometries. + + A pair of s of the nearest points + + + + Gets the locations of the nearest points in the input geometries. The + locations are presented in the same order as the input Geometries. + + A pair of s for the nearest points + + + + Finds the index of the "most polygonal" input geometry. + This optimizes the computation of the best-fit plane, + since it is cached only for the left-hand geometry. + + The index of the most polygonal geometry + + + + Convenience method to create a Plane3DPolygon + + + + + Computes distance between two polygons. + + + To compute the distance, compute the distance + between the rings of one polygon and the other polygon, + and vice-versa. + If the polygons intersect, then at least one ring must + intersect the other polygon. + Note that it is NOT sufficient to test only the shell rings. + A counter-example is a "figure-8" polygon A + and a simple polygon B at right angles to A, with the ring of B + passing through the holes of A. + The polygons intersect, + but A's shell does not intersect B, and B's shell does not intersect A. + + + Compute distance between a polygon and the rings of another. + + + + Computes a point at a distance along a segment + specified by two relatively proportional values. + The fractional distance along the segment is d0/(d0+d1). + + Start point of the segment. + End point of the segment + Proportional distance from start point to computed point + Proportional distance from computed point to end point + The computed point + + + + Models a polygon lying in a plane in 3-dimensional Cartesian space. + The polygon representation is supplied + by a , + containing coordinates with XYZ ordinates. + 3D polygons are assumed to lie in a single plane. + The plane best fitting the polygon coordinates is + computed and is represented by a . + + Martin Davis + + + + Creates an instance of this class using the provided . + + The polygon + + + + Finds a best-fit plane for the polygon, + by sampling a few points from the exterior ring. + + The algorithm used is Newell's algorithm: + + a base point for the plane is determined from the average of all vertices + the normal vector is determined by computing the area of the projections on each of the axis planes + + + The polygon to determine the plane for + The best-fit plane + + + + Computes an average normal vector from a list of polygon coordinates. + Uses Newell's method, which is based + on the fact that the vector with components + equal to the areas of the projection of the polygon onto + the Cartesian axis planes is normal. + + The sequence of coordinates for the polygon + A normal vector + + + + Computes a point which is the average of all coordinates + in a sequence.
+ If the sequence lies in a single plane, + the computed point also lies in the plane. +
+ A coordinate sequence + A Coordinate with averaged ordinates +
+ + + Gets a value indicating the plane + + + + + Gets a value indicating the polygon + + + + + Checks if intersects with this . + + The point to check + true if intPt intersects this PlanarPolygon3d. + + + + Checks if the point intersects with when projected to this instance's facing plane + + A point + A ring + true if point and linestring intersect + + + + A ConnectedElementPointFilter extracts a single point + from each connected element in a Geometry + (e.g. a polygon, linestring or point) + and returns them in a list. The elements of the list are + s. + Empty geometries do not provide a location item. + + + + + Returns a list containing a point from each Polygon, LineString, and Point + found inside the specified point. Thus, if the specified point is + not a GeometryCollection, an empty list will be returned. The elements of the list + are s. + + + + + + + + + + + + + + + + + Extracts a single point + from each connected element in a Geometry + (e.g. a polygon, linestring or point) + and returns them in a list + + + + + Returns a list containing a Coordinate from each Polygon, LineString, and Point + found inside the specified point. Thus, if the specified point is + not a GeometryCollection, an empty list will be returned. + + + + + + + + + + + + + + + + + Computes the distance and + closest points between two Geometrys. + The distance computation finds a pair of points in the input geometries + which have minimum distance between them. These points may + not be vertices of the geometries, but may lie in the interior of + a line segment. In this case the coordinate computed is a close + approximation to the exact point. + + Empty geometry collection components are ignored. + + The algorithms used are straightforward O(n^2) + comparisons. This worst-case performance could be improved on + by using Voronoi techniques. + + + + + Compute the distance between the closest points of two geometries. + + A Geometry. + Another Geometry. + The distance between the geometries. + + + + Test whether two geometries lie within a given distance of each other. + + + + + + + + + Compute the the closest points of two geometries. + The points are presented in the same order as the input Geometries. + + A Geometry. + Another Geometry. + The closest points in the geometries. + + + + Constructs a that computes the distance and closest points between + the two specified geometries. + + A geometry + A geometry + + + + Constructs a that computes the distance and closest points between + the two specified geometries. + + A geometry + A geometry + The distance on which to terminate the search. + + + + Report the distance between the closest points on the input geometries. + + The distance between the geometries
+ or 0 if either input geometry is empty.
+ if either input geometry is null +
+ + + Report the coordinates of the nearest points in the input geometries. + The points are presented in the same order as the input Geometries. + + A pair of Coordinates of the nearest points. + + + + Report the locations of the nearest points in the input geometries. + The locations are presented in the same order as the input Geometries. + + A pair of s for the nearest points. + + + + + + + + + + + + + + + + + + + + + + + + + + + Computes distance between facets (lines and points) of input geometries. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a sequence of facets (points or line segments) of a + specified by a subsequence of a . + + Martin Davis + + + + Creates a new sequence of facets based on a + contained in the given . + + The geometry containing the facets. + The sequence containing the facet points. + The index of the start point. + The index of the end point. + + + + Creates a new sequence of facets based on a . + + The sequence containing facet points. + The index of the start point + The index of the end point + 1 + + + + Creates a new sequence for a single point from a CoordinateSequence. + + The sequence containing the facet point. + the index of the point + + + + Gets the envelope of this facet sequence + + + + + Gets the number of coordinates in this facet sequence + + + + + Gets the coordinate at the given index + + The index + The coordinate at the given index + + + + Tests if this facet sequence consists of only one point + + + + + Computes the distance between this and another + . + + The sequence to compute the distance to. + The minimum distance between the sequences. + + + + Computes the locations of the nearest points between this sequence + and another sequence. + The locations are presented in the same order as the input sequences. + + A pair of s for the nearest points. + + + + + + + Utility class to build facet sequencs STRtrees- + + + + + + + + + + + + Creates facet sequences from a given geometry + + The geometry + A list of s + + + + Represents the location of a point on a Geometry. + Maintains both the actual point location + (which may not be exact, if the point is not a vertex) + as well as information about the component + and segment index where the point occurs. + Locations inside area Geometrys will not have an associated segment index, + so in this case the segment index will have the sentinel value of . + + + + + A special value of segmentIndex used for locations inside area geometries. + These locations are not located on a segment, + and thus do not have an associated segment index. + + + + + Constructs a GeometryLocation specifying a point on a point, as well as the + segment that the point is on (or if the point is not on a segment). + + The component of the geometry containing the point + The segment index of the location, or + The coordinate of the location + + + + Constructs a GeometryLocation specifying a point inside an area point. + + The component of the geometry containing the point + The coordinate of the location + + + + Returns the geometry component on (or in) which this location occurs. + + + + + Returns the segment index for this location. If the location is inside an + area, the index will have the value . + + + + + Returns the of this location. + + + + + Tests whether this location represents a point inside an area geometry. + + + + + + + + Computes the distance between the facets (segments and vertices) + of two s + using a Branch-and-Bound algorithm. + The Branch-and-Bound algorithm operates over a + traversal of R-trees built + on the target and the query geometries. + + This approach provides the following benefits: + + + Performance is dramatically improved due to the use of the + R-tree index + and the pruning due to the Branch-and-Bound approach + + The spatial index on the target geometry is cached + which allow reuse in an repeated query situation. + + Using this technique is usually much more performant + than using the brute-force + when one or both input geometries are large, + or when evaluating many distance computations against + a single geometry. + + + This class is thread-safe. + + Martin Davis + + + + + Computes the distance between facets of two geometries. + + + For geometries with many segments or points, + this can be faster than using a simple distance + algorithm. + + A geometry + A geometry + The distance between the two geometries + + + + Tests whether the facets of two geometries lie within a given distance. + + A geometry + A geometry + The distance limit + true if two facets lie with the given distance + + + + Computes the nearest points of the facets of two geometries. + + A geometry + A geometry + The nearest points on the facets of the geometries + + + + Creates a new distance-finding instance for a given target . + + + + Distances will be computed to all facets of the input geometry. + The facets of the geometry are the discrete segments and points + contained in its components. + + In the case of and inputs, + this is equivalent to computing the conventional distance. + + In the case of inputs, this is equivalent + to computing the distance to the polygon boundaries. + + + A Geometry, which may be of any type. + + + + Computes the distance from the base geometry to the given geometry. + + The geometry to compute the distance to. + The computed distance + + + + Computes the nearest locations on the base geometry + and the given geometry. + + Ihe geometry to compute the nearest location to. + The nearest locations. + + + + Computes the nearest locations on the target geometry + and the given geometry. + + Ihe geometry to compute the nearest point to. + The nearest points. + + + + Tests whether the base geometry lies within + a specified distance of the given geometry. + + The geometry to test + The maximum distance to test + true if the geometry lies with the specified distance + + + + The base class for operations that require s. + + + + + + + + + + + + + + + The operation args into an array so they can be accessed by index. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests whether a is simple. + In general, the SFS specification of simplicity + follows the rule: + + + A Geometry is simple if and only if the only self-intersections are at boundary points. + + + + + Simplicity is defined for each } subclass as follows: + + Valid geometries are simple by definition, so + IsSimple trivially returns true.
+ (Note: this means that IsSimple cannot be used to test + for (invalid) self-intersections in Polygons. + In order to check if a Polygonal geometry has self-intersections, + use ).
+ geometries are simple if and only if they do not self-intersect at interior points + (i.e. points other than boundary points). + This is equivalent to saying that no two linear components satisfy the SFS + predicate. + Zero-dimensional () geometries are simple if and only if they have no + repeated points. + Empty s are always simple by definition. +
+ For geometries the evaluation of simplicity + can be customized by supplying a + to define how boundary points are determined. + The default is the SFS-standard . + Note that under the Mod-2 rule, closed LineStrings (rings) + will never satisfy the touches predicate at their endpoints, since these are + interior points, not boundary points. + If it is required to test whether a set of LineStrings touch + only at their endpoints, use IsSimpleOp with . + For example, this can be used to validate that a set of lines form a topologically valid + linear network. +
+
+ + + Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule + + The geometry to test + + + + Creates a simplicity checker using a given + + The geometry to test + The rule to use + + + + Tests whether the geometry is simple. + + true if the geometry is simple + + + + Gets a coordinate for the location where the geometry fails to be simple. + (i.e. where it has a non-boundary self-intersection). + must be called before this location is accessed + + a coordinate for the location of the non-boundary self-intersection + or null if the geometry is simple + + + + Computes simplicity for polygonal geometries. + Polygonal geometries are simple if and only if + all of their component rings are simple. + + A Polygonal geometry + true if the geometry is simple + + + Semantics for GeometryCollection is + simple if all components are simple. + A GeometryCollection + true if the geometry is simple + + + + For all edges, check if there are any intersections which are NOT at an endpoint. + The Geometry is not simple if there are intersections not at endpoints. + + + + + + + + + + + Creates an instance of this class + + The endpoint + + + + Tests that no edge intersection is the endpoint of a closed line. + This ensures that closed lines are not touched at their endpoint, + which is an interior point according to the Mod-2 rule + To check this we compute the degree of each endpoint. + The degree of endpoints of closed lines + must be exactly 2. + + + + + Add an endpoint to the map, creating an entry for it if none exists. + + + + + + + + A sequence of LineMergeDirectedEdges forming one of the lines that will + be output by the line-merging process. + + + + + Constructs an EdgeString with the given factory used to convert this EdgeString + to a LineString. + + + + + + Adds a directed edge which is known to form part of this line. + + + + + + + + + + + Converts this EdgeString into a LineString. + + + + + A com.vividsolutions.jts.planargraph.DirectedEdge of a LineMergeGraph. + + + + + Constructs a LineMergeDirectedEdge connecting the from node to the to node. + + + + + specifies this DirectedEdge's direction (given by an imaginary + line from the from node to directionPt). + + + whether this DirectedEdge's direction is the same as or + opposite to that of the parent Edge (if any). + + + + + Returns the directed edge that starts at this directed edge's end point, or null + if there are zero or multiple directed edges starting there. + + + + + An edge of a LineMergeGraph. The marked field indicates + whether this Edge has been logically deleted from the graph. + + + + + Constructs a LineMergeEdge with vertices given by the specified LineString. + + + + + + Returns the LineString specifying the vertices of this edge. + + + + + A planar graph of edges that is analyzed to sew the edges together. The + marked flag on s + and s indicates whether they have been + logically deleted from the graph. + + + + + Adds an Edge, DirectedEdges, and Nodes for the given LineString representation + of an edge. + + + + + + + + + + + + Sews together a set of fully noded LineStrings. + + + Sewing stops at nodes of degree 1 + or 3 or more -- the exception is an isolated loop, which only has degree-2 nodes, + in which case a node is simply chosen as a starting point. The direction of each + merged LineString will be that of the majority of the LineStrings from which it + was derived. + + Any dimension of Geometry is handled -- the constituent linework is extracted to + form the edges. The edges must be correctly noded; that is, they must only meet + at their endpoints. The LineMerger will still run on incorrectly noded input + but will not form polygons from incorrected noded edges. + + NOTE:once merging has been performed, no more + + + + + + + + + + + + + + + + + + + + + + Adds a Geometry to be processed. May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be + extracted. + + + + + + Adds a collection of Geometries to be processed. May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be + extracted. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the LineStrings built by the merging process. + + + + + + + Builds a sequence from a set of s, + so that they are ordered end to end. + A sequence is a complete non-repeating list of the linear + components of the input. Each linestring is oriented + so that identical endpoints are adjacent in the list. + + + The input linestrings may form one or more connected sets. + The input linestrings should be correctly noded, or the results may + not be what is expected. + The output of this method is a single , + containing the ordered linestrings in the sequence. + + + The sequencing employs the classic 'Eulerian path' graph algorithm. + Since Eulerian paths are not uniquely determined, further rules are used to + make the computed sequence preserve as much as possible of the input ordering. + Within a connected subset of lines, the ordering rules are: + - If there is degree-1 node which is the start + node of an linestring, use that node as the start of the sequence. + - If there is a degree-1 node which is the end + node of an linestring, use that node as the end of the sequence. + - If the sequence has no degree-1 nodes, use any node as the start + + + Not all arrangements of lines can be sequenced. + For a connected set of edges in a graph, + Euler's Theorem states that there is a sequence containing each edge once + if and only if there are no more than 2 nodes of odd degree. + If it is not possible to find a sequence, the + property will return false. + + + + + + Tests whether a is sequenced correctly. + s are trivially sequenced. + s are checked for correct sequencing. + Otherwise, IsSequenced is defined + to be true for geometries that are not lineal. + + The to test. + + true if the is sequenced or is not lineal. + + + + + Adds a of s to be sequenced. + May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be extracted. + + A of geometries to add. + + + + Adds a to be sequenced. + May be called multiple times. + Any dimension of may be added; + the constituent linework will be extracted. + + + + + + A private implementation for + + + + + Initializes a new instance of the class. + + The sequencer. + + + + Performs an operation with or on + + + A to which the filter is applied. + + + + + Tests whether the arrangement of linestrings has a valid sequence. + + true if a valid sequence exists. + + + + Returns the or + built by the sequencing process, if one exists. + + The sequenced linestrings, + or null if a valid sequence does not exist. + + + + Tests whether a complete unique path exists in a graph + using Euler's Theorem. + + The containing the edges. + true if a sequence exists. + + + + Finds an for an unvisited edge (if any), + choosing the which preserves orientation, if possible. + + The to examine. + + The found, + or null if none were unvisited. + + + + + Computes a version of the sequence which is optimally + oriented relative to the underlying geometry. + + Heuristics used are: + - If the path has a degree-1 node which is the start + node of an linestring, use that node as the start of the sequence. + - If the path has a degree-1 node which is the end + node of an linestring, use that node as the end of the sequence. + - If the sequence has no degree-1 nodes, use any node as the start + (NOTE: in this case could orient the sequence according to the majority of the + linestring orientations). + + + A of s. + + A of s oriented appropriately. + + + + + Reverse the sequence. + This requires reversing the order of the s, + and flipping each as well. + + + A enumeration of s, + in sequential order. + + The reversed sequence. + + + + Builds a geometry ( or ) + representing the sequence. + + + An enumeration of s of s + with s as their parent edges. + + + The sequenced geometry, or null if no sequence exists. + + + + + Unions a valid coverage of polygons or lines + in an efficient way. + + A valid polygonal coverage is a collection of s + which satisfy the following conditions: + + Vector-cleanLine segments within the collection + must either be identical or intersect only at endpoints. + Non-overlappingNo two polygons + may overlap. Equivalently, polygons must be interior-disjoint. + + + A valid linear coverage is a collection of s + which satisfies the Vector-clean condition. + Note that this does not require the LineStrings to be fully noded + - i.e. they may contain coincident linework. + Coincident line segments are dissolved by the union. + Currently linear output is not merged (this may be added in a future release.) + + Currently no checking is done to determine whether the input is a valid coverage. + This is because coverage validation involves segment intersection detection, + which is much more expensive than the union phase. + If the input is not a valid coverage + then in some cases this will be detected during processing + and a is thrown. + Otherwise, the computation will produce output, but it will be invalid. + + Unioning a valid coverage implies that no new vertices are created. + This means that a precision model does not need to be specified. + The precision of the vertices in the output geometry is not changed. + + Martin Davis + + + + + Unions a valid polygonal coverage or linear network. + + A coverage of polygons or lines + The union of the coverage + Thrown in some cases if the coverage is invalid + + + + Represents the linework for edges in a topology graph, + derived from(up to) two parent geometries. + An edge may be the result of the merging of + two or more edges which have the same linework + (although possibly different orientations). + In this case the topology information is + derived from the merging of the information in the + source edges.
+ Merged edges can occur in the following situations + + Due to coincident edges of polygonal or linear geometries. + Due to topology collapse caused by snapping or rounding + of polygonal geometries. + + The source edges may have the same parent geometry, + or different ones, or a mix of the two. +
+ Martin Davis +
+ + + Tests if the given point sequence + is a collapsed line. + A collapsed edge has fewer than two distinct points. + + The point sequence to check + true if the points form a collapsed line + + + + Compares two coincident edges to determine + whether they have the same or opposite direction. + + An edge + true if the edges have the same direction, false if not + + + + Populates the label for an edge resulting from an input geometry. + + + If the edge is not part of the input, the label is left as + If input is an Area and the edge is on the boundary (which may include some collapses), edge is marked as an edge and side locations are assigned + If input is an Area and the edge is collapsed (depth delta = 0), the label is set to . The location will be determined later by evaluating the final graph topology. + If input is a Line edge is set to a edge. For line edges the line location is not significant (since there is no parent area for which to determine location). + + + + + + Tests whether the edge is part of a shell in the given geometry. + This is only the case if the edge is a boundary. + + The index of the geometry + true if this edge is a boundary and part of a shell + + + + Merges an edge into this edge, + updating the topology info accordingly. + + The edge to merge + + + + A key for sorting and comparing edges in a noded arrangement. + Relies on the fact that in a correctly noded arrangement + edges are identical (up to direction) + if they have their first segment in common. + + Martin Davis + + + + + + + + + + + + + Performs merging on the noded edges of the input geometries. + Merging takes place on edges which are coincident + (i.e.have the same coordinate list, modulo direction). + The following situations can occur: + + Coincident edges from different input geometries have their labels combined + Coincident edges from the same area geometry indicate a topology collapse. + In this case the topology locations are "summed" to provide a final + assignment of side location + Coincident edges from the same linear geometry can simply be merged + using the same ON location + + + The merging attempts to preserve the direction of linear + edges if possible(which is the case if there is + no other coincident edge, or if all coincident edges have the same direction). + This ensures that the overlay output line direction will be as consistent + as possible with input lines. + + The merger also preserves the order of the edges in the input. + This means that for polygon-line overlay + the result lines will be in the same order as in the input + (possibly with multiple result lines for a single input line). + + Martin Davis + + + + Builds a set of noded, unique, labelled Edges from + the edges of the two input geometries. + + It performs the following steps: + + Extracts input edges, and attaches topological information + if clipping is enabled, handles clipping or limiting input geometry + chooses a based on provided precision model, unless a custom one is supplied + calls the chosen Noder, with precision model + removes any fully collapsed noded edges + builds s and merges them + + + Martin Davis + + + + Creates a new builder, with an optional custom noder. + If the noder is not provided, a suitable one will + be used based on the supplied precision model. + + The precision model to use + An optional noder to use (may be null) + + + + Gets or sets a noder appropriate for the precision model supplied.
+ This is one of: + + Fixed precision:a snap-rounding noder (which should be fully robust) + Floating precision:a conventional noder (which may be non-robust). + In this case, a validation step is applied to the output from the noder. + +
+
+ + + Reports whether there are noded edges + for the given input geometry. + If there are none, this indicates that either + the geometry was empty, or has completely collapsed + (because it is smaller than the noding precision). + + index of the input geometry + true if there are edges for the geometry + + + + Creates a set of labelled {Edge}s. + representing the fully noded edges of the input geometries. + Coincident edges (from the same or both geometries) + are merged along with their labels + into a single unique, fully labelled edge. + + The first geometry + The second geometry + The noded, merged, labelled edges + + + + Nodes a set of segment strings and creates s from the result. + The input segment strings each carry a object, + which is used to provide source topology info to the constructed Edges + (and is then discarded). + + + + + Adds a polygon ring to the graph. + + Empty rings are ignored. + + + + Tests whether a geometry (represented by its envelope) + lies completely outside the clip extent(if any). + + The geometry envelope + true if the geometry envelope is outside the clip extent. + + + + If clipper is present, + clip the line to the clip extent. + + If clipping is enabled, then every ring MUST + be clipped, to ensure that holes are clipped to + be inside the shell. + This means it is not possible to skip + clipping for rings with few vertices. + + The line to clip + The points in the clipped ring + + + + Removes any repeated points from a linear component. + This is required so that noding can be computed correctly. + + The line to process + The points of the line with repeated points removed + + + + Adds a line geometry, limiting it if enabled, + and otherwise removing repeated points. + + The line to add + The index of the parent geometry + + + + Tests whether it is worth limiting a line. + Lines that have few vertices or are covered + by the clip extent do not need to be limited. + + The line to test + true if the line should be limited + + + + If limiter is provided, + limit the line to the clip envelope. + + The line to clip + the point sections in the clipped line + + + + Records topological information about an + edge representing a piece of linework (lineString or polygon ring) + from a single source geometry. + This information is carried through the noding process + (which may result in many noded edges sharing the same information object). + It is then used to populate the topology info fields + in s (possibly via merging). + That information is used to construct the topology graph s. + + Martin Davis + + + A simple elevation model used to populate missing Z values + in overlay results. + + The model divides the extent of the input geometry(s) + into an NxM grid. + The default grid size is 3x3. + If the input has no extent in the X or Y dimension, + that dimension is given grid size 1. + The elevation of each grid cell is computed as the average of the Z values + of the input vertices in that cell (if any). + If a cell has no input vertices within it, it is assigned + the average elevation over all cells. + + If no input vertices have Z values, the model does not assign a Z value. + + The elevation of an arbitrary location is determined as the + Z value of the nearest grid cell. + + An elevation model can be used to populate missing Z values + in an overlay result geometry. + + Martin Davis + + + + Creates an elevation model from two geometries (which may be null). + + An input geometry + An input geometry + The elevation model computed from the geometries + + + + Creates a new elevation model covering an extent by a grid of given dimensions. + + The XY extent to cover + The number of grid cells in the X dimension + The number of grid cells in the Y dimension + + + + Updates the model using the Z values of a given geometry. + + The geometry to scan for Z values. + + + + Gets the model Z value at a given location. + If the location lies outside the model grid extent, + this returns the Z value of the nearest grid cell. + If the model has no elevation computed (i.e. due + to empty input), the value is returned as + + x-ordinate of the location + y-ordinate of the location + The computed Z value + + + + Computes Z values for any missing Z values in a geometry, + using the computed model. + If the model has no Z value, or the geometry coordinate dimension + does not include Z, the geometry is not updated. + + The geometry to populate Z values for + + + + Locates points on a linear geometry, + using a spatial index to provide good performance. + + Martin Davis + + + + Manages the input geometries for an overlay operation. + The second geometry is allowed to be null, + to support for instance precision reduction. + + Martin Davis + + + + Gets the index of an input which is an area, + if one exists. + Otherwise returns -1. + + The index of an area input, or -1 + + + + Tests if an input geometry has edges. + This indicates that topology needs to be computed for them. + + + true if the input geometry has edges + + + + Determines the location within an area geometry. + This allows disconnected edges to be fully + located. + + The index of the geometry + The coordinate to locate + The location of the coordinate + + + + + Extracts Point resultants from an overlay graph + created by an Intersection operation + between non-Point inputs. + Points may be created during intersection + if lines or areas touch one another at single points. + Intersection is the only overlay operation which can + result in Points from non-Point inputs. + + Overlay operations where one or more inputs + are Points are handled via a different code path. + + Martin Davis + + + + + Controls whether lines created by area topology collapses + to participate in the result computation.
+ True provides the original JTS semantics. +
+
+ + + Tests if a node is a result point. + This is the case if the node is incident on edges from both + inputs, and none of the edges are themselves in the result. + + An edge originating at the node + true if the node is a result point. + + + + Finds and builds overlay result lines from the overlay graph. + Output linework has the following semantics: + + Linework is fully noded + Lines are as long as possible between nodes + + Various strategies are possible for how to + merge graph edges into lines. + This implementation uses the approach + of having output lines run contiguously from node to node. + For rings a node point is chosen arbitrarily. + + Another possible strategy would be to preserve input linework + as far as possible (i.e.any sections of input lines which are not + coincident with other linework would be preserved). + + It would also be possible to output LinearRings, + if the input is a LinearRing and is unchanged. + This will require additional info from the input linework. + + Martin Davis + + + + Indicates whether intersections are allowed to produce + heterogeneous results including proper boundary touches. + This does not control inclusion of touches along collapses.
+ True provides the original JTS semantics. +
+
+ + + Allow lines created by area topology collapses + to appear in the result.
+ True provides the original JTS semantics. +
+
+ + + Creates a builder for linear elements which may be present + in the overlay result. + + The input geometries + The topology graph + true if an area has been generated for the result + The overlay operation code + The output geometry factory + + + + Checks if the topology indicated by an edge label + determines that this edge should be part of a result line. + + Note that the logic here relies on the semantic + that for intersection lines are only returned if + there is no result area components. + + The label for an edge + true if the edge should be included in the result + + + + Determines the effective location for a line, + for the purpose of overlay operation evaluation. + Line edges and Collapses are reported as INTERIOR + so they may be included in the result + if warranted by the effect of the operation on the two edges. + (For instance, the intersection of a line edge and a collapsed boundary + is included in the result). + + The label of line + The index of parent geometry + The effective location of the line + + + + Adds lines which form rings (i.e. have only degree-2 vertices). + + + + + Traverses edges from edgeStart which + lie in a single line (have degree = 2). + + The direction of the linework is preserved as far as possible. + Specifically, the direction of the line is determined + by the start edge direction. This implies + that if all edges are reversed, the created line + will be reversed to match. + This ensures the orientation of linework is faithful to the input + in the case of polygon-line overlay. + However, this does not provide a consistent orientation + in the case of line-line intersection(where A and B might have different orientations). + (Other more complex strategies would be possible. + E.g. using the direction of the majority of segments, + or preferring the direction of the A edges.) + + + + + Finds the next edge around a node which forms + part of a result line. + + A line edge originating at the node to be scanned + The next line edge, or null if there is none + + + + + Computes the degree of the line edges incident on a node + + Node to compute degree for + Degree of the node line edges + + + + Limits the segments in a list of segments + to those which intersect an envelope. + This creates zero or more sections of the input segment sequences, + containing only line segments which intersect the limit envelope. + Segments are not clipped, since that can move + line segments enough to alter topology, + and it happens in the overlay in any case. + This can substantially reduce the number of vertices which need to be + processed during overlay. + + This optimization is only applicable to Line geometries, + since it does not maintain the closed topology of rings. + Polygonal geometries are optimized using the . + + + Martin Davis + + + + Creates a new limiter for a given envelope. + + The envelope to limit to + + + + Limits a list of segments. + + The segment sequence to limit + The sections which intersect the limit envelope + + + + Traverses the star of edges originating at a node + and links consecutive result edges together + into maximal edge rings. + To link two edges the resultNextMax pointer + for an incoming result edge + is set to the next outgoing result edge. + + Edges are linked when: + + they belong to an area (i.e.they have sides) + they are marked as being in the result + + + Edges are linked in CCW order + (which is the order they are linked in the underlying graph). + This means that rings have their face on the Right + (in other words, + the topological location of the face is given by the RHS label of the DirectedEdge). + This produces rings with CW orientation. + + PRECONDITIONS:
+ - This edge is in the result
+ - This edge is not yet linked
+ - The edge and its sym are NOT both marked as being in the result +
+
+ + + Links the edges of a around this node + into minimal edge rings (s). + Minimal ring edges are linked in the opposite orientation (CW) + to the maximal ring. + This changes self-touching rings into a two or more separate rings, + as per the OGC SFS polygon topology semantics. + This relinking must be done to each max ring separately, + rather than all the node result edges, since there may be + more than one max ring incident at the node. + + The maximal ring to link + An edge originating at this node + + + + Tests if an edge of the maximal edge ring is already linked into + a minimal . If so, this node has already been processed + earlier in the maximal edgering linking scan. + + An edge of a maximal edgering + The maximal edgering + true if the edge has already been linked into a minimal edgering. + + + + Creates a single OverlayEdge. + + + + + A new edge based on the given coordinates and direction. + + + + Gets a which sorts by the origin Coordinates. + + + + + true indicates direction is forward along segString
+ false is reverse direction
+ The label must be interpreted accordingly. +
+
+ + + Adds the coordinates of this edge to the given list, + in the direction of the edge. + Duplicate coordinates are removed + (which means that this is safe to use for a path + of connected edges in the topology graph). + + The coordinate list to add to + + + + ets the symmetric pair edge of this edge. + + The symmetric pair edge + + + + Gets the next edge CCW around the origin of this edge, + with the same origin.
+ If the origin vertex has degree 1 then this is the edge itself. +
+ + The next edge around the origin + +
+ + + Gets or sets a link to next edge in the result ring. + The origin of the edge is the dest of this edge. + + + + + Tests whether this ring is a hole. + + true if this ring is a hole + + + + Tests whether this ring has a shell assigned to it. + + true if the ring has a shell + + + + Gets or sets a value indicating the shell for this ring.
+ The shell is the ring itself if it is not a hole, otherwise its parent shell. +
+
+ + + Computes the list of coordinates which are contained in this ring. + The coordinates are computed once only and cached. + + An array of the s in this ring + + + + Finds the innermost enclosing shell OverlayEdgeRing + containing this OverlayEdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: +
+ ring A contains ring B if envelope(ring A) contains envelope(ring B) +
+ This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell) + + To improve performance of this function the caller should + make the passed shellList as small as possible (e.g. + by using a spatial index filter beforehand). +
+ The containing EdgeRing, if there is one + or null if no containing EdgeRing is found + +
+ + + Computes the formed by this ring and any contained holes. + + The formed by this ring and its holes. + + + + A planar graph of edges, representing + the topology resulting from an overlay operation. + Each source edge is represented + by a pair of s, + with opposite(symmetric) orientation. + The pair of OverlayEdges share the edge coordinates + and a single . + + Martin Davis + + + + Gets the set of edges in this graph. + Only one of each symmetric pair of OverlayEdges is included. + The opposing edge can be found by using . + + The collection of representative edges in this graph + + + + Gets the collection of edges representing the nodes in this graph. + For each star of edges originating at a node + a single representative edge is included.
+ The other edges around the node can be found by following the next and prev links. +
+ The collection of representative node edges +
+ + + Gets an edge originating at the given node point. + + The node coordinate to query + An edge originating at the point, or null if none exists + + + + Gets the representative edges marked as being in the result area. + + The result area edges + + + + Adds an edge between the coordinates orig and dest + to this graph.
+ Only valid edges can be added (in particular, zero-length segments cannot be added) +
+ The edge to add. + The edge topology information + The created graph edge with same orientation as the linework +
+ + + Inserts a single half-edge into the graph. + The sym edge must also be inserted. + + The half-edge to insert + + + + A structure recording the topological situation + for an edge in a topology graph + used during overlay processing. + + + A label contains the topological for + one or two input geometries to an overlay operation. + An input geometry may be either a Line or an Area. + The label locations for each input geometry are populated + with the + for the edge s + when they are created or once they are computed by topological evaluation. + A label also records the(effective) dimension of each input geometry. + For area edges the role(shell or hole) + of the originating ring is recorded, to allow + determination of edge handling in collapse cases. + + In an + a single label is shared between + the two oppositely-oriented s + of a symmetric pair. + Accessors for orientation-sensitive information + are parameterized by the orientation of the containing edge. + + For each input geometry (0 and 1), the label records + that an edge is in one of the following states + (identified by thedim field). + Each state has additional information about the edge topology. + + A Boundary edge of an Area (polygon) + + dim = DIM_BOUNDARY + locLeft, locRight : the locations of the edge sides for the Area + locLine : INTERIOR + isHole : whether the edge is in a shell or a hole (the ring role) + + + + A Collapsed edge of an input Area + (formed by merging two or more parent edges) + + dim = DIM_COLLAPSE + locLine : the location of the edge relative to the effective input Area + (a collapsed spike is EXTERIOR, a collapsed gore or hole is INTERIOR) + isHole : true if all parent edges are in holes; + false if some parent edge is in a shell + + + + A Line edge from an input line + + dim = DIM_LINE + locLine : the location of the edge relative to the Line. + Initialized to LOC_UNKNOWN to simplify logic. + + + An edge which is Not Part of an input geometry + (and thus must be part of the other geometry). + + dim = NOT_PART + + + + Note that: + + an edge cannot be both a Collapse edge and a Line edge in the same input geometry, + because each input geometry must be homogeneous. + an edge may be an Boundary edge in one input geometry + and a Line or Collapse edge in the other input. + + + Martin Davis + + + + The dimension of an input geometry which is not known. + + + + + The dimension of an edge which is not part of a specified input geometry. + + + + + The dimension of an edge which is a line. + + + + + The dimension for an edge which is part of an input Area geometry boundary. + + + + + The dimension for an edge which is a collapsed part of an input Area geometry boundary. + A collapsed edge represents two or more line segments which have the same endpoints. + They usually are caused by edges in valid polygonal geometries + having their endpoints become identical due to precision reduction. + + + + + Indicates that the location is currently unknown + + + + + Creates a label for an Area edge + + The input index of the parent geometry + The location of the left side of the edge + The location of the right side of the edge + Whether the edge role is a hole or a shell + + + + Creates a label for a Line edge + + The input index of the parent geometry + + + + Creates an uninitialized label + + + + + Creates a label which is a copy of another label. + + The template label + + + + Gets the effective dimension of the given input geometry. + + The input index of the parent geometry + The dimension + + + + + + + + + Initializes the label for an input geometry which is an Area boundary. + + The input index of the parent geometry + The location of the left side of the edge + The location of the right side of the edge + Whether the edge role is a hole or a shell + + + + Initializes the label for an edge which is the collapse of + part of the boundary of an Area input geometry. + + The location of the collapsed edge relative to the + parent area geometry is initially unknown. + It must be determined from the topology of the overlay graph + + The index of the parent input geometry + Whether the dominant edge role is a hole or a shell + + + + Initializes the label for an input geometry which is a Line. + + The index of the parent input geometry + + + + Initializes the label for an edge which is not part of an input geometry. + + The index of the parent input geometry + + + + Sets the line location. +
+ This is used to set the locations for linear edges + encountered during area label propagation. +
+ The index of the input geometry + Location to set +
+ + + Sets the location of all postions for a given input. + + The index of the input geometry + The location to set + + + + Sets the location for a collapsed edge (the Line position) + for an input geometry, + depending on the ring role recorded in the label. + If the input geometry edge is from a shell, + the location is , if it is a hole + it is . + + The index of the input geometry + + + + Tests whether at least one of the sources is a Line. + + true if at least one source is a line + + + + Tests whether a source is a Line. + + The index of the input geometry + true if the input is a Line + + + + Tests whether an edge is linear (a Line or a Collapse) in an input geometry. + + The index of the input geometry + true if the edge is linear + + + + Tests whether the source of a label is known. + + The index of the input geometry + true if the source is known + + + + Tests whether a label is for an edge which is not part + of a given input geometry. + + The index of the input geometry + true if the edge is not part of the geometry + + + + Gets a value indicating if a label is for an edge which is in the boundary of either source geometry. + + true if the label is a boundary for either source + + + + Gets a value indicating if a label is for an edge which is in the boundary of both source geometries. + + true if the label is a boundary for both sources + + + + Tests if the label is a collapsed edge of one area + and is a(non-collapsed) boundary edge of the other area. + + true if the label is for a collapse coincident with a boundary + + + + Tests if a label is for an edge where two + area touch along their boundary. + + true if the edge is a boundary touch + + + + Tests if a label is for an edge which is in the boundary of a source geometry. + Collapses are not reported as being in the boundary. + + The index of the input geometry + true if the label is a boundary for the source + + + + Tests whether a label is for an edge which is a boundary of one geometry + and not part of the other. + + true if the edge is a boundary singleton + + + + Tests if the line location for a source is unknown. + + The index of the input geometry + true if the line location is unknown + + + + Tests if a line edge is inside a source geometry + (i.e.it has location ). + + The index of the input geometry + true if the line is inside the source geometry + + + + Tests if the ring role of an edge is a hole. + + The index of the input geometry + true if the ring role is a hole + + + + Tests if an edge is a Collapse for a source geometry. + + The index of the input geometry + true if the label indicates the edge is a collapse for the source + + + + Tests if a label is a Collapse has location {@link Location#INTERIOR}, + to at least one source geometry. + + true if the label is an Interior Collapse to a source geometry + + + + Tests if a label is a Collapse + and NotPart with location {@link Location#INTERIOR} for the other geometry. + + true if the label is a Collapse and a NotPart with Location Interior + + + + Gets the line location for a source geometry. + + The index of the input geometry + The line location for the source + + + + Tests if a line is in the interior of a source geometry. + + The index of the source geometry + true if the label is a line and is interior + + + + Gets the location for a of an edge of a source + for an edge with given orientation. + + The index of the input geometry + The position to get the location for + true if the orientation of the containing edge is forward + The location of the oriented position in the source + + + + Gets the location for this label for either + a Boundary or a Line edge. + This supports a simple determination of + whether the edge should be included as a result edge. + + The source index + The position for a boundary label + The direction for a boundary label + The location for the specified position + + + + Gets the linear location for the given source. + + The source geometry index + The linear location for the source + + + + Tests whether this label has side position information + for a source geometry. + + The index of the input geometry + true if at least one side position is known + + + + Creates a copy of this label + + A copy of this label + + + + Gets a symbol for the a ring role (Shell or Hole). + + true for a hole, false for a shell + The ring role symbol character + + + + Gets the symbol for the dimension code of an edge. + + The dimension code + The dimension symbol character + + + + Implements the logic to compute the full labeling + for the edges in an . + + Martin Davis + + + + Computes the topological labeling for the edges in the graph. + + + + + Labels edges around nodes based on the arrangement + of incident area boundary edges. + Also propagates the labeling to connected linear edges. + + The nodes to label + + + + Scans around a node CCW, propagating the side labels + for a given area geometry to all edges (and their sym) + with unknown locations for that geometry. + + + The geometry to propagate locations for + + + + Finds a boundary edge for this geom originating at the given + node, if one exists. + A boundary edge should exist if this is a node on the boundary + of the parent area geometry. + + An edge for this node + The parent geometry index + A boundary edge, or null if no boundary edge exists + + + + At this point collapsed edges with unknown location + must be disconnected from the boundary edges of the parent + (because otherwise the location would have + been propagated from them).
+ They can be now located based on their parent ring role(shell or hole). + (This cannot be done earlier, because the location + based on the boundary edges must take precedence.
+ There are situations where a collapsed edge has a location + which is different to its ring role - + e.g.a narrow gore in a polygon, which is in + the interior of the reduced polygon, but whose + ring role would imply the location EXTERIOR.) + + Note that collapsed edges can NOT have location determined via a PIP location check, + because that is done against the unreduced input geometry, + which may give an invalid result due to topology collapse. + + The labeling is propagated to other connected linear edges, + since there may be NOT_PART edges which are connected, + and they can be labeled in the same way. + (These would get labeled anyway during subsequent disconnected labeling pass, + but may be more efficient and accurate to do it here.) +
+
+ + + There can be edges which have unknown location + but are connected to a linear edge with known location. + In this case linear location is propagated to the connected edges. + + + + + Performs a breadth-first graph traversal to find and label + connected linear edges. + + The index of the input geometry to label. + + + + Finds all OverlayEdges which are linear + (i.e.line or collapsed) and have a known location + for the given input geometry. + + The index of the input geometry + A list of linear edges with known location + + + + At this point there may still be edges which have unknown location + relative to an input geometry.
+ This must be because they are NOT_PART edges for that geometry, + and are disconnected from any edges of that geometry. + An example of this is rings of one geometry wholly contained + in another geometry.
+ The location must be fully determined to compute a + correct result for all overlay operations. + + If the input geometry is an Area the edge location can + be determined via a PIP test. + If the input is not an Area the location is EXTERIOR. +
+
+ + + Determines the location of an edge relative to a target input geometry. + The edge has no location information + because it is disconnected from other + edges that would provide that information. + The location is determined by checking + if the edge lies inside the target geometry area(if any). + + The edge to label + The input geometry to label against + + + + Determines the for an edge within an Area geometry + via point-in-polygon location. + + NOTE this is only safe to use for disconnected edges, + since the test is carried out against the original input geometry, + and precision reduction may cause incorrect results for edges + which are close enough to a boundary to become connected. + + The parent geometry index + The edge to locate + The location of the edge. + + + + Determines the {@link Location} for an edge within an Area geometry + via point-in-polygon location, + by checking that both endpoints are interior to the target geometry. + Checking both endpoints ensures correct results in the presence of topology collapse. + + NOTE this is only safe to use for disconnected edges, + since the test is carried out against the original input geometry, + and precision reduction may cause incorrect results for edges + which are close enough to a boundary to become connected. + + The parent geometry index + The edge to locate + The location of the edge + + + + Marks an edge which forms part of the boundary of the result area. + This is determined by the overlay operation being executed, + and the location of the edge. + The relevant location is either the right side of a boundary edge, + or the line location of a non-boundary edge. + + The edge to mark + The overlay operation + + + + Unmarks result area edges where the sym edge + is also marked as in the result. + This has the effect of merging edge-adjacent result areas, + as required by polygon validity rules. + + + + + Computes an overlay where one input is Point(s) and one is not. + This class supports overlay being used as an efficient way + to find points within or outside a polygon. + + Input semantics are: + + Duplicates are removed from Point output + Non-point output is rounded and noded using the given precision model + + Output semantics are: + + An empty result is an empty atomic geometry + with dimension determined by the inputs and the operation as per overlay semantics + + + For efficiency the following optimizations are used: + + Input points are not included in the noding of the non-point input geometry + (in particular, they do not participate in snap-rounding if that is used). + If the non-point input geometry is not included in the output + it is not rounded and noded.This means that points + are compared to the non-rounded geometry. + This will be apparent in the result. + + This means that overlay is efficient to use for finding points + within or outside a polygon. + + Martin Davis + + + + Copy the non-point input geometry if not + already done by precision reduction process. + + A copy of the non-point geometry + + + + Computes the geometric overlay of two s, + using an explicit precision model to allow robust computation. + + The overlay can be used to determine any of the + following set-theoretic operations (boolean combinations) of the geometries: + + all points which lie in both geometries + all points which lie in at least one geometry + all points which lie in the first geometry but not the second + all points which lie in one geometry but not both + + Input geometries may have different dimension. + Input collections must be homogeneous (all elements must have the same dimension). + + The precision model used for the computation can be supplied + independent of the precision model of the input geometry. + The main use for this is to allow using a fixed precision + for geometry with a floating precision model. + This does two things: ensures robust computation; + and forces the output to be validly rounded to the precision model. + + For fixed precision models noding is performed using a . + This provides robust computation(as long as precision is limited to + around 13 decimal digits). + + For floating precision an is used. + This is not fully robust, so can sometimes result in + s being thrown. + For robust full-precision overlay see . + + A custom can be supplied. + This allows using a more performant noding strategy in specific cases, + for instance in . + + Note: If a is used + it is best to specify a fairly small snap tolerance, + since the intersection clipping optimization can + interact with the snapping to alter the result. + + Optionally the overlay computation can process using strict mode + (via = true). + In strict mode result semantics are: + + Lines and Points resulting from topology collapses are not included in the result + Result geometry is homogeneous + for the and operations. + Result geometry is homogeneous + for the and operations + if the inputs have the same dimension + + Strict mode has the following benefits: + + Results are simpler + Overlay operations are easily chainable + without needing to remove lower-dimension elements + + The original JTS overlay semantics corresponds to non-strict mode. + + If a robustness error occurs, a is thrown. + These are usually caused by numerical rounding causing the noding output + to not be fully noded. + For robust computation with full-precision + can be used. + + + + + The code for the Intersection overlay operation. + + + + + The code for the Union overlay operation. + + + + + The code for the Difference overlay operation. + + + + + The code for the Symmetric Difference overlay operation. + + + + + The default setting for Strict Mode. + + The original JTS overlay semantics used non-strict result + semantics, including;
+ - An Intersection result can be mixed-dimension, + due to inclusion of intersection components of all dimensions
+ - Results can include lines caused by Area topology collapse +
+
+ + + Tests whether a point with a given topological + relative to two geometries is contained in + the result of overlaying the geometries using + a given overlay operation. + + The method handles arguments of correctly + + The topological label of the point + The code for the overlay operation to test + true if the label locations correspond to the overlay + + + + Tests whether a point with given s + relative to two geometries would be contained in + the result of overlaying the geometries using + a given overlay operation. + This is used to determine whether components + computed during the overlay process should be + included in the result geometry. + + The method handles arguments of correctly. + + The code for the overlay operation to test + The code for the location in the first geometry + The code for the location in the second geometry + true if a point with given locations is in the result of the overlay operation + + + + Computes an overlay operation for + the given geometry operands, with the + noding strategy determined by the precision model. + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The precision model to use + The result of the overlay operation + + + + Computes an overlay operation for + the given geometry operands, using a supplied . + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The precision model to use (which may be null if the noder does not use one) + The noder to use + The result of the overlay operation + + + + Computes an overlay operation on the given geometry operands, + using a supplied . + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The noder to use + The result of the overlay operation + + + + Computes an overlay operation on + the given geometry operands, + using the precision model of the geometry. + and an appropriate noder. + + The noder is chosen according to the precision model specified. + + For + a snap-rounding noder is used, and the computation is robust. + For + a non-snapping noder is used, + and this computation may not be robust. + If errors occur a is thrown. + + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The result of the overlay operation + + + + Computes a union operation on + the given geometry, with the supplied precision model. + + The input must be a valid geometry. + Collections must be homogeneous. + + To union an overlapping set of polygons in a more performant way use . + To union a polygonal coverage or linear network in a more performant way, + use . + + The geometry + The precision model to use + The result of the union operation + + + + + Computes a union of a single geometry using a custom noder. + + The primary use of this is to support coverage union. + Because of this the overlay is performed using strict mode. + + The geometry to union + The precision model to use (maybe be null) + The noder to use + the result geometry + + + + + Creates an overlay operation on the given geometries, + with a defined precision model. + + The A operand geometry + The B operand geometry (may be null) + The precision model to use + The overlay opcode + + + + Creates an overlay operation on the given geometries + using the precision model of the geometries. + + The noder is chosen according to the precision model specified. + + For + a snap - rounding noder is used, and the computation is robust. + For a non - snapping noder is used, + and this computation may not be robust. + If errors occur a is thrown. + + + The A operand geometry + The B operand geometry (may be null) + The overlay opcode + + + + Creates a union of a single geometry with a given precision model. + + The geometry + The precision model to use + + + + Gets or sets whether the overlay results are computed according to strict mode + semantics. + + Lines resulting from topology collapse are not included + Result geometry is homogeneous for the + and + operations. + Result geometry is homogeneous for the + and + operations if the inputs have the same dimension + + + + + + + Gets or sets a value indicating whether overlay processing optimizations are enabled. + + It may be useful to disable optimizations + for testing purposes. + + Default is true (optimization enabled). + + + + + Gets or sets whether the result can contain only components. + This is used if it is known that the result must be an (possibly empty) area. + + true if the result should contain only area components + + + + Gets the result of the overlay operation. + e + The result of the overlay operation. + Thrown, if the input is not supported (e.g. a mixed-dimension geometry) + Thrown, if a robustness error occurs + + + + Extracts the result geometry components from the fully labelled topology graph. + + This method implements the semantic that the result of an + intersection operation is homogeneous with highest dimension. + In other words, + if an intersection has components of a given dimension + no lower-dimension components are output. + For example, if two polygons intersect in an area, + no linestrings or points are included in the result, + even if portions of the input do meet in lines or points. + This semantic choice makes more sense for typical usage, + in which only the highest dimension components are of interest. + + The overlay operation + The topology graph + The result geometry + + + + Performs an overlay operation using , + increasing robustness by using a series of + increasingly robust (but slower) noding strategies. + + The noding strategies used are: + + A simple fast noder using precision + A using an automatically-determined snap tolerance + First snapping each geometry to itself, and then overlaying them wih a + The above two strategies are repeated with increasing snap tolerance, up to a limit + Finally a is used with a automatically-determined scale factor. + + If all of the above heuristics fail to compute a valid overlay, + the original is thrown. + In practice this should be extremely unlikely to occur. + + This algorithm relies on each overlay operation execution + throwing a if it is unable + to compute the overlay correctly. + Generally this occurs because the noding phase does + not produce a valid noding. + This requires the use of a + in order to check the results of using a floating noder. + + Martin Davis + + + + Computes the unary union of a geometry using robust computation. + + The geometry to union + The union result + + + + Computes the unary union of a collection of geometries using robust computation. + + An enumeration of geometries to union + The union result + + + + Computes the unary union of a collection of geometries using robust computation. + + An enumeration of geometries to union + The geometry factory to use + The union of the geometries + + + + Overlay two geometries, using heuristics to ensure + computation completes correctly. + In practice the heuristics are observed to be fully correct. + + A geometry + A geometry + The overlay operation code + The overlay result geometry + + + + Attempt overlay using snapping with repeated tries with increasing snap tolerances. + + + + + The computed overlay result, or null if the overlay fails + + + + Attempt overlay using a . + + + + + + The computed overlay result, or null if the overlay fails + + + + Attempt overlay with first snapping each geometry individually. + + + + + + The computed overlay result, or null if the overlay fails + + + + Self-snaps a geometry by running a union operation with it as the only input. + This helps to remove narrow spike/gore artifacts to simplify the geometry, + which improves robustness. + Collapsed artifacts are removed from the result to allow using + it in further overlay operations. + + Geometry to self-snap + Snap tolerance + The snapped geometry (homogenous) + + + + A factor for a snapping tolerance distance which + should allow noding to be computed robustly. + + + + + Computes a heuristic snap tolerance distance + for overlaying a pair of geometries using a . + + + + + + + + Computes the largest magnitude of the ordinates of a geometry, + based on the geometry envelope. + + + The magnitude of the largest ordinate + + + + Attempt Overlay using Snap-Rounding with an automatically-determined + scale factor. + + + + + the computed overlay result, or null if the overlay fails + + + + Performs an overlay operation on inputs which are both point geometries. + + Semantics are: + + Points are rounded to the precision model if provided + Points with identical XY values are merged to a single point + Extended ordinate values are preserved in the output, apart from merging + An empty result is returned as POINT EMPTY + + + Martin Davis + + + + Performs an overlay operation on inputs which are both point geometries. + + The code for the desired overlay operation + The first geometry argument + The second geometry argument + The precision model to use + The result of the overlay operation + + + + Creates an instance of an overlay operation on inputs which are both point geometries. + + The code for the desired overlay operation + The first geometry argument + The second geometry argument + The precision model to use + + + + Gets the result of the overlay. + + + + + Round the key point if precision model is fixed. + Note: return value is only copied if rounding is performed. + + + + + Utility methods for overlay processing. + + Martin Davis + + + + A null-handling wrapper for + + A precision model + true if the provided precision model is floating + + + + Computes a clipping envelope for overlay input geometries. + The clipping envelope encloses all geometry line segments which + might participate in the overlay, with a buffer to + account for numerical precision + (in particular, rounding due to a precision model. + The clipping envelope is used in both the + and in the . + + Some overlay operations (i.e. and ) + cannot use clipping as an optimization, + since the result envelope is the full extent of the two input geometries. + In this case the returned + envelope is null to indicate this. + + The overlay op code + The input geometries + The precision model being used + An envelope for clipping and line limiting, or null if no clipping is performed + + + + Computes an envelope which covers the extent of the result of + a given overlay operation for given inputs. + The operations which have a result envelope smaller than the extent of the inputs + are: + + + result envelope is the intersection of the input envelopes + + result envelope is the envelope of the A input geometry + + Otherwise, null is returned to indicate full extent. + + The overlay op code + The input geometries + The precision model being used + The result envelope, or null if the full extent + + + + Determines a safe geometry envelope for clipping, + taking into account the precision model being used. + + A safe geometry envelope for clipping + The precision model + A safe envelope to use for clipping + + + + Tests if the result can be determined to be empty + based on simple properties of the input geometries + (such as whether one or both are empty, + or their envelopes are disjoint). + + The overlay operation + The A operand geometry + The B operand geometry + The precision model to use + true if the overlay result is determined to be empty + + + + Tests if the geometry envelopes are disjoint, or empty. + The disjoint test must take into account the precision model + being used, since geometry coordinates may shift under rounding. + + The A operand geometry + The B operand geometry + The precision model to use + true if the geometry envelopes are disjoint or empty + + + + Tests for disjoint envelopes adjusting for rounding + caused by a fixed precision model. + Assumes envelopes are non-empty. + + The A operand envelope + The B operand envelope + The precision model to use + true if the envelopes are disjoint + + + + Creates an empty result geometry of the appropriate dimension, + based on the given overlay operation and the dimensions of the inputs. + The created geometry is an atomic geometry, + not a collection(unless the dimension is , + in which case a GEOMETRYCOLLECTION EMPTY is created. + + The dimension of the empty geometry + The geometry factory being used for the operation + An empty atomic geometry of the appropriate dimension + + + + Computes the dimension of the result of + applying the given operation to inputs + with the given dimensions. + This assumes that complete collapse does not occur. + + The result dimension is computed using the following rules: + + result has the dimension of the lowest input dimension + result has the dimension of the highest input dimension + result has the dimension of the left-hand input + result has the dimension of the highest input dimension + (since the Symmetric Difference is the Union of the Differences). + + + The overlay operation + Dimension of the LH input + Dimension of the RH input + + + + + Creates an overlay result geometry for homogeneous or mixed components. + + An enumeration of result polygons (may be empty or null) + An enumeration of result lines (may be empty or null) + An enumeration of result points (may be empty or null) + The geometry factory to use. + A geometry structured according to the overlay result semantics + + + + Round the key point if precision model is fixed. + Note: return value is only copied if rounding is performed. + + The point to round + The precision model to use + The rounded point coordinate, or null if empty + + + + A heuristic check for overlay result correctness + comparing the areas of the input and result. + The heuristic is necessarily coarse, but it detects some obvious issues.
+ (e.g. ) + + Note: - this check is only safe if the precision model is floating. + It should also be safe for snapping noding if the distance tolerance is reasonably small. + (Fixed precision models can lead to collapse causing result area to expand.) +
+ Input geometry 0 + Input geometry 1 + The overlay opcode + The overlay result + true if the result area is consistent +
+ + + For all OverlayEdges in result, form them into MaximalEdgeRings + + + + + Finds the single shell, if any, out of + a list of minimal rings derived from a maximal ring. + The other possibility is that they are a set of (connected) holes, + in which case no shell will be found. + + The shell ring, if there is one + or null, if all rings are holes + + + + + For the set of minimal rings comprising a maximal ring, + assigns the holes to the shell known to contain them. + Assigning the holes directly to the shell serves two purposes: + + it is faster than using a point-in-polygon check later on. + it ensures correctness, since if the PIP test was used the point + chosen might lie on the shell, which might return an incorrect result from the + PIP test + + + + + + Place holes have not yet been assigned to a shell. + These "free" holes should + all be properly contained in their parent shells, so it is safe to use the + findEdgeRingContaining method. + (This is the case because any holes which are NOT + properly contained (i.e. are connected to their + parent shell) would have formed part of a MaximalEdgeRing + and been handled in a previous step). + + If a hole cannot be assigned to a shell + + + + Functions to reduce the precision of a geometry + by rounding it to a given precision model. + + This class handles only polygonal and linear inputs. + For full functionality . + + + Martin Davis + + + + Reduces the precision of a geometry by rounding and snapping it to the + supplied .
+ The input geometry must be polygonal or linear. + + The output is always a valid geometry. This implies that input components + may be merged if they are closer than the grid precision. + if merging is not desired, then the individual geometry components + should be processed separately. + + The output is fully noded (i.e. coincident lines are merged and noded). + This provides an effective way to node / snap-round a collection of s. +
+ The geometry to reduce + The precision model to use + The precision-reduced geometry +
+ + + Functions for computing precision model scale factors + that ensure robust geometry operations. + In particular, these can be used to + automatically determine appropriate scale factors for operations + using limited-precision noding (such as ). + + WARNING: the inherentScale and robustScale + functions can be very slow, due to the method used to determine + number of decimal places of a number. + These are not recommended for production use. + + Martin Davis + + + + A number of digits of precision which leaves some computational "headroom" + to ensure robust evaluation of certain double-precision floating point geometric operations. + + This value should be less than the maximum decimal precision of double-precision values (16). + + + + + Computes a safe scale factor for a numeric value. + A safe scale factor ensures that rounded + number has no more than + digits of precision. + + A numeric value. + A safe scale factor for the value + + + + Computes a safe scale factor for a geometry. + A safe scale factor ensures that rounded + number has no more than + digits of precision. + + A geometry. + A safe scale factor for the geometry ordinates + + + + Computes a safe scale factor for two geometry. + A safe scale factor ensures that rounded + number has no more than + digits of precision. + + A geometry. + A geometry (which may be null). + A safe scale factor for the geometry ordinates + + + + Determines the maximum magnitude (absolute value) of the bounds of an + of an envelope. + This is equal to the largest ordinate value + which must be accommodated by a scale factor. + + An envelope + The value of the maximum bound magnitude + + + + Computes the scale factor which will + produce a given number of digits of precision(significant digits) + when used to round the given number. + + For example: to provide 5 decimal digits of precision + for the number 123.456 the precision scale factor is 100; + for 3 digits of precision the scale factor is 1; + for 2 digits of precision the scale factor is 0.1. + + Rounding to the scale factor can be performed with + + A number to be rounded + The number of digits of precision required + The scale factor which provides the required number of digits of precision + + + + + Computes the inherent scale of a number. + The inherent scale is the scale factor for rounding + which preserves all digits of precision + (significant digits) + present in the numeric value. + In other words, it is the scale factor which does not + change the numeric value when rounded: + + num = round( num, inherentScale(num) ) + + + A number + The inherent scale factor of the number + + + + Computes the inherent scale of a geometry. + The inherent scale is the scale factor for rounding + which preserves all digits of precision + (significant digits) + present in the geometry ordinates. + + This is the maximum inherent scale + of all ordinate values in the geometry. + + WARNING: this is very slow. + + A geometry + The inherent scale factor in the geometry's ordinates + + + + Computes the inherent scale of two geometries. + The inherent scale is the scale factor for rounding + which preserves all digits of precision + (significant digits) + present in the geometry ordinates. + + This is the maximum inherent scale + of all ordinate values in the geometries. + + A geometry + A geomety (which may be null) + The inherent scale factor in the geometries' ordinates + + + + Determines the + number of decimal places represented in a double-precision + number (as determined by .NET). + This uses the .NET double-precision print routine + to determine the number of decimal places, + This is likely not optimal for performance, + but should be accurate and portable. + + A numeric value + The number of decimal places in the value + + + + Applies the inherent scale calculation + to every ordinate in a geometry. + + WARNING: this is very slow. + + Martin Davis + + + + Determines a precision model to + use for robust overlay operations for one geometry. + The precision scale factor is chosen to maximize + output precision while avoiding round-off issues. + + NOTE: this is a heuristic determination, so is not guaranteed to + eliminate precision issues. + + WARNING: this is very slow. + + A geometry + A suitable precision model for overlay + + + + Determines a scale factor which maximizes + the digits of precision and is + safe to use for overlay operations. + The robust scale is the minimum of the + inherent scale and the safe scale factors. + + WARNING: this is very slow. + + A geometry + A geometry + A scale factor for use in overlay operations + + + + Determines a scale factor which maximizes + the digits of precision and is + safe to use for overlay operations. + The robust scale is the minimum of the + inherent scale and the safe scale factors. + + A geometry + A scale factor for use in overlay operations + + + + Clips a ring of points to an rectangle. + Uses a variant of Cohen-Sutherland clipping. + + In general the output is not topologically valid. + In particular, the output may contain coincident non-noded line segments + along the clip rectangle sides. + However, the output is sufficiently well-structured + that it can be used as input to the algorithm + (which is able to process coincident linework due + to the need to handle topology collapse under precision reduction). + + Because of the likelihood of creating + extraneous line segments along the clipping rectangle sides, + this class is not suitable for clipping linestrings. + + The clipping envelope should be generated using , + to ensure that intersecting line segments are not perturbed + by clipping. + This is required to ensure that the overlay of the + clipped geometry is robust and correct (i.e. the same as + if clipping was not used). + + + Martin Davis + + + + Creates a new clipper for the given envelope. + + The clipping envelope + + + + Clips a list of points to the clipping rectangle box. + + The points of the ring + The points of the clipped ring + + + + Clips line to the axis-parallel line defined by a single box edge. + + The coordinates + An edge index + A flag indicating whether to close the ring. + The clipped coordinates + + + + Computes the intersection point of a segment + with an edge of the clip box. + The segment must be known to intersect the edge. + + First endpoint of the segment + Second endpoint of the segment + Index of box edge + + The intersection point with the box edge + + + + + Computes a robust clipping envelope for a pair of polygonal geometries. + The envelope is computed to be large enough to include the full + length of all geometry line segments which intersect + a given target envelope. + This ensures that line segments which might intersect are + not perturbed when clipped using . + + Martin Davis + + + + Adds a polygon ring to the graph. Empty rings are ignored. + + + + + Unions a collection of geometries in an + efficient way, using + to ensure robust computation. + + This class is most useful for performing UnaryUnion using + a fixed-precision model.
+ For unary union using floating precision, + should be used. +
+ Martin Davis +
+ + + Unions a geometry (which is often a collection) + using a given precision model. + + The geometry to union + The precision model to use + The union of the geometry + + + + + Unions a geometry (which is often a collection) + using a given precision model. + + The geometries to union + The precision model to use + The union of the geometries + + + + + Unions a geometry (which is often a collection) + using a given precision model. + + The geometries to union + The geometry factory to use + The precision model to use + The union of the geometries + + + + + Nodes a set of edges. + Takes one or more sets of edges and constructs a + new set of edges consisting of all the split edges created by + noding the input edges together. + + + + + + + + + + + + + + + + + + + + + + Forms NTS LineStrings out of a the graph of DirectedEdges + created by an OverlayOp. + + + + + + + + + + + + + + + + + A list of the LineStrings in the result of the specified overlay operation. + + + + + Find and mark L edges which are "covered" by the result area (if any). + L edges at nodes which also have A edges can be checked by checking + their depth at that node. + L edges at nodes which do not have A edges can be checked by doing a + point-in-polygon test with the previously computed result areas. + + + + + + + + + + + + + + + + + + + Collect edges from Area inputs which should be in the result but + which have not been included in a result area. + This happens ONLY: + during an intersection when the boundaries of two + areas touch in a line segment + OR as a result of a dimensional collapse. + + + + + + + + + + + + + + + + + + + + Label an isolated node with its relationship to the target point. + + + + + + + A ring of edges which may contain nodes of degree > 2. + A MaximalEdgeRing may represent two different spatial entities: + a single polygon possibly containing inversions (if the ring is oriented CW) + a single hole possibly containing exversions (if the ring is oriented CCW) + If the MaximalEdgeRing represents a polygon, + the interior of the polygon is strongly connected. + These are the form of rings used to define polygons under some spatial data models. + However, under the OGC SFS model, MinimalEdgeRings are required. + A MaximalEdgeRing can be converted to a list of MinimalEdgeRings using the + BuildMinimalRings() method. + + + + + + + + + + + + + + + + + + + + + + + + + + For all nodes in this EdgeRing, + link the DirectedEdges at the node to form minimalEdgeRings + + + + + + + + + + + A ring of edges with the property that no node + has degree greater than 2. These are the form of rings required + to represent polygons under the OGC SFS spatial data model. + + + + + + + + + + + + + + + + + + + + + + + + + + Creates nodes for use in the PlanarGraphs constructed during + overlay operations. + + + + + + + + + + + + The spatial functions supported by this class. + These operations implement various bool combinations of the resultants of the overlay. + + + + + The code for the Intersection overlay operation + + + + + The code for the Union overlay operation + + + + + The code for the Difference overlay operation + + + + + The code for the Symmetric Difference overlay operation + + + + + Computes the geometric overlay of two s. The overlay + can be used to determine any bool combination of the geometries. + + + + + Disable + when an intersection is made (), + so performances are dramatically improved but failures are not managed. + + + Use ay your own risk! + + + + + Computes an overlay operation + for the given geometry arguments. + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The result of the overlay operation + Thrown if a robustness problem is encountered. + + + + Tests whether a point with a given topological + relative to two geometries is contained in + the result of overlaying the geometries using + a given overlay operation. + + The method handles arguments of correctly + + The topological label of the point + The code for the overlay operation to test + true if the label locations correspond to the overlayOpCode + + + + Tests whether a point with given s + relative to two geometries is contained in + the result of overlaying the geometries using + a given overlay operation. + + The method handles arguments of correctly + + the code for the location in the first geometry + the code for the location in the second geometry + the code for the overlay operation to test + true if the locations correspond to the overlayOpCode. + + + + Constructs an instance to compute a single overlay operation + for the given geometries. + + The first geometry argument + The second geometry argument + + + + Gets the result of the overlay for a given overlay operation. + + Note: this method can be called once only. + + The code of the overlay operation to perform + The computed result geometry + Thrown if a robustness problem is encountered + + + + Gets the graph constructed to compute the overlay. + + + + + Insert an edge from one of the noded input graphs. + Checks edges that are inserted to see if an + identical edge already exists. + If so, the edge is not inserted, but its label is merged + with the existing edge. + + The edge to insert + + + + Update the labels for edges according to their depths. + For each edge, the depths are first normalized. + Then, if the depths for the edge are equal, + this edge must have collapsed into a line edge. + If the depths are not equal, update the label + with the locations corresponding to the depths + (i.e. a depth of 0 corresponds to a Location of Exterior, + a depth of 1 corresponds to Interior) + + + + + If edges which have undergone dimensional collapse are found, + replace them with a new edge which is a L edge + + + + + Copy all nodes from an arg point into this graph. + The node label in the arg point overrides any previously computed + label for that argIndex. + (E.g. a node may be an intersection node with + a previously computed label of Boundary, + but in the original arg Geometry it is actually + in the interior due to the Boundary Determination Rule) + + + + + + Compute initial labelling for all DirectedEdges at each node. + In this step, DirectedEdges will acquire a complete labelling + (i.e. one with labels for both Geometries) + only if they + are incident on a node which has edges for both Geometries + + + + + For nodes which have edges from only one Geometry incident on them, + the previous step will have left their dirEdges with no labelling for the other + Geometry. However, the sym dirEdge may have a labelling for the other + Geometry, so merge the two labels. + + + + + Incomplete nodes are nodes whose labels are incomplete. + (e.g. the location for one Geometry is null). + These are either isolated nodes, + or nodes which have edges from only a single Geometry incident on them. + Isolated nodes are found because nodes in one graph which don't intersect + nodes in the other are not completely labelled by the initial process + of adding nodes to the nodeList. + To complete the labelling we need to check for nodes that lie in the + interior of edges, and in the interior of areas. + When each node labelling is completed, the labelling of the incident + edges is updated, to complete their labelling as well. + + + + + Label an isolated node with its relationship to the target point. + + + + + Find all edges whose label indicates that they are in the result area(s), + according to the operation being performed. Since we want polygon shells to be + oriented CW, choose dirEdges with the interior of the result on the RHS. + Mark them as being in the result. + Interior Area edges are the result of dimensional collapses. + They do not form part of the result area boundary. + + + + + If both a dirEdge and its sym are marked as being in the result, cancel + them out. + + + + + Tests if a point node should be included in the result or not. + + The point coordinate + true if the coordinate point is covered by a result Line or Area geometry. + + + + Tests if an L edge should be included in the result or not. + + The point coordinate + true if the coordinate point is covered by a result Area geometry. + + + + true if the coord is located in the interior or boundary of + a point in the list. + + + + + Creates an empty result geometry of the appropriate dimension, + based on the given overlay operation and the dimensions of the inputs. + The created geometry is always an atomic geometry, + not a collection. + + The empty result is constructed using the following rules: + + - result has the dimension of the lowest input dimension + - result has the dimension of the highest input dimension + - result has the dimension of the left-hand input + - result has the dimension of the highest input dimension + (since symDifference is the union of the differences). + + + The overlay operation being performed + An input geometry + An input geometry + The geometry factory being used for the operation + An empty atomic geometry of the appropriate dimension + + + + Constructs Points from the nodes of an overlay graph. + + + + + Creates an instance of this class + + The operation + The geometry factory + + + + Computes the Point geometries which will appear in the result, + given the specified overlay operation. + + The spatial function + + A list of the Points in the result. + + + + + Determines nodes which are in the result, and creates s for them. + + + This method determines nodes which are candidates for the result via their + labelling and their graph topology. + + The overlay operation + + + + Converts non-covered nodes to Point objects and adds them to the result. + + + A node is covered if it is contained in another element Geometry + with higher dimension (e.g. a node point might be contained in a polygon, + in which case the point can be eliminated from the result). + + The node to test + + + + Forms Polygons out of a graph of {DirectedEdge}s. + The edges to use are marked as being in the result Area. + + + + + + + + + + + Add a complete graph. + The graph is assumed to contain one or more polygons, + possibly with holes. + + + + + + Add a set of edges and nodes, which form a graph. + The graph is assumed to contain one or more polygons, + possibly with holes. + + + + + + + + + + + + For all DirectedEdges in result, form them into MaximalEdgeRings. + + + + + + + + + + + + + + + + This method takes a list of MinimalEdgeRings derived from a MaximalEdgeRing, + and tests whether they form a Polygon. This is the case if there is a single shell + in the list. In this case the shell is returned. + The other possibility is that they are a series of connected holes, in which case + no shell is returned. + + The shell EdgeRing, if there is one
or + null, if all the rings are holes.
+
+ + + This method assigns the holes for a Polygon (formed from a list of + MinimalEdgeRings) to its shell. + Determining the holes for a MinimalEdgeRing polygon serves two purposes: + it is faster than using a point-in-polygon check later on. + it ensures correctness, since if the PIP test was used the point + chosen might lie on the shell, which might return an incorrect result from the + PIP test. + + + + + + + For all rings in the input list, + determine whether the ring is a shell or a hole + and add it to the appropriate list. + Due to the way the DirectedEdges were linked, + a ring is a shell if it is oriented CW, a hole otherwise. + + + + + + + + This method determines finds a containing shell for all holes + which have not yet been assigned to a shell. + These "free" holes should + all be properly contained in their parent shells, so it is safe to use the + findEdgeRingContaining method. + (This is the case because any holes which are NOT + properly contained (i.e. are connected to their + parent shell) would have formed part of a MaximalEdgeRing + and been handled in a previous step). + + + + + + + Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: + ring A contains ring B if envelope(ring A) contains envelope(ring B). + This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell). + + + + Containing EdgeRing, if there is one
or + null if no containing EdgeRing is found.
+
+ + + + + + + + + + Snaps the vertices and segments of a + to another Geometry's vertices. + A snap distance tolerance is used to control where snapping is performed. + Snapping one geometry to another can improve + robustness for overlay operations by eliminating + nearly-coincident edges + (which cause problems during noding and intersection calculation). + It can also be used to eliminate artifacts such as narrow slivers, spikes and gores. + Too much snapping can result in invalid topology + beging created, so the number and location of snapped vertices + is decided using heuristics to determine when it + is safe to snap. + This can result in some potential snaps being omitted, however. + + Martin Davis + + + + Estimates the snap tolerance for a Geometry, taking into account its precision model. + + + The estimated snap tolerance + + + + + + + + + + + + + + + + + + + Snaps two geometries together with a given tolerance. + + + + + + + + + Snaps a geometry to itself. + Allows optionally cleaning the result to ensure it is topologically valid + (which fixes issues such as topology collapses in polygonal inputs). + Snapping a geometry to itself can remove artifacts such as very narrow slivers, gores and spikes. + + the geometry to snap + the snapping tolerance + whether the result should be made valid + a new snapped + + + + Creates a new snapper acting on the given geometry + + the geometry to snap + + + + Snaps the vertices in the component s + of the source geometry to the vertices of the given snap geometry. + + a geometry to snap the source to + + a new snapped Geometry + + + Snaps the vertices in the component s + of the source geometry to the vertices of the same geometry. + Allows optionally cleaning the result to ensure it is topologically valid + (which fixes issues such as topology collapses in polygonal inputs). + The snapping tolerance + Whether the result should be made valid + The geometry snapped to itself + + + + + + + + + + + Computes the snap tolerance based on the input geometries. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Snaps the vertices and segments of a + to a set of target snap vertices. + A snap distance tolerance is used to control where snapping is performed. + The implementation handles empty geometry and empty snap vertex sets. + + + + + Creates a new snapper using the points in the given + as target snap points. + + A LineString to snap (may be empty) + the snap tolerance to use + + + + Creates a new snapper using the given points + as source points to be snapped. + + + + + + + Snaps the vertices and segments of the source LineString + to the given set of snap points. + + the vertices to snap to + list of the snapped points + + + + Snap source vertices to vertices in the target. + + the points to snap + the points to snap to + + + + + + + + + + + + Snap segments of the source to nearby snap vertices. + Source segments are "cracked" at a snap vertex. + A single input segment may be snapped several times + to different snap vertices. + For each distinct snap vertex, at most one source segment + is snapped to. This prevents "cracking" multiple segments + at the same point, which would likely cause + topology collapse when being used on polygonal linework. + + The coordinates of the source linestring to snap + The target snap vertices + + + + Finds a src segment which snaps to (is close to) the given snap point + Only a single segment is selected for snapping. + This prevents multiple segments snapping to the same snap vertex, + which would almost certainly cause invalid geometry + to be created. + (The heuristic approach of snapping used here + is really only appropriate when + snap pts snap to a unique spot on the src geometry) + Also, if the snap vertex occurs as a vertex in the src coordinate list, + no snapping is performed. + + The point to snap to + The source segment coordinates + The index of the snapped segment
+ or -1 if no segment snaps to the snap point.
+
+ + + Performs an overlay operation using snapping and enhanced precision + to improve the robustness of the result. + This class only uses snapping + if an error is detected when running the standard JTS overlay code. + Errors detected include thrown exceptions + (in particular, ) + and invalid overlay computations. + + + + + Performs an overlay operation using snapping and enhanced precision + to improve the robustness of the result. + This class always uses snapping. + This is less performant than the standard JTS overlay code, + and may even introduce errors which were not present in the original data. + For this reason, this class should only be used + if the standard overlay code fails to produce a correct result. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Finds the most likely of a point relative to + the polygonal components of a geometry, using a tolerance value. + + + If a point is not clearly in the Interior or Exterior, + it is considered to be on the Boundary. + In other words, if the point is within the tolerance of the Boundary, + it is considered to be on the Boundary; otherwise, + whether it is Interior or Exterior is determined directly. + + Martin Davis + + + + Extracts linework for polygonal components. + + The geometry from which to extract + A lineal geometry containing the extracted linework + + + + Extracts the LineStrings in the boundaries of all the polygonal elements in the target . + + Martin Davis + + + + Filters out all linework for polygonal elements + + + + + Gets the list of polygonal linework. + + + + + Generates points offset by a given distance from both sides of the midpoint of all segments in a . + + + + Can be used to generate probe points for determining whether a polygonal overlay result is incorrect. + + + The input geometry may have any orientation for its rings, + but is + only meaningful if the orientation is known. + + + Martin Davis + + + + Set the sides on which to generate offset points. + + + + + + + Gets the computed offset points. + + + + + Generates the two points which are offset from the + midpoint of the segment (p0, p1) by the offsetDistance + + The first point of the segment to offset from. + The second point of the segment to offset from + + + + + + Validates that the result of an overlay operation is geometrically correct within a determined tolerance. + Uses fuzzy point location to find points which are + definitely in either the interior or exterior of the result + geometry, and compares these results with the expected ones. + + + This algorithm is only useful where the inputs are polygonal. + This is a heuristic test, and may return false positive results + (I.e. it may fail to detect an invalid result.) + It should never return a false negative result, however + (I.e. it should never report a valid result as invalid.) + + Martin Davis + + + + + Represents a ring of s which form + a ring of a polygon. The ring may be either an outer shell or a hole. + + + + + Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: + ring A contains ring B if envelope(ring A) contains envelope(ring B). + This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell). + + To improve performance of this function the caller should + make the passed shellList as small as possible(e.g. + by using a spatial index filter beforehand). + + + + Containing EdgeRing, if there is one
+ or null if no containing EdgeRing is found.
+
+ + + Traverses a ring of DirectedEdges, accumulating them into a list. + This assumes that all dangling directed edges have been removed + from the graph, so that there is always a next dirEdge. + + The DirectedEdge to start traversing at + A list of DirectedEdges that form a ring + + + + + + + + + + Adds a DirectedEdge which is known to form part of this ring. + + The DirectedEdge to add. + + + + Tests whether this ring is a hole. + Due to the way the edges in the polygonization graph are linked, + a ring is a hole if it is oriented counter-clockwise. + + true if this ring is a hole. + + + + Computes whether this ring is a hole. + Due to the way the edges in the polygonization graph are linked, + a ring is a hole if it is oriented counter-clockwise. + + + + + Adds a hole to the polygon formed by this ring. + + The LinearRing forming the hole. + + + + Adds a hole to the polygon formed by this ring. + + the forming the hole. + + + + Computes and returns the Polygon formed by this ring and any contained holes. + + + + + Tests if the ring formed by this edge ring is topologically valid. + + true if the ring is valid. + + + + Computes and returns the list of coordinates which are contained in this ring. + The coordinates are computed once only and cached. + + + + + Gets the coordinates for this ring as a LineString. + Used to return the coordinates in this ring + as a valid point, when it has been detected that the ring is topologically + invalid. + + + + + Returns this ring as a LinearRing, or null if an Exception occurs while + creating it (such as a topology problem). Details of problems are written to + standard output. + + + + + + + + + + + + + Gets or sets a value indicating the containing shell ring of a ring that has been determined to be a hole. + + + + + Gets a value indicating whether this ring has a shell assigned to it. + + + + + Tests whether this ring is an outer hole. + A hole is an outer hole if it is not contained by a shell. + + + + + Tests whether this ring is an outer shell. + + + + + Gets the outer hole of a shell, if it has one. + An outer hole is one that is not contained + in any other shell. + Each disjoint connected group of shells + is surrounded by an outer hole. + + The outer hole edge ring, or null + + + + Updates the included status for currently non-included shells + based on whether they are adjacent to an included shell. + + + + + Gets a string representation of this object. + + + + + Gets or sets a value indicating whether this ring has been processed. + + + + + Compares EdgeRings based on their envelope, + using the standard lexicographic ordering. + This ordering is sufficient to make edge ring sorting deterministic. + + mbdavis + + + + Assigns hole rings to shell rings + during polygonization. + Uses spatial indexing to improve performance + of shell lookup. + + mdavis + + + + Assigns hole rings to shell rings. + + An enumeration of hole rings to assign + An enumeration of shell rings + + + + Creates a new hole assigner. + + An enumeration of shell rings to assign holes to + + + + Assigns holes to the shells. + + An enumeration of holes to assign to shells + + + + Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: + + ring A contains ring B if envelope(ring A) contains envelope(ring B) + + This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell) + + An edge ring to test + + The containing shell EdgeRing, if there is one + or null if no containing EdgeRing is found + + + + + A DirectedEdge of a PolygonizeGraph, which represents + an edge of a polygon formed by the graph. + May be logically deleted from the graph by setting the marked flag. + + + + + Constructs a directed edge connecting the from node to the + to node. + + + + + Specifies this DirectedEdge's direction (given by an imaginary + line from the from node to directionPt). + + + Whether this DirectedEdge's direction is the same as or + opposite to that of the parent Edge (if any). + + + + + Returns the identifier attached to this directed edge. + Attaches an identifier to this directed edge. + + + + + Returns the next directed edge in the EdgeRing that this directed edge is a member of. + Sets the next directed edge in the EdgeRing that this directed edge is a member of. + + + + + Returns the ring of directed edges that this directed edge is + a member of, or null if the ring has not been set. + + + + + Gets/Sets the ring of directed edges that this directed edge is + a member of. + + + + + An edge of a polygonization graph. + + + + + + + + + + + + + + + + Represents a planar graph of edges that can be used to compute a + polygonization, and implements the algorithms to compute the + s formed by the graph. + The marked flag on DirectedEdges is used to indicate that a directed edge + has be logically deleted from the graph. + + + + + + + + + + + + + + + + + + + + Deletes all edges at a node. + + + + + + Create a new polygonization graph. + + + + + + Add a LineString forming an edge of the polygon graph. + + The line to add. + + + + + + + + + + + + + + + + Convert the maximal edge rings found by the initial graph traversal + into the minimal edge rings required by NTS polygon topology rules. + + The list of start edges for the edgeRings to convert. + + + + Finds all nodes in a maximal edgering which are self-intersection nodes + + + + + The list of intersection nodes found, + or null if no intersection nodes were found. + + + + + Computes the minimal EdgeRings formed by the edges in this graph. + + A list of the{EdgeRings found by the polygonization process. + + + + Finds and labels all edgerings in the graph. + The edge rings are labeling with unique integers. + The labeling allows detecting cut edges. + + A List of the DirectedEdges in the graph. + A List of DirectedEdges, one for each edge ring found. + + + + Finds and removes all cut edges from the graph. + + A list of the LineStrings forming the removed cut edges. + + + + + + + + + + + + + + + + + Computes the next edge pointers going CCW around the given node, for the + given edgering label. + This algorithm has the effect of converting maximal edgerings into minimal edgerings + + + + + + + + + + + + + + Marks all edges from the graph which are "dangles". + Dangles are which are incident on a node with degree 1. + This process is recursive, since removing a dangling edge + may result in another edge becoming a dangle. + In order to handle large recursion depths efficiently, + an explicit recursion stack is used. + + A List containing the s that formed dangles. + + + + Traverses the polygonized edge rings in the graph + and computes the depth parity (odd or even) + relative to the exterior of the graph. + + If the client has requested that the output + be polygonally valid, only odd polygons will be constructed. + + + + + Traverses all connected edges, computing the depth parity of the associated polygons. + + + + + + Polygonizes a set of s which contain linework that + represents the edges of a planar graph. + + + All types of Geometry are accepted as input; + the constituent linework is extracted as the edges to be polygonized. + The processed edges must be correctly noded; that is, they must only meet + at their endpoints. Polygonization will accept incorrectly noded input + but will not form polygons from non-noded edges, + and reports them as errors. + + The Polygonizer reports the follow kinds of errors: + + Danglesedges which have one or both ends which are not incident on another edge endpoint + edges which are connected at both ends but which do not form part of polygon + edges which form rings which are invalid + (e.g. the component lines contain a self-intersection) + + + + The constructor allows + extracting only polygons which form a valid polygonal result. + The set of extracted polygons is guaranteed to be edge-disjoint. + This is useful for situations where it is known that the input lines form a + valid polygonal geometry (which may include holes or nested polygons). + + + + + + The default polygonizer output behavior + + + + + Adds every linear element in a into the polygonizer graph. + + + + + Filters all geometry instances + + The geometry instance + + + + Default linestring adder. + + + + + Allows disabling the valid ring checking, + to optimize situations where invalid rings are not expected. + + The default is true + + + + Creates a polygonizer that extracts all polygons. + + + + + Creates a polygonizer, specifying whether a valid polygonal geometry must be created. + If the argument is true + then areas may be discarded in order to + ensure that the extracted geometry is a valid polygonal geometry. + + true if a valid polygonal geometry should be extracted + + + + Adds a collection of s to be polygonized. + May be called multiple times. + Any dimension of Geometry may be added; + the constituent linework will be extracted and used. + + A list of Geometrys with linework to be polygonized. + + + + Adds a to the linework to be polygonized. + May be called multiple times. + Any dimension of Geometry may be added; + the constituent linework will be extracted and used + + A Geometry with linework to be polygonized. + + + + Adds a to the graph of polygon edges. + + The to add. + + + + Gets the list of polygons formed by the polygonization. + + + + + Gets a geometry representing the polygons formed by the polygonization. + If a valid polygonal geometry was extracted the result is a geometry. + + A geometry containing the polygons + + + + Gets the list of dangling lines found during polygonization. + + + + + Gets the list of cut edges found during polygonization. + + + + + Gets the list of lines forming invalid rings found during polygonization. + + + + + Performs the polygonization, if it has not already been carried out. + + + + + For each outer hole finds and includes a single outer shell. + This seeds the traversal algorithm for finding only polygonal shells. + + The list of shell EdgeRings + + + + Optimized implementation of spatial predicate "contains" + for cases where the first Geometry is a rectangle. + As a further optimization, + this class can be used directly to test many geometries against a single rectangle. + + + + + + + + + + + + + Create a new contains computer for two geometries. + + A rectangular geometry. + + + + + + + + + + + + + + + + + + + + + + + + + Tests if a point is contained in the boundary of the target rectangle. + + the point to test + true if the point is contained in the boundary + + + + Tests if a linestring is completely contained in the boundary of the target rectangle. + + the linestring to test + true if the linestring is contained in the boundary + + + + Tests if a line segment is contained in the boundary of the target rectangle. + + an endpoint of the segment + an endpoint of the segment + true if the line segment is contained in the boundary + + + I + Implementation of the Intersects spatial predicate + optimized for the case where one is a rectangle. + + + This class works for all input geometries, including s. + + As a further optimization, this class can be used in batch style + to test many geometries against a single rectangle. + + + + + Crossover size at which brute-force intersection scanning + is slower than indexed intersection detection. + Must be determined empirically. Should err on the + safe side by making value smaller rather than larger. + + + + + Tests whether a rectangle intersects a given geometry. + + A rectangular polygon + A geometry of any kind + true if the geometries intersect. + + + + Create a new intersects computer for a rectangle. + + A rectangular polygon. + + + + Tests whether the given Geometry intersects the query rectangle. + + The Geometry to test (may be of any type) + true if an intersection must occur + or false if no conclusion about intersection can be made + + + + Tests whether it can be concluded that a rectangle intersects a geometry, + based on the relationship of the envelope(s) of the geometry. + + Martin Davis + + + + Creates an instance of this class using the provided Envelope + + The query envelope + + + + Reports whether it can be concluded that an intersection occurs, + or whether further testing is required. + + true if an intersection must occur
+ or false if no conclusion about intersection can be made
+
+ + + + + + + + + + + + + + + A visitor which tests whether it can be + concluded that a geometry contains a vertex of + a query geometry. + + Martin Davis + + + + + + + + + + Gets a value indicating whether it can be concluded that a corner point of the rectangle is + contained in the geometry, or whether further testing is required. + + true if a corner point is contained + or false if no conclusion about intersection can be made + + + + + + + + + + + + + + + + + A visitor to test for intersection between the query rectangle and the line segments of the geometry. + + Martin Davis + + + + Creates a visitor for checking rectangle intersection with segments + + the query rectangle + + + Reports whether any segment intersection exists. + true if a segment intersection exists or + false if no segment intersection exists + + + + Tests if any line segments in two sets of intersect. + Optimized for use when at least one input is of small size. + Short-circuited to return as soon an intersection is found. + + + + + + + + + + + + + + + + + + + + + An EdgeEndBuilder creates EdgeEnds for all the "split edges" + created by the intersections determined for an Edge. + Computes the EdgeEnds which arise from a noded Edge. + + + + + + + + + + + + Creates stub edges for all the intersections in this + Edge (if any) and inserts them into the graph. + + + + + + + Create a EdgeStub for the edge before the intersection eiCurr. + The previous intersection is provided + in case it is the endpoint for the stub edge. + Otherwise, the previous point from the parent edge will be the endpoint. + eiCurr will always be an EdgeIntersection, but eiPrev may be null. + + + + + + + + + Create a StubEdge for the edge after the intersection eiCurr. + The next intersection is provided + in case it is the endpoint for the stub edge. + Otherwise, the next point from the parent edge will be the endpoint. + eiCurr will always be an EdgeIntersection, but eiNext may be null. + + + + + + + + + A collection of EdgeStubs which obey the following invariant: + They originate at the same node and have the same direction. + Contains all EdgeEnds which start at the same point and are parallel. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This computes the overall edge label for the set of + edges in this EdgeStubBundle. It essentially merges + the ON and side labels for each edge. + These labels must be compatible + + + + + + Compute the overall ON location for the list of EdgeStubs. + (This is essentially equivalent to computing the self-overlay of a single Geometry) + edgeStubs can be either on the boundary (e.g. Polygon edge) + OR in the interior (e.g. segment of a LineString) + of their parent Geometry. + In addition, GeometryCollections use the to determine + whether a segment is on the boundary or not. + Finally, in GeometryCollections it can occur that an edge is both + on the boundary and in the interior (e.g. a LineString segment lying on + top of a Polygon edge.) In this case the Boundary is given precedence. + These observations result in the following rules for computing the ON location: + if there are an odd number of Bdy edges, the attribute is Bdy + if there are an even number >= 2 of Bdy edges, the attribute is Int + if there are any Int edges, the attribute is Int + otherwise, the attribute is Null. + + + + + + + Compute the labelling for each side + + + + + + To compute the summary label for a side, the algorithm is: + FOR all edges + IF any edge's location is Interior for the side, side location = Interior + ELSE IF there is at least one Exterior attribute, side location = Exterior + ELSE side location = Null + Note that it is possible for two sides to have apparently contradictory information + i.e. one edge side may indicate that it is in the interior of a point, while + another edge side may indicate the exterior of the same point. This is + not an incompatibility - GeometryCollections may contain two Polygons that touch + along an edge. This is the reason for Interior-primacy rule above - it + results in the summary label having the Geometry interior on both sides. + + + + + + + Update the IM with the contribution for the computed label for the EdgeStubs. + + + + + + + + + + + + An ordered list of EdgeEndBundles around a RelateNode. + They are maintained in CCW order (starting with the positive x-axis) around the node + for efficient lookup and topology building. + + + + + Insert a EdgeEnd in order in the list. + If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is + added to the bundle. Otherwise, a new EdgeEndBundle is created + to contain the EdgeEnd. + + + + + + Update the IM with the contribution for the EdgeStubs around the node. + + + + + + Computes the topological relationship between two Geometries. + RelateComputer does not need to build a complete graph structure to compute + the IntersectionMatrix. The relationship between the geometries can + be computed by simply examining the labelling of edges incident on each node. + RelateComputer does not currently support arbitrary GeometryCollections. + This is because GeometryCollections can contain overlapping Polygons. + In order to correct compute relate on overlapping Polygons, they + would first need to be noded and merged (if not explicitly, at least + implicitly). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copy all nodes from an arg point into this graph. + The node label in the arg point overrides any previously computed + label for that argIndex. + (E.g. a node may be an intersection node with + a computed label of Boundary, + but in the original arg Geometry it is actually + in the interior due to the Boundary Determination Rule) + + + + + + Insert nodes for all intersections on the edges of a Geometry. + Label the created nodes the same as the edge label if they do not already have a label. + This allows nodes created by either self-intersections or + mutual intersections to be labelled. + Endpoint nodes will already be labelled from when they were inserted. + + + + + + For all intersections on the edges of a Geometry, + label the corresponding node IF it doesn't already have a label. + This allows nodes created by either self-intersections or + mutual intersections to be labelled. + Endpoint nodes will already be labelled from when they were inserted. + + + + + + If the Geometries are disjoint, we need to enter their dimension and + boundary dimension in the Ext rows in the IM + + An intersection matrix + The Boundary Node Rule to use + + + + Compute the IM entry for the intersection of the boundary + of a geometry with the Exterior. + This is the nominal dimension of the boundary + unless the boundary is empty, in which case it is . + For linear geometries the Boundary Node Rule determines + whether the boundary is empty. + + The geometry providing the boundary + The Boundary Node Rule to use + The IM dimension entry + + + + + + + + + Update the IM with the sum of the IMs for each component. + + + + + + Processes isolated edges by computing their labelling and adding them + to the isolated edges list. + Isolated edges are guaranteed not to touch the boundary of the target (since if they + did, they would have caused an intersection to be computed and hence would + not be isolated). + + + + + + + Label an isolated edge of a graph with its relationship to the target point. + If the target has dim 2 or 1, the edge can either be in the interior or the exterior. + If the target has dim 0, the edge must be in the exterior. + + + + + + + + Isolated nodes are nodes whose labels are incomplete + (e.g. the location for one Geometry is null). + This is the case because nodes in one graph which don't intersect + nodes in the other are not completely labelled by the initial process + of adding nodes to the nodeList. + To complete the labelling we need to check for nodes that lie in the + interior of edges, and in the interior of areas. + + + + + Label an isolated node with its relationship to the target point. + + + + + + + A RelateNode is a Node that maintains a list of EdgeStubs + for the edges that are incident on it. + + + + + + + + + + + + Update the IM with the contribution for this component. + A component only contributes if it has a labelling for both parent geometries. + + + + + Update the IM with the contribution for the EdgeEnds incident on this node. + + + + + + Used by the NodeMap in a RelateNodeGraph to create RelateNodes. + + + + + + + + + + + + Implements the simple graph of Nodes and EdgeEnd which is all that is + required to determine topological relationships between Geometries. + Also supports building a topological graph of a single Geometry, to + allow verification of valid topology. + It is not necessary to create a fully linked + PlanarGraph to determine relationships, since it is sufficient + to know how the Geometries interact locally around the nodes. + In fact, this is not even feasible, since it is not possible to compute + exact intersection points, and hence the topology around those nodes + cannot be computed robustly. + The only Nodes that are created are for improper intersections; + that is, nodes which occur at existing vertices of the Geometries. + Proper intersections (e.g. ones which occur between the interior of line segments) + have their topology determined implicitly, without creating a Node object + to represent them. + + + + + + + + + + + + + + + + + Insert nodes for all intersections on the edges of a Geometry. + Label the created nodes the same as the edge label if they do not already have a label. + This allows nodes created by either self-intersections or + mutual intersections to be labelled. + Endpoint nodes will already be labelled from when they were inserted. + Precondition: edge intersections have been computed. + + + + + + + Copy all nodes from an arg point into this graph. + The node label in the arg point overrides any previously computed + label for that argIndex. + (E.g. a node may be an intersection node with + a computed label of Boundary, + but in the original arg Geometry it is actually + in the interior due to the Boundary Determination Rule). + + + + + + + + + + + + + Implements the SFS relate() generalized spatial predicate on two s. +
+ The class supports specifying a custom + to be used during the relate computation. +
+ + If named spatial predicates are used on the result + of the RelateOp, the result may or not be affected by the + choice of BoundaryNodeRule, depending on the exact nature of the pattern. + For instance, is insensitive + to the choice of BoundaryNodeRule, + whereas is affected by the rule chosen. + + Note: custom Boundary Node Rules do not (currently) + affect the results of other methods (such + as . The results of + these methods may not be consistent with the relationship computed by + a custom Boundary Node Rule. + +
+ + + Computes the for the spatial relationship + between two s, using the default (OGC SFS) Boundary Node Rule + + A geometry to test + A geometry to test + The IntersectionMatrix for the spatial relationship between the geometries + + + + Computes the for the spatial relationship + between two s, using the specified Boundary Node Rule + + A geometry to test + A geometry to test + The Boundary Node Rule to use + The IntersectionMatrix for the spatial relationship between the geometries + + + + Creates a new Relate operation, using the default (OGC SFS) Boundary Node Rule. + + a Geometry to relate + another Geometry to relate + + + + Creates a new Relate operation, using the default (OGC SFS) Boundary Node Rule. + + a Geometry to relate + another Geometry to relate + The Boundary Node Rule to use + + + + Gets the IntersectionMatrix for the spatial relationship + between the input geometries. + + + + + Provides an efficient method of unioning a collection of + geometries. + The geometries are indexed using a spatial index, + and unioned recursively in index order. + For geometries with a high degree of overlap, + this has the effect of reducing the number of vertices + early in the process, which increases speed + and robustness. + + This algorithm is faster and more robust than + the simple iterated approach of + repeatedly unioning each polygon to a result geometry. + + The buffer(0) trick is sometimes faster, but can be less robust and + can sometimes take a long time to complete. + This is particularly the case where there is a high degree of overlap + between the polygons. In this case, buffer(0) is forced to compute + with all line segments from the outset, + whereas cascading can eliminate many segments + at each stage of processing. + The best situation for using buffer(0) is the trivial case + where there is no overlap between the input geometries. + However, this case is likely rare in practice. + + Martin Davis + + + + + A union strategy that uses the classic NTS , + and for polygonal geometries a robustness fallback using Buffer(0). + + + + + An alternative way of unioning polygonal geometries + by using Buffer(0). + Only worth using if regular overlay union fails. + + A polygonal geometry + A polygonal geometry + The union of the geometries + + + + Computes the union of + a collection of s. + + A collection of s. + The union of the + + + + Computes the union of + a collection of s. + + A collection of s. + A strategy to perform the unioning. + The union of the + + + + Creates a new instance to union + the given collection of s. + + A collection of s + + + + Creates a new instance to union + the given collection of s. + + A collection of s + + + + + The effectiveness of the index is somewhat sensitive + to the node capacity. + Testing indicates that a smaller capacity is better. + For an STRtree, 4 is probably a good number (since + this produces 2x2 "squares"). + + + + + Computes the union of the input geometries. + + + + This method discards the input geometries as they are processed. + In many input cases this reduces the memory retained + as the operation proceeds. + Optimal memory usage is achieved + by disposing of the original input collection + before calling this method. + + The union of the input geometries, + or null if no input geometries were provided + + if this method is called more than once + + + + Unions a list of geometries + by treating the list as a flattened binary tree, + and performing a cascaded union on the tree. + + The list of geometries to union + The union of the list + + + + Unions a section of a list using a recursive binary union on each half + of the section. + + The list of geometries containing the section to union + The start index of the section + The index after the end of the section + The union of the list section + + + + Gets the element at a given list index, or + null if the index is out of range. + + The list of geometries + The index + The geometry at the given index or + null if the index is out of range + + + + Reduces a tree of geometries to a list of geometries + by recursively unioning the subtrees in the list. + + A tree-structured list of geometries + A list of Geometrys + + + + Computes the union of two geometries, + either or both of which may be null. + + A Geometry + A Geometry + The union of the input(s) or + null if both inputs are null + + + + Encapsulates the actual unioning of two polygonal geometries. + + A geometry to union + A geometry to union + A + The union of the inputs + + + Computes a containing only components. + Extracts the s from the input + and returns them as an appropriate geometry. + + If the input is already Polygonal, it is returned unchanged. + + A particular use case is to filter out non-polygonal components + returned from an overlay operation. + + The geometry to filter + A polygonal geometry + + + + Extracts atomic elements from + input geometries or collections, + recording the dimension found. + Empty geometries are discarded since they + do not contribute to the result of . + + Martin Davis + + + + Extracts elements from an enumeration of geometries. + + An enumeration of geometries + An extracter over the geometries. + + + + Extracts elements from a geometry. + + An geometry to extract from + An extracter over the geometry. + + + The default dimension for an empty GeometryCollection + + + + Gets a value indicating if there were any non-empty geometries extracted + + + + + Gets a value indicating the maximum extracted. + + + + + Gets a value indicating the geometry factory from the extracted geometry, + if there is one. + If an empty collection was extracted, will return null. + + + + + Gets the extracted atomic geometries of the given dimension dim. + + The dimension of geometry to return + A list of the extracted geometries of dimension dim. + + + + Unions MultiPolygons efficiently by + using full topological union only for polygons which may overlap, + and combining with the remaining polygons. + Polygons which may overlap are those which intersect the common extent of the inputs. + Polygons wholly outside this extent must be disjoint to the computed union. + They can thus be simply combined with the union result, + which is much more performant. + (There is one caveat to this, which is discussed below). + + This situation is likely to occur during cascaded polygon union, + since the partitioning of polygons is done heuristically + and thus may group disjoint polygons which can lie far apart. + It may also occur in real world data which contains many disjoint polygons + (e.g. polygons representing parcels on different street blocks). + + +

Algorithm

+ The overlap region is determined as the common envelope of intersection. + The input polygons are partitioned into two sets: + + OverlappingPolygons which intersect the overlap region, and thus potentially overlap each other + DisjointPolygons which are disjoint from (lie wholly outside) the overlap region + + The Overlapping set is fully unioned, and then combined with the Disjoint set. + Performing a simple combine works because + the disjoint polygons do not interact with each + other(since the inputs are valid MultiPolygons). + They also do not interact with the Overlapping polygons, + since they are outside their envelope. +

Discussion

+ In general the Overlapping set of polygons will + extend beyond the overlap envelope. This means that the union result + will extend beyond the overlap region. + There is a small chance that the topological + union of the overlap region will shift the result linework enough + that the result geometry intersects one of the Disjoint geometries. + This situation is detected and if it occurs + is remedied by falling back to performing a full union of the original inputs. + Detection is done by a fairly efficient comparison of edge segments which + extend beyond the overlap region. If any segments have changed + then there is a risk of introduced intersections, and full union is performed. + + This situation has not been observed in JTS using floating precision, + but it could happen due to snapping. It has been observed + in other APIs(e.g.GEOS) due to more aggressive snapping. + It is more likely to happen if a Snap - Rounding overlay is used. + + NOTE: Test has shown that using this heuristic impairs performance. +
+ Martin Davis +
+ + + Union a pair of geometries, + using the more performant overlap union algorithm if possible. + + A geometry to union + A geometry to union + The union of the inputs + + + + Union a pair of geometries, + using the more performant overlap union algorithm if possible. + + A geometry to union + A geometry to union + Function to union two geometries + The union of the inputs + + + + Creates a new instance for unioning the given geometries. + + A geometry to union + A geometry to union + + + + Creates a new instance for unioning the given geometries. + + A geometry to union + A geometry to union + Function to union two geometries + + + + Union a pair of geometries, + using the more performant overlap union algorithm if possible. + + The union of the inputs + + + + Gets a value indicating whether the optimized + or full union was performed. + + Used for unit testing.> + true if the optimized union was performed + + + + Implements union using the buffer-by-zero trick. + This seems to be more robust than overlay union, + for reasons somewhat unknown. + + A geometry + A geometry + The union of the geometries + + + + Computes the union of a geometry with + another arbitrary . + Does not copy any component geometries. + + + + + + + + Unions a Collection of s or a single Geometry (which may be a ) together. + + + + By using this special-purpose operation over a collection of geometries + it is possible to take advantage of various optimizations to improve performance. + + + Heterogeneous s are fully supported. + + + The result obeys the following contract: + + Unioning a set of s has the effect of merging the areas (i.e. the same effect as iteratively unioning all individual polygons together). + Unioning a set of s has the effect of fully noding + and dissolving the input linework. + In this context "fully noded" means that there will be + an endpoint or node in the result + for every endpoint or line segment crossing in the input. + "Dissolved" means that any duplicate (e.g. coincident) line segments or portions + of line segments will be reduced to a single line segment in the output. + This is consistent with the semantics of the + operation. + If merged linework is required, the class can be used. + Unioning a set of s has the effect of merging all identical points (producing a set with no duplicates). + + + UnaryUnion always operates on the individual components of MultiGeometries. + So it is possible to use it to "clean" invalid self-intersecting MultiPolygons + (although the polygon components must all still be individually valid.) + + + + mbdavis + + + + + Computes the geometric union of a + + A collection of geometries + The union of the geometries, + or null if the input is empty + + + + Computes the geometric union of a + If no input geometries were provided but a was provided, + an empty is returned. + + A collection of geometries + The geometry factory to use if the collection is empty + The union of the geometries + or an empty GEOMETRYCOLLECTION + + + Constructs a unary union operation for a + (which may be a ). + + A geometry to union + The union of the elements of the geometry + or an empty GEOMETRYCOLLECTION + + + + Constructs a unary union operation for an enumeration + of s, using the + of the input geometries. + + An enumeration of geometries + + + + Constructs a unary union operation for an enumeration + of s. + If no input geometries were provided but a was provided, + + An enumeration of geometries + The geometry factory to use if the enumeration is empty + + + + Constructs a unary union operation for a + (which may be a ). + + A geometry to union + + + + Named setter named setUnionFun[ction] in JTS + + + + + Gets the union of the input geometries. + + The result of empty input is determined as follows: + + If the input is empty and a dimension can be + determined (i.e. an empty geometry is present), + an empty atomic geometry of that dimension is returned. + If no input geometries were provided but a was provided, + an empty is returned. + Otherwise, the return value is null. + + + + A Geometry containing the union, + or an empty atomic geometry, or an empty GEOMETRYCOLLECTION, + ornull if no GeometryFactory was provided + + + + + Computes the union of two geometries, either of both of which may be null. + + + + + The union of the input(s) + or null if both inputs are null + + + + + Computes a unary union with no extra optimization, and no short-circuiting. + + + Due to the way the overlay operations are implemented, this is still efficient in the case of linear and puntal geometries. + + A geometry + The union of the input geometry + + + + Experimental code to union MultiPolygons with processing limited to the elements which actually interact. + + Not currently used, since it doesn't seem to offer much of a performance advantage. + mbdavis + + + + An strategy class that allows UnaryUnion to adapt to different + kinds of overlay algorithms. + + Martin Davis + + + + Computes the union of two geometries. + This method may throw a + if one is encountered. + + A geometry + A geometry + The union of the input + + + + Indicates whether the union function operates using + a floating(full) precision model. + If this is the case, then the unary union code + can make use of the { @link OverlapUnion} + performance optimization, + and perhaps other optimizations as well. + Otherwise, the union result extent may not be the same as the extent of the inputs, + which prevents using some optimizations. + + + + + This class tests that the interior of an area + ( or ) + is connected. An area Geometry is invalid if the interior is disconnected. + This can happen if: + - a shell self-intersects, + - one or more holes form a connected chain touching a shell at two different points, + - one or more holes form a ring around a subset of the interior. + If a disconnected situation is found the location of the problem is recorded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form s in graph into Minimal EdgeRings. + (Minimal Edgerings must be used, because only they are guaranteed to provide + a correct isHole computation). + + + + + + + Mark all the edges for the edgeRings corresponding to the shells of the input polygons. + Only ONE ring gets marked for each shell - if there are others which remain unmarked + this indicates a disconnected interior. + + + + + + + + + + + + + + + + + + + + Check if any shell ring has an unvisited edge. + A shell ring is a ring which is not a hole and which has the interior + of the parent area on the RHS. + (Note that there may be non-hole rings with the interior on the LHS, + since the interior of holes will also be polygonized into CW rings + by the LinkAllDirectedEdges() step). + + + true if there is an unvisited edge in a non-hole ring. + + + + Checks that a {GeometryGraph} representing an area + (a Polygon or MultiPolygon ) + is consistent with the SFS semantics for area geometries. + Checks include: + Testing for rings which self-intersect (both properly and at nodes). + Testing for duplicate rings. + If an inconsistency if found the location of the problem is recorded. + + + + + + + + + + + Returns the intersection point, or null if none was found. + + + + + + + + + + Check all nodes to see if their labels are consistent. + If any are not, return false. + + + + + Checks for two duplicate rings in an area. + Duplicate rings are rings that are topologically equal + (that is, which have the same sequence of points up to point order). + If the area is topologically consistent (determined by calling the + isNodeConsistentArea, + duplicate rings can be found by checking for EdgeBundles which contain more than one EdgeEnd. + (This is because topologically consistent areas cannot have two rings sharing + the same line segment, unless the rings are equal). + The start point of one of the equal rings will be placed in invalidPoint. + Returns true if this area Geometry is topologically consistent but has two duplicate rings. + + + + + Tests whether any holes of a Polygon are + nested inside another hole, using a spatial + index to speed up the comparisons. + + The logic assumes that the holes do not overlap and have no collinear segments + (so they are properly nested, and there are no duplicate holes). + + The situation where every vertex of a hole touches another hole + is invalid because either the hole is nested, + or else it disconnects the polygon interior. + This class detects the nested situation. + The disconnected interior situation must be checked elsewhere. + + + + + Gets a value indicating a point on a nested hole, if one exists. + + A point on a nested hole, or null if none are nested + + + + Tests if any hole is nested (contained) within another hole. + This is invalid. + The will be set to reflect this. + + true if some hole is nested. + + + + Tests whether a MultiPolygon has any element polygon + nested inside another polygon, using a spatial + index to speed up the comparisons. + + The logic assumes that the polygons do not overlap and have no collinear segments + (so they are properly nested, and there are no duplicate rings). + + + + + Gets a point on a nested polygon, if one exists. + + A point on a nested polygon, or null if none are nested + + + + Tests if any polygon is nested (contained) within another polygon. + This is invalid. + The nested point will be set to reflect this. + + true if some polygon is nested + + + + Finds a point of a shell segment which lies inside a polygon, if any. + The shell is assume to touch the polyon only at shell vertices, + and does not cross the polygon. + + The shell to test + The polygon to test against + An interior segment point, or null if the shell is nested correctly + + + + Tests whether any of a set of s are + nested inside another ring in the set, using a spatial + index to speed up the comparisons. + + + + + Tests whether a Geometry is simple as defined by the OGC SFS specification. + + Simplicity is defined for each + type as follows: + + Pointgeometries are simple. + MultiPointgeometries are simple if every point is unique + LineStringgeometries are simple if they do not self-intersect at interior points + (i.e.points other than the endpoints). + MultiLineStringgeometries are simple if + their elements are simple and they intersect only at points + which are boundary points of both elements. + (The notion of boundary points can be user-specified - see below). + Polygonalgeometries have no definition of simplicity. + The IsSimple code checks if all polygon rings are simple. + (Note: this means thatIsSimple cannot be used to test + for all self-intersections in Polygon s. + In order to check if a IPolygonal geometry has self-intersections, + use . + GeometryCollectiongeometries are simple if all their elements are simple. + Empty geometries are simple + + For geometries the evaluation of simplicity + can be customized by supplying a + to define how boundary points are determined. + The default is the SFS-standard . + + Note that under the Mod-2 rule, closed LineStrings (rings) + have no boundary. + This means that an intersection at their endpoints makes the geometry non-simple. + If it is required to test whether a set of LineStrings touch + only at their endpoints, use . + For example, this can be used to validate that a collection of lines + form a topologically valid linear network. + + By default this class finds a single non-simple location. + To find all non-simple locations, set + before calling , and retrieve the locations + via . + This can be used to find all intersection points in a linear network. + + + + + + + Tests whether a geometry is simple. + + The input geometry + true if the geometry is simple + + + + Gets a non-simple location in a geometry, if any. + + The input geometry + A non-simple location, or null if the geometry is simple + + + + Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule + + The geometry to test + + + + Creates a simplicity checker using a given + + The geometry to test + The boundary node rule to use + + + Gets or sets a value indicating if all non-simple points should be reported. + + + + Tests whether the geometry is simple. + + true if the geometry is simple. + + + + Gets the coordinate for an location where the geometry + fails to be simple (i.e. where it has a non-boundary + self-intersection). + + A Coordinate for the location of the non-boundary self-intersection + or null if the geometry is simple + + + + Gets all non-simple intersection locations. + + A list of the Coordinates of non-simple locations. + + + + Computes simplicity for polygonal geometries. + Polygonal geometries are simple if and only if + all of their component rings are simple. + + A geometry + true if the geometry is simple + + + + Semantics for GeometryCollection is + simple if all components are simple. + + A geometry collection + true if the geometry is simple + + + + Creates an instance of this class + + A flag indicating if closed endpoints belong to the interior + A flag indicating that all non-simple intersection points should be found + A list to add the non-simple intersection points to. + + + + Tests whether an intersection was found. + + true if an intersection was found. + + + + + + + Tests whether an intersection vertex is an endpoint of a segment string. + + The segment string + The index of the segment in + The line intersector + The index of the segment in intersector + true if the intersection vertex is an endpoint + + + + Finds the vertex index in a segment of an intersection + which is known to be a vertex. + + The line intersector + The intersection segment index + + The vertex index (0 or 1) in the segment vertex of the intersection point + + + + + + + + Implements the algorithms required to compute the + method for s. + See the documentation for the various geometry types for a specification of validity. + + + + + Tests whether a is valid. + + The geometry to test + true if the geometry is valid + In JTS this function is called IsValid + + + + Checks whether a coordinate is valid for processing. + Coordinates are valid if their x and y ordinates are in the + range of the floating point representation. + + The coordinate to validate + true if the coordinate is valid + + + + The geometry being validated + + + + + If the following condition is TRUE JTS will validate inverted shells and exverted holes + (the ESRI SDE model) + + + + + Creates a new validator for a geometry + + The geometry to validate + + + + Gets or sets a value indicating whether polygons using Self-Touching Rings to form + holes are reported as valid. + If this flag is set, the following Self-Touching conditions + are treated as being valid: + + the shell ring self-touches to create a hole touching the shell + a hole ring self-touches to create two holes touching at a point + + + The default (following the OGC SFS standard) + is that this condition is not valid (false). + + Self-Touching Rings which disconnect the + the polygon interior are still considered to be invalid + (these are invalid under the SFS, and many other + spatial models as well). + This includes: + + exverted ("bow-tie") shells which self-touch at a single point + inverted shells with the inversion touching the shell at another point + exverted holes with exversion touching the hole at another point + inverted ("C-shaped") holes which self-touch at a single point causing an island to be formed + inverted shells or exverted holes which form part of a chain of touching rings + (which disconnect the interior) + + + + + + + Gets/Sets whether polygons using Self-Touching Rings to form + holes are reported as valid. + If this flag is set, the following Self-Touching conditions + are treated as being valid:
+ - The shell ring self-touches to create a hole touching the shell.
+ - A hole ring self-touches to create two holes touching at a point.
+
+ + The default (following the OGC SFS standard) + is that this condition is not valid (false). + + + This does not affect whether Self-Touching Rings + disconnecting the polygon interior are considered valid + (these are considered to be invalid under the SFS, and many other + spatial models as well). + This includes "bow-tie" shells, + which self-touch at a single point causing the interior to be disconnected, + and "C-shaped" holes which self-touch at a single point causing an island to be formed. + +
+ States whether geometry with this condition is valid. +
+ + + Tests the validity of the input geometry. + + true if the geometry is valid. + + + + Gets a value indicating the validity of the geometry + If not valid, returns the validation error for the geometry, + or null if the geometry is valid. + + The validation error, if the geometry is invalid + or null if the geometry is valid + + + + Tests validity of a Point. + + The Point to test + true if the Point is valid + In JTS this function is called IsValid + + + + Tests validity of a MultiPoint. + + The MultiPoint to test + true if the MultiPoint is valid + In JTS this function is called IsValid + + + + Tests validity of a LineString.
+ Almost anything goes for LineStrings! +
+ The LineString to test + In JTS this function is called IsValid +
+ + + Tests validity of a LinearRing.
+
+ The LinearRing to test + In JTS this function is called IsValid +
+ + + Tests validity of a Polygon.
+
+ The Polygon to test + In JTS this function is called IsValid +
+ + + Tests validity of a MultiPolygon.
+
+ The MultiPolygon to test + In JTS this function is called IsValid +
+ + + Tests validity of a GeometryCollection.
+
+ The GeometryCollection to test + In JTS this function is called IsValid +
+ + + Check the number of non-repeated points is at least a given size. + + The line to test + The minimum number of points in + true if the line has the required number of points + + + + Test if the number of non-repeated points in a line + is at least a given minimum size. + + The line to test + The minimum number of points in + true if the line has the required number of non-repeated points + + + + Check whether a ring self-intersects (except at its endpoints). + + The linear ring to check + + + + Tests that each hole is inside the polygon shell. + This routine assumes that the holes have previously been tested + to ensure that all vertices lie on the shell or on the same side of it + (i.e. that the hole rings do not cross the shell ring). + Given this, a simple point-in-polygon test of a single point in the hole can be used, + provided the point is chosen such that it does not lie on the shell. + + The polygon to be tested for hole inclusion + + + + Checks if a polygon hole lies inside its shell + and if not returns a point indicating this. + The hole is known to be wholly inside or outside the shell, + so it suffices to find a single point which is interior or exterior, + or check the edge topology at a point on the boundary of the shell. + + The hole to test + The polygon shell to test against + A hole point outside the shell, or null if it is inside. + + + + Checks if any polygon hole is nested inside another. + Assumes that holes do not cross (overlap), + This is checked earlier. + + The polygon with holes to test + + + + Checks that no element polygon is in the interior of another element polygon. + Preconditions: + + shells do not partially overlap + shells do not touch along an edge + no duplicate rings exist + These have been confirmed by the . + + + + + Find a point from the list of testCoords + that is NOT a node in the edge for the list of searchCoords. + + + + + The point found, or null if none found. + + + Finds and analyzes intersections in and between polygons, + to determine if they are valid. + + The s which are analyzed can have s + attached. If so they will be updated with intersection information + to support further validity analysis which must be done after + basic intersection validity has been confirmed. + + Martin Davis + + + + Creates a new finder, allowing for the mode where inverted rings are valid. + + true if inverted rings are valid. + + + + For a segment string for a ring, gets the coordinate + previous to the given index (wrapping if the index is 0) + + The ring segment string + The segment index + The coordinate previous to the given segment + + + + Tests if two segments in a closed are adjacent. + This handles determining adjacency across the start/end of the ring. + + The segment string + A segment index + A segment index + true if the segments are adjacent + + + + Functions to compute topological information + about nodes (ring intersections) in polygonal geometry. + + Martin Davis + + + + Check if the edges at a node between two rings (or one ring) cross. + The node is topologically valid if the ring edges do not cross. + This function assumes that the edges are not collinear. + + The node location + The previous edge endpoint in a ring + The next edge endpoint in a ring + The previous edge endpoint in the other ring + The next edge endpoint in the other ring + + true if the edges cross at the node + + + + + Tests whether an edge node-b lies in the interior or exterior + of a corner of a ring given by a0-node-a1. + The ring interior is assumed to be on the right of the corner (a CW ring). + The edge must not be collinear with the corner segments. + + The node location + The first vertex of the corner + The second vertex of the corner + The destination vertex of the edge + true if the edge is interior to the ring corner + + + + Tests if an edge p is between edges e0 and e1, + where the edges all originate at a common origin. + The "inside" of e0 and e1 is the arc which does not include the origin. + The edges are assumed to be distinct (non-collinear). + + the origin + the destination point of edge p + the destination point of edge e0 + the destination point of edge e1 + true if p is between e0 and e1 + + + + Tests if the angle with the origin of a vector P is greater than that of the + vector Q. + + The origin of the vectors + The endpoint of the vector P + The endpoint of the vector Q + true if vector P has angle greater than Q + + + + A ring of a polygon being analyzed for topological validity. + The shell and hole rings of valid polygons touch only at discrete points. + The "touch" relationship induces a graph over the set of rings. + The interior of a valid polygon must be connected. + This is the case if there is no "chain" of touching rings + (which would partition off part of the interior). + This is equivalent to the touch graph having no cycles. + Thus the touch graph of a valid polygon is a forest - a set of disjoint trees. + + Also, in a valid polygon two rings can touch only at a single location, + since otherwise they disconnect a portion of the interior between them. + This is checked as the touches relation is built + (so the touch relation representation for a polygon ring does not need to support + more than one touch location for each adjacent ring). + + The cycle detection algorithm works for polygon rings which also contain self-touches + (inverted shells and exverted holes). + + Polygons with no holes do not need to be checked for + a connected interior, unless self-touches are allowed. + + The class also records the topology at self-touch nodes, + to support checking if an invalid self-touch disconnects the polygon. + + Martin Davis + + + + Tests if a polygon ring represents a shell. + + The ring to test (may be null) + true if the ring represents a shell + + + + Records a touch location between two rings, + and checks if the rings already touch in a different location. + + A polygon ring + A polygon ring + The location where they touch + true if the polygons already touch + + + + Finds a location (if any) where a chain of holes forms a cycle + in the ring touch graph. + The shell may form part of the chain as well. + This indicates that a set of holes disconnects the interior of a polygon. + + The list of rings to check + A vertex contained in a ring cycle or null if none is found. + + + + Finds a location of an interior self-touch in a list of rings, + if one exists. + This indicates that a self-touch disconnects the interior of a polygon, + which is invalid. + + The list of rings to check + The location of an interior self-touch node, or null if there are none + + + + The root of the touch graph tree containing this ring. + Serves as the id for the graph partition induced by the touch relation. + + + + + The set of links + for this ring. + The set of all touches in the rings of a polygon + forms the polygon touch graph. + This supports detecting touch cycles, which + reveal the condition of a disconnected interior. + + Only a single touch is recorded between any two rings, + since more than one touch between two rings + indicates interior disconnection as well. + + + + + The set of self-nodes in this ring. + This supports checking valid ring self-touch topology. + + + + + Creates a ring for a polygon shell. + + The polygon shell + + + + Creates a ring for a polygon hole. + + The ring geometry + The index of the hole + The parent polygon shell + + + + Adds a point where a touches another one. + + The other + The touch location + + + + Adds the node (intersection point) + and the endpoints of the four adjacent segments. + + The node + The 1st position of the 1st edge + The 2nd position of the 1st edge + The 1st position of the 2nd edge + The 2nd position of the 2nd edge + + + + Tests if this ring touches a given ring at + the single point specified. + + The other polygon ring + The touch point + true if the rings touch only at the given point. + + + + Detects whether the subgraph of holes linked by touch to this ring + contains a hole cycle. + If no cycles are detected, the set of touching rings is a tree. + The set is marked using this ring as the root. + + A vertex om a hole cycle or null if no cycle found + + + + Scans for a hole cycle starting at a given touch. + + The touch to investigate + The root of the touch subgraph + The queue of rings to scan + + + + Finds the location of an invalid interior self-touch in this ring, + if one exists. + + The location of an interior self-touch node, or null if there are none + + + + + + + + Records a point where a touches another one. + This forms an edge in the induced ring touch graph. + + Martin Davis + + + + Creates an instance of this item + + The polygon ring + The touch position + + + + Represents a ring self-touch node, recording the node (intersection point) + and the endpoints of the four adjacent segments. + + This is used to evaluate validity of self-touching nodes, + when they are allowed. + + Martin Davis + + + + Creates an instance of this point + + The self touch position + The 1st position of the 1st edge + The 2nd position of the 1st edge + The 1st position of the 2nd edge + The 2nd position of the 2nd edge + + + + Gets a value indicating the node point + + + + + Tests if a self-touch has the segments of each half of the touch + lying in the exterior of a polygon. + This is a valid self-touch. + It applies to both shells and holes. + Only one of the four possible cases needs to be tested, + since the situation has full symmetry. + + A flag indicating if the interior is to the right of the parent ring + true if the self-touch is on the exterior. + + + + Analyzes the topology of polygonal geometry + to determine whether it is valid. + + Martin Davis + + + + Finds a self-intersection (if any) in a . + + The ring to analyze + A self-intersection point if one exists, or null + + + + Tests whether a segment p0-p1 is inside or outside a ring. + + Preconditions: + + The segment intersects the ring only at the endpoints + One, none or both of the segment endpoints may lie on the ring + The ring does not self-cross, but it may self-touch + + + A segment vertex + A segment vertex + The ring to test + true if the segment lies inside the ring + + + + Tests whether a touching segment is interior to a ring. + + Preconditions: + + The segment does not intersect the ring other than at the endpoints + The segment vertex p0 lies on the ring + The ring does not self-cross, but it may self-touch + + This works for both shells and holes, but the caller must know + the ring role. + + The first vertex of the segment + The second vertex of the segment + The points of the ring + true if the segment is inside the ring. + + + + Computes the index of the segment which intersects a given point. + + The ring points + The intersection point + The intersection segment index, or -1 if not intersection is found. + + + + Tests whether the interior of the polygonal geometry is + disconnected.
+ If true, the disconnection location is available from + . +
+ true if the interior is disconnected +
+ + + Gets a location where the polyonal interior is disconnected.
+ must be called first. +
+ The location of an interior disconnection, or null +
+ + + Tests whether any polygon with holes has a disconnected interior + by virtue of the holes (and possibly shell) forming a touch cycle. + + This is a global check, which relies on determining + the touching graph of all holes in a polygon. + + If inverted rings disconnect the interior + via a self-touch, this is checked by the . + If inverted rings are part of a disconnected ring chain + this is detected here. + + true if a polygon has a disconnected interior. + + + + Tests if an area interior is disconnected by a self-touching ring. + This must be evaluated after other self-intersections have been analyzed + and determined to not exist, since the logic relies on + the rings not self-crossing (winding). + + true if an area interior is disconnected by a self-touch + + + + Implements the appropriate checks for repeated points + (consecutive identical coordinates) as defined in the + NTS spec. + + + + + Gets a value indicating the location of the repeated point + + + + + Checks if a geometry has a repeated point + + The geometry to test + true if the geometry has a repeated point, otherwise false + + + + Checks if an array of Coordinates has a repeated point + + An array of coordinates + true if has a repeated point, otherwise false + + + + Checks if an array of Coordinates has a repeated point + + A coordinate sequence + true if has a repeated point, otherwise false + + + + Contains information about the nature and location of + a validation error. + + + + + + + + + Indicates that a hole of a polygon lies partially + or completely in the exterior of the shell. + + + + + Indicates that a hole lies + in the interior of another hole in the same polygon. + + + + + Indicates that the interior of a polygon is disjoint + (often caused by set of contiguous holes splitting + the polygon into two parts). + + + + + Indicates that two rings of a polygonal geometry intersect. + + + + + Indicates that a ring self-intersects. + + + + + Indicates that a polygon component of a + lies inside another polygonal component. + + + + + Indicates that a polygonal geometry + contains two rings which are identical. + + + + + Indicates that either: + - A contains a single point. + - A contains 2 or 3 points. + + + + + Indicates that the X or Y ordinate of + a is not a valid + numeric value (e.g. ). + + + + + Indicates that a ring is not correctly closed + (the first and the last coordinate are different). + + + + + Contains information about the nature and location of a Geometry + validation error. + + + + + These messages must synch up with the indexes above + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Finds all connected s of a . + + + + + Initializes a new instance of the class. + + The . + + + + Adds all nodes and edges reachable from this node to the subgraph. + Uses an explicit stack to avoid a large depth of recursion. + + + + + + + Adds the argument node and all its out edges to the subgraph. + + + + + + + + Represents a directed edge in a PlanarGraph. A DirectedEdge may or + may not have a reference to a parent Edge (some applications of + planar graphs may not require explicit Edge objects to be created). Usually + a client using a PlanarGraph will subclass DirectedEdge + to add its own application-specific data and methods. + + + + + Returns a List containing the parent Edge (possibly null) for each of the given + DirectedEdges. + + + + + + + Constructs a DirectedEdge connecting the from node to the + to node. + + + + + Specifies this DirectedEdge's direction (given by an imaginary + line from the from node to directionPt). + + + Whether this DirectedEdge's direction is the same as or + opposite to that of the parent Edge (if any). + + + + + Returns this DirectedEdge's parent Edge, or null if it has none. + Associates this DirectedEdge with an Edge (possibly null, indicating no associated + Edge). + + + + + Returns 0, 1, 2, or 3, indicating the quadrant in which this DirectedEdge's + orientation lies. + + + + + Returns 0, 1, 2, or 3, indicating the quadrant in which this DirectedEdge's + orientation lies. + + + + + Returns a point to which an imaginary line is drawn from the from-node to + specify this DirectedEdge's orientation. + + + + + Returns whether the direction of the parent Edge (if any) is the same as that + of this Directed Edge. + + + + + Returns the node from which this DirectedEdge leaves. + + + + + Returns the node to which this DirectedEdge goes. + + + + + Returns the coordinate of the from-node. + + + + + Returns the angle that the start of this DirectedEdge makes with the + positive x-axis, in radians. + + + + + Returns the symmetric DirectedEdge -- the other DirectedEdge associated with + this DirectedEdge's parent Edge. + Sets this DirectedEdge's symmetric DirectedEdge, which runs in the opposite + direction. + + + + + Returns 1 if this DirectedEdge has a greater angle with the + positive x-axis than b", 0 if the DirectedEdges are collinear, and -1 otherwise. + Using the obvious algorithm of simply computing the angle is not robust, + since the angle calculation is susceptible to round off. A robust algorithm + is: + first compare the quadrants. If the quadrants are different, it it + trivial to determine which vector is "greater". + if the vectors lie in the same quadrant, the robust + RobustCGAlgorithms.ComputeOrientation(Coordinate, Coordinate, Coordinate) + function can be used to decide the relative orientation of the vectors. + + + + + + + Returns 1 if this DirectedEdge has a greater angle with the + positive x-axis than b", 0 if the DirectedEdges are collinear, and -1 otherwise. + Using the obvious algorithm of simply computing the angle is not robust, + since the angle calculation is susceptible to round off. A robust algorithm + is: + first compare the quadrants. If the quadrants are different, it it + trivial to determine which vector is "greater". + if the vectors lie in the same quadrant, the robust + RobustCGAlgorithms.ComputeOrientation(Coordinate, Coordinate, Coordinate) + function can be used to decide the relative orientation of the vectors. + + + + + + + Writes a detailed string representation of this DirectedEdge to the given PrintStream. + + + + + + Tests whether this component has been removed from its containing graph. + + + + + + Removes this directed edge from its containing graph. + + + + + + + + A sorted collection of DirectedEdges which leave a Node + in a PlanarGraph. + + + + + The underlying list of outgoing DirectedEdges. + + + + + Adds a new member to this DirectedEdgeStar. + + + + + + Drops a member of this DirectedEdgeStar. + + + + + + Returns an Iterator over the DirectedEdges, in ascending order by angle with the positive x-axis. + + + + + Returns the number of edges around the Node associated with this DirectedEdgeStar. + + + + + Returns the coordinate for the node at which this star is based. + + + + + Returns the DirectedEdges, in ascending order by angle with the positive x-axis. + + + + + + + + + + Returns the zero-based index of the given Edge, after sorting in ascending order + by angle with the positive x-axis. + + + + + + + Returns the zero-based index of the given DirectedEdge, after sorting in ascending order + by angle with the positive x-axis. + + + + + + + Returns the remainder when i is divided by the number of edges in this + DirectedEdgeStar. + + + + + + + Returns the on the left-hand + side of the given + (which must be a member of this DirectedEdgeStar). + + + + + + + Returns the on the right-hand (CW) + side of the given + (which must be a member of this DirectedEdgeStar). + + + + + Represents an undirected edge of a {PlanarGraph}. An undirected edge + in fact simply acts as a central point of reference for two opposite + DirectedEdges. + Usually a client using a PlanarGraph will subclass Edge + to add its own application-specific data and methods. + + + + + The two DirectedEdges associated with this Edge. + + + + + Constructs an Edge whose DirectedEdges are not yet set. Be sure to call + SetDirectedEdges(DirectedEdge, DirectedEdge). + + + + + Constructs an Edge initialized with the given DirectedEdges, and for each + DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds + this Edge to its from-Node. + + + + + + + Initializes this Edge's two DirectedEdges, and for each DirectedEdge: sets the + Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node. + + + + + + + Returns one of the DirectedEdges associated with this Edge. + + 0 or 1. + + + + + Returns the DirectedEdge that starts from the given node, or null if the + node is not one of the two nodes associated with this Edge. + + + + + + + If node is one of the two nodes associated with this Edge, + returns the other node; otherwise returns null. + + + + + + + Removes this edge from its containing graph. + + + + + Tests whether this component has been removed from its containing graph. + + + + + + The base class for all graph component classes. + Maintains flags of use in generic graph algorithms. + Provides two flags: + marked - typically this is used to indicate a state that persists + for the course of the graph's lifetime. For instance, it can be + used to indicate that a component has been logically deleted from the graph. + visited - this is used to indicate that a component has been processed + or visited by an single graph algorithm. For instance, a breadth-first traversal of the + graph might use this to indicate that a node has already been traversed. + The visited flag may be set and cleared many times during the lifetime of a graph. + + + + + Sets the state + for all s in an . + + A to scan. + The state to set the flag to. + + + + Sets the state + for all s in an . + + A to scan. + The state to set the flag to. + + + + Finds the first + in a set + which has the specified state. + + A to scan. + The state to test. + The first found, or null if none found. + + + + Tests if a component has been visited during the course of a graph algorithm. + + + + + Gets/Sets the visited flag for this component. + + + + + Tests if a component has been marked at some point during the processing + involving this graph. + + + + + Gets/Sets the marked flag for this component. + + + + + Tests whether this component has been removed from its containing graph. + + + + + Gets or sets user defined data for this component + + + + + A node in a PlanarGraph is a location where 0 or more Edges + meet. A node is connected to each of its incident Edges via an outgoing + DirectedEdge. Some clients using a PlanarGraph may want to + subclass Node to add their own application-specific + data and methods. + + + + + Returns all Edges that connect the two nodes (which are assumed to be different). + + + + + + + + The location of this Node. + + + + + The collection of DirectedEdges that leave this Node. + + + + + Constructs a Node with the given location. + + + + + + Constructs a Node with the given location and collection of outgoing DirectedEdges. + + + + + + + Returns the location of this Node. + + + + + Adds an outgoing DirectedEdge to this Node. + + + + + + Returns the collection of DirectedEdges that leave this Node. + + + + + Returns the number of edges around this Node. + + + + + Returns the zero-based index of the given Edge, after sorting in ascending order + by angle with the positive x-axis. + + + + + + + Removes a incident on this node. Does not change the state of the directed edge. + + + + + Removes this node from its containing graph. + + + + + Tests whether this component has been removed from its containing graph. + + + + + + + + + + + + A map of nodes, indexed by the coordinate of the node. + + + + + Adds a node to the map, replacing any that is already at that location. + + + The added node. + + + + Removes the Node at the given location, and returns it (or null if no Node was there). + + + + + + + Returns the Node at the given location, or null if no Node was there. + + + + + + + Returns an Iterator over the Nodes in this NodeMap, sorted in ascending order + by angle with the positive x-axis. + + + + + Returns the Nodes in this NodeMap, sorted in ascending order + by angle with the positive x-axis. + + + + + Returns the number of Nodes in this NodeMap. + + + + + Represents a directed graph which is embeddable in a planar surface. + This class and the other classes in this package serve as a framework for + building planar graphs for specific algorithms. This class must be + subclassed to expose appropriate methods to construct the graph. This allows + controlling the types of graph components ({DirectedEdge}s, + Edges and Nodes) which can be added to the graph. An + application which uses the graph framework will almost always provide + subclasses for one or more graph components, which hold application-specific + data and graph algorithms. + + + + + + + + + + + + + + + + + + + + Returns the at the given location, or null if no was there. + + The location + The node found
+ or null if this graph contains no node at the location +
+
+ + + Adds a node to the map, replacing any that is already at that location. + Only subclasses can add Nodes, to ensure Nodes are of the right type. + + + The added node. + + + + Adds the Edge and its DirectedEdges with this PlanarGraph. + Assumes that the Edge has already been created with its associated DirectEdges. + Only subclasses can add Edges, to ensure the edges added are of the right class. + + + + + + Adds the Edge to this PlanarGraph; only subclasses can add DirectedEdges, + to ensure the edges added are of the right class. + + + + + + Returns an IEnumerator over the Nodes in this PlanarGraph. + + + + + + Returns the Nodes in this PlanarGraph. + + + + + Returns an Iterator over the DirectedEdges in this PlanarGraph, in the order in which they + were added. + + + + + + Returns an Iterator over the Edges in this PlanarGraph, in the order in which they + were added. + + + + + + Returns the Edges that have been added to this PlanarGraph. + + + + + Removes an Edge and its associated DirectedEdges from their from-Nodes and + from this PlanarGraph. Note: This method does not remove the Nodes associated + with the Edge, even if the removal of the Edge reduces the degree of a + Node to zero. + + + + + + Removes a from its from- and from this PlanarGraph. + + + This method does not remove the s associated with the DirectedEdge, + even if the removal of the DirectedEdge reduces the degree of a Node to zero. + + + + + + Removes a node from the graph, along with any associated DirectedEdges and + Edges. + + + + + + Returns all Nodes with the given number of Edges around it. + + + + + + + A subgraph of a . + A subgraph may contain any subset of s + from the parent graph. + It will also automatically contain all s + and s associated with those edges. + No new objects are created when edges are added - + all associated components must already exist in the parent graph. + + + + + + + + + + + + + + + + + + + + + + + + + Creates a new subgraph of the given . + + + + + + Gets the which this subgraph is part of. + + + + + + Adds an to the subgraph. + The associated s and s are also added. + + The to add. + + + + Returns an over the s in this graph, + in the order in which they were added. + + + + + + Returns an over the s in this graph, + in the order in which they were added. + + + + + + Returns an over the s in this graph. + + + + + + Tests whether an is contained in this subgraph. + + The to test. + true if the is contained in this subgraph. + + + + Determines the maximum number of common most-significant + bits in the mantissa of one or numbers. + Can be used to compute the double-precision number which + is represented by the common bits. + If there are no common bits, the number computed is 0.0. + + + + + Computes the bit pattern for the sign and exponent of a + double-precision number. + + + The bit pattern for the sign and exponent. + + + + This computes the number of common most-significant bits in the mantissas + of two double-precision numbers. + It does not count the hidden bit, which is always 1. + It does not determine whether the numbers have the same exponent - if they do + not, the value computed by this function is meaningless. + + + /// + The number of common most-significant mantissa bits. + + + + Zeroes the lower n bits of a bitstring. + + The bitstring to alter. + the number of bits to zero. + The zeroed bitstring. + + + + Extracts the i'th bit of a bitstring. + + The bitstring to extract from. + The bit to extract. + The value of the extracted bit. + + + + + + + + + + + + + + + A representation of the Double bits formatted for easy readability + + + + + + + Provides versions of Geometry spatial functions which use + common bit removal to reduce the likelihood of robustness problems. + In the current implementation no rounding is performed on the + reshifted result point, which means that it is possible + that the returned Geometry is invalid. + Client classes should check the validity of the returned result themselves. + + + + + Creates a new instance of class, which reshifts result Geometrys. + + + + + Creates a new instance of class, specifying whether + the result Geometrys should be reshifted. + + + + + + Computes the set-theoretic intersection of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic intersection of the input Geometries. + + + + Computes the set-theoretic union of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic union of the input Geometries. + + + + Computes the set-theoretic difference of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry, to be subtracted from the first. + The Geometry representing the set-theoretic difference of the input Geometries. + + + Computes the set-theoretic symmetric difference of two geometries, + using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic symmetric difference of the input Geometries. + + + + Computes the buffer a point, using enhanced precision. + + The Geometry to buffer. + The buffer distance. + The Geometry representing the buffer of the input Geometry. + + + + If required, returning the result to the original precision if required. + In this current implementation, no rounding is performed on the + reshifted result point, which means that it is possible + that the returned Geometry is invalid. + + The result Geometry to modify. + The result Geometry with the required precision. + + + + Computes a copy of the input Geometry with the calculated common bits + removed from each coordinate. + + The Geometry to remove common bits from. + A copy of the input Geometry with common bits removed. + + + + Computes a copy of each input Geometrys with the calculated common bits + removed from each coordinate. + + A Geometry to remove common bits from. + A Geometry to remove common bits from. + + An array containing copies + of the input Geometry's with common bits removed. + + + + + Removes common most-significant mantissa bits + from one or more s. + + The CommonBitsRemover "scavenges" precision + which is "wasted" by a large displacement of the geometry + from the origin. + For example, if a small geometry is displaced from the origin + by a large distance, + the displacement increases the significant figures in the coordinates, + but does not affect the relative topology of the geometry. + Thus the geometry can be translated back to the origin + without affecting its topology. + In order to compute the translation without affecting + the full precision of the coordinate values, + the translation is performed at the bit level by + removing the common leading mantissa bits. + + If the geometry envelope already contains the origin, + the translation procedure cannot be applied. + In this case, the common bits value is computed as zero. + + If the geometry crosses the Y axis but not the X axis + (and mutatis mutandum), + the common bits for Y are zero, + but the common bits for X are non-zero. + + + + + Add a point to the set of geometries whose common bits are + being computed. After this method has executed the + common coordinate reflects the common bits of all added + geometries. + + A Geometry to test for common bits. + + + + The common bits of the Coordinates in the supplied Geometries. + + + + + Removes the common coordinate bits from a Geometry. + The coordinates of the Geometry are changed. + + The Geometry from which to remove the common coordinate bits. + The shifted Geometry. + + + + Adds the common coordinate bits back into a Geometry. + The coordinates of the Geometry are changed. + + The Geometry to which to add the common coordinate bits. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The coordinate sequence + + + + Reduces the precision of the s in a + to match the supplied . + + + Uses . + The input is modified in-place, so + it should be cloned beforehand if the + original should not be modified. + + mbdavis + + + + Creates a new precision reducer filter. + + The PrecisionModel to use + + + + Rounds the Coordinates in the sequence to match the PrecisionModel + + + + + Always runs over all geometry components. + + + + + Always reports that the geometry has changed + + + + + Provides versions of Geometry spatial functions which use + enhanced precision techniques to reduce the likelihood of robustness problems. + + + + + Only static methods! + + + + + Computes the set-theoretic intersection of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic intersection of the input Geometries. + + + + Computes the set-theoretic union of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic union of the input Geometries. + + + + Computes the set-theoretic difference of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic difference of the input Geometries. + + + + Computes the set-theoretic symmetric difference of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic symmetric difference of the input Geometries. + + + + Reduces the precision of a + according to the supplied , + ensuring that the result is valid (unless specified otherwise). + + By default the geometry precision model is not changed. + This can be overridden by using . +

Topological Precision Reduction

+ The default mode of operation ensures the reduced result is topologically valid + (i.e. is true). + To ensure this polygonal geometry is reduced in a topologically valid fashion + (technically, by using snap-rounding). + Note that this may change polygonal geometry structure + (e.g.two polygons separated by a distance below the specified precision + will be merged into a single polygon). + Duplicate vertices are removed. + This mode is invoked by the static method . + + Normally, collapsed linear components(e.g.lines collapsing to a point) + are not included in the result. + This behavior can be changed + by setting to false, + or by using the static method . + + In general input must be valid geometry, or an + will be thrown. However if the invalidity is "mild" or very small then it + may be eliminated by precision reduction. +

Pointwise Precision Reduction

+ Alternatively, geometry can be reduced pointwise by using {@link #setPointwise(boolean)}. + Linear and point geometry are always reduced pointwise(i.e.without further change to + topology or structure), since this does not change validity. + Invalid inputs are allowed. + Duplicate vertices are preserved. + Collapsed components are always included in the result. + The result geometry may be invalid. + + This mode is invoked by the static method . +
+
+ + + Reduces precision of a geometry, ensuring output geometry is valid. + Collapsed linear and polygonal components are removed. + The geometry precision model is not changed. + Invalid input geometry may cause an error, + unless the invalidity is below the scale of the precision reduction. + + The geometry to reduce + The precision model to use + The reduced geometry + Thrwon if the reduction fails due to invalid input geometry + + + + Reduces precision of a geometry, ensuring output polygonal geometry is valid, + and preserving collapsed linear elements. + The geometry precision model is not changed. + Invalid input geometry may cause an error, + unless the invalidity is below the scale of the precision reduction. + + The geometry to reduce + The precision model to use + The reduced geometry + Thrwon if the reduction fails due to invalid input geometry + + + + Reduce precision of a geometry in a pointwise way. + All input geometry elements are preserved in the output, + including invalid polygons and collapsed polygons and linestrings. + The output may not be valid, due to collapse or self-intersection. + The geometry precision model is not changed. + Invalid input geometry is allowed. + + The geometry to reduce + The precision model to use + The reduced geometry + + + Gets or sets whether the reduction will result in collapsed components + being removed completely, or simply being collapsed to an (invalid) + Geometry of the same type. + The default is to remove collapsed components. + + + + + Gets or sets whether the of the new reduced Geometry + will be changed to be the supplied to + specify the precision reduction. + + The default is to not change the precision model + + + + + Gets or sets whether the precision reduction will be done + in pointwise fashion only. + Pointwise precision reduction reduces the precision + of the individual coordinates only, but does + not attempt to recreate valid topology. + This is only relevant for geometries containing polygonal components. + + + + + Reduces the precision of a geometry, + according to the specified strategy of this reducer. + + The geometry to reduce + The precision-reduced geometry + if the reduction fails + due to input geometry is invalid. + + + + Duplicates a geometry to one that uses a different PrecisionModel, + without changing any coordinate values. + + The geometry to duplicate + The precision model to use + The geometry value with a new precision model + + + + Computes the Minimum Clearance of a . + + The Minimum Clearance is a measure of + what magnitude of perturbation of + the vertices of a geometry can be tolerated + before the geometry becomes topologically invalid. + The smaller the Minimum Clearance distance, + the less vertex perturbation the geometry can tolerate + before becoming invalid. + + + The concept was introduced by Thompson and Van Oosterom + [TV06], based on earlier work by Milenkovic [Mi88]. + + The Minimum Clearance of a geometry G + is defined to be the value r + such that "the movement of all points by a distance + of r in any direction will + guarantee to leave the geometry valid" [TV06]. + An equivalent constructive definition [Mi88] is that + r is the largest value such: + + No two distinct vertices of G are closer than r. + No vertex of G is closer than r to an edge of G of which the vertex is not an endpoint + + The following image shows an example of the Minimum Clearance + of a simple polygon. + +
minimum clearance
+ + If G has only a single vertex (i.e. is a + ), the value of the minimum clearance + is . + + If G is a or geometry, + then in fact no amount of perturbation + will render the geometry invalid. + In this case a Minimum Clearance is still computed + based on the vertex and segment distances + according to the constructive definition. + + It is possible for no Minimum Clearance to exist. + For instance, a with all members identical + has no Minimum Clearance + (i.e. no amount of perturbation will cause + the member points to become non-identical). + Empty geometries also have no such distance. + The lack of a meaningful MinimumClearance distance is detected + and suitable values are returned by + and . + + The computation of Minimum Clearance utilizes + the + method to provide good performance even for + large inputs. + + An interesting note is that for the case of s, + the computed Minimum Clearance line + effectively determines the Nearest Neighbours in the collection. +

References

+ + [Mi88] Milenkovic, V. J., + Verifiable implementations of geometric algorithms + using finite precision arithmetic. + in Artificial Intelligence, 377-401. 1988 + [TV06] Thompson, Rod and van Oosterom, Peter, + Interchange of Spatial Data-Inhibiting Factors, + Agile 2006, Visegrad, Hungary. 2006 + +
+ /// Martin Davis +
+ + + Computes the Minimum Clearance distance for + the given Geometry. + + The input geometry + The minimum clearance + + + + Gets a LineString containing two points + which are at the Minimum Clearance distance + for the given Geometry. + + The input geometry + The value of the minimum clearance distance
+ or LINESTRING EMPTY if no minimum clearance distance exists.
+
+ + + Creates an object to compute the Minimum Clearance for the given Geometry + + The input geometry + + + + Gets the Minimum Clearance distance. + If no distance exists + (e.g. in the case of two identical points) + is returned. + + + The value of the minimum clearance distance
+ or if no Minimum Clearance distance exists +
+
+ + + Gets a LineString containing two points + which are at the Minimum Clearance distance. + If no distance could be found + (e.g. in the case of two identical points) + LINESTRING EMPTY is returned. + + The value of the minimum clearance distance,
+ or LINESTRING EMPTY if no minimum clearance distance exists.
+
+ + + Implements the MinimumClearance distance function: + + dist(p1, p2) = + p1 != p2 : p1.distance(p2) + p1 == p2 : Double.MAX + + dist(p, seg) = + p != seq.p1 && p != seg.p2 + ? seg.distance(p) + : Double.MaxValue + + Also computes the values of the nearest points, if any. + + Martin Davis + + + + A transformer to reduce the precision of a geometry pointwise. + + Martin Davis + + + + A transformer to reduce the precision of geometry in a + topologically valid way.
+ Repeated points are removed. + If geometry elements collapse below their valid length, + they may be removed + by specifying isRemoveCollapsed as true. +
+ Martin Davis +
+ + + + + + + + + Computes the minimum clearance of a geometry or + set of geometries. + The Minimum Clearance is a measure of + what magnitude of perturbation of its vertices can be tolerated + by a geometry before it becomes topologically invalid. + + This class uses an inefficient O(N^2) scan. + It is primarily for testing purposes. + + + Martin Davis + + + + Creates a curved geometry by replacing the segments + of the input with Cubic Bezier Curves. + + + The Bezier control points are determined from the segments of the geometry + and the alpha control parameter controlling curvedness, and + the optional skew parameter controlling the shape of the curve at vertices. + The Bezier Curves are created to be C2-continuous (smooth) + at each input vertex. + + Alternatively, the Bezier control points can be supplied explicitly. + + The result is not guaranteed to be valid, since large alpha values + may cause self-intersections. + + + + + Creates a geometry of linearized Cubic Bezier Curves + defined by the segments of the input and a parameter + controlling how curved the result should be. + + The geometry defining the curve + A curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved) + The linearized curved geometry + + + + Creates a geometry of linearized Cubic Bezier Curves + defined by the segments of the inputand a parameter + controlling how curved the result should be, with a skew factor + affecting the curve shape at each vertex. + + The geometry defining the curve + The curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved) + The skew parameter (0 is none, positive skews towards longer side, negative towards shorter + The linearized curved geometry + + + + Creates a geometry of linearized Cubic Bezier Curves + defined by the segments of the input + and a list (or lists) of control points. + + + Typically the control point geometry + is a or + containing an element for each line or ring in the input geometry. + The list of control points for each linear element must contain two + vertices for each segment (and thus 2 * npts - 2). + + The geometry defining the curve + A geometry containing the control point elements. + The linearized curved geometry + + + + Creates a new instance producing a Bezier curve defined by a geometry + and an alpha curvedness value. + + The geometry defining curve + A curvedness parameter (0 = linear, 1 = round, 2 = distorted) + + + + Creates a new instance producing a Bezier curve defined by a geometry, + an alpha curvedness value, and a skew factor. + + The geometry defining curve + curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved) + The skew parameter (0 is none, positive skews towards longer side, negative towards shorter + + + + Creates a new instance producing a Bezier curve defined by a geometry, + and a list (or lists) of control points. + + + Typically the control point geometry + is a or + containing an element for each line or ring in the input geometry. + The list of control points for each linear element must contain two + vertices for each segment (and thus 2 * npts - 2). + + + + + Gets the computed Bezier curve geometry + + The curved geometry + + + + Creates control points for each vertex of curve. + The control points are collinear with each vertex, + thus providing C1-continuity. + By default the control vectors are the same length, + which provides C2-continuity(same curvature on each + side of vertex. + The alpha parameter controls the length of the control vectors. + Alpha = 0 makes the vectors zero-length, and hence flattens the curves. + Alpha = 1 makes the curve at right angles roughly circular. + Alpha > 1 starts to distort the curve and may introduce self-intersections. + + The control point array contains a pair of coordinates for each input segment. + + + + + Sets the end control points for a line. + Produce a symmetric curve for the first and last segments + by using mirrored control points for start and end vertex. + + The coordinates + The control points + + + + Creates a control point aimed at the control point at the opposite end of the segment. + + + + + Calculates vertices along a cubic Bezier curve. + + The start point + The end point + The first control point + The second control point + A set of interpolation parameters + An array to hold generated points. + + + + Gets the interpolation parameters for a Bezier curve approximated by a + given number of vertices. + + The number of vertices + An array of double[4] holding the parameter values + + + + Encodes points as the index along finite planar Hilbert curves. + + The planar Hilbert Curve is a continuous space-filling curve. + In the limit the Hilbert curve has infinitely many vertices and fills + the space of the unit square. + A sequence of finite approximations to the infinite Hilbert curve + is defined by the level number. + The finite Hilbert curve at level n Hₙ contains 2ⁿ⁺¹ points. + Each finite Hilbert curve defines an ordering of the + points in the 2-dimensional range square containing the curve. + Curves fills the range square of side 2ˡᵉᵛᵉˡ. + Curve points have ordinates in the range [0, 2ˡᵉᵛᵉˡ - 1]. + The index of a point along a Hilbert curve is called the Hilbert code. + The code for a given point is specific to the level chosen. + + + This implementation represents codes using 32-bit integers. + This allows levels 0 to 16 to be handled. + The class supports encoding points in the range of a given level curve + and decoding the point for a given code value. + + + The Hilbert order has the property that it tends to preserve locality. + This means that codes which are near in value will have spatially proximate + points. The converse is not always true - the delta between + codes for nearby points is not always small. But the average delta + is small enough that the Hilbert order is an effective way of linearizing space + to support range queries. + + + + Martin Davis + + + + + + + The maximum curve level that can be represented. + + + + + The number of points in the curve for the given level. + The number of points is 2²ˡᵉᵛᵉˡ. + + The level of the curve + The number of points. + + + + The maximum ordinate value for points + in the curve for the given level. + The maximum ordinate is 2ˡᵉᵛᵉˡ - 1. + + The level of the curve. + The maximum ordinate value. + + + + The level of the finite Hilbert curve which contains at least + the given number of points. + + The number of points required. + The level of the curve. + + + + Encodes a point (x,y) + in the range of the the Hilbert curve at a given level + as the index of the point along the curve. + The index will lie in the range [0, 2ˡᵉᵛᵉˡ⁺¹]. + + The level of the Hilbert curve. + The x ordinate of the point. + The y ordinate of the point. + The index of the point along the Hilbert curve. + + + + Clamps a level to the range valid for + the index algorithm used. + + The level of a Hilbert curve. + A valid level. + + + + Computes the point on a Hilbert curve + of given level for a given code index. + The point ordinates will lie in the range [0, 2ˡᵉᵛᵉˡ - 1]. + + The Hilbert curve level. + The index of the point on the curve. + The point on the Hilbert curve. + + + + Generates a representing the Hilbert Curve + at a given level. + + + + + Initializes a new instance of the class + using the provided . + + The geometry factory to use. + + + + Gets or sets the level of curve to generate. + The level must be in the range [0 - 16]. + This determines the + number of points in the generated curve. + + + + + + + + The height of an equilateral triangle of side one + + + + + Encodes points as the index along the planar Morton (Z-order) curve. + + The planar Morton (Z-order) curve is a continuous space-filling curve. + The Morton curve defines an ordering of the + points in the positive quadrant of the plane. + The index of a point along the Morton curve is called the Morton code. + + + A sequence of subsets of the Morton curve can be defined by a level number. + Each level subset occupies a square range. + The curve at level n Mₙ contains 2ⁿ⁺¹ points. + It fills the range square of side 2ˡᵉᵛᵉˡ. + Curve points have ordinates in the range [0, 2ˡᵉᵛᵉˡ - 1]. + The code for a given point is identical at all levels. + The level simply determines the number of points in the curve subset + and the size of the range square. + + + This implementation represents codes using 32-bit integers. + This allows levels 0 to 16 to be handled. + The class supports encoding points + and decoding the point for a given code value. + + + The Morton order has the property that it tends to preserve locality. + This means that codes which are near in value will have spatially proximate + points. The converse is not always true - the delta between + codes for nearby points is not always small. But the average delta + is small enough that the Morton order is an effective way of linearizing space + to support range queries. + + + + Martin Davis + + + + + + + The maximum curve level that can be represented. + + + + + The number of points in the curve for the given level. + The number of points is 2²ˡᵉᵛᵉˡ. + + The level of the curve + The number of points. + + + + The maximum ordinate value for points + in the curve for the given level. + The maximum ordinate is 2ˡᵉᵛᵉˡ - 1. + + The level of the curve. + The maximum ordinate value. + + + + The level of the finite Morton curve which contains at least + the given number of points. + + The number of points required. + The level of the curve. + + + + Computes the index of the point (x,y) + in the Morton curve ordering. + + The x ordinate of the point. + The y ordinate of the point. + The index of the point along the Morton curve. + + + + Computes the point on the Morton curve + for a given index. + + The index of the point on the curve. + The point on the curve. + + + + Generates a representing the Morton Curve + at a given level. + + + + + Initializes a new instance of the class + using the provided . + + The geometry factory to use. + + + + Gets or sets the level of curve to generate. + The level must be in the range [0 - 16]. + + + + + + + + Gets or sets the total number of points in the created . + The created geometry will have no more than this number of points, + unless more are needed to create a valid geometry. + + + + + Creates random point sets contained in a + region defined by either a rectangular or a polygonal extent. + + mbdavis + + + + Create a shape factory which will create shapes using the default + . + + + + + Create a shape factory which will create shapes using the given + + + The factory to use + + + + Sets a polygonal mask. + + if the mask is not polygonal + + + + Creates random point sets where the points + are constrained to lie in the cells of a grid. + + mbdavis + + + + Create a builder which will create shapes using the default + . + + + + + Create a builder which will create shapes using the given + . + + The factory to use + + + + Gets or sets whether generated points are constrained to lie + within a circle contained within each grid cell. + This provides greater separation between points + in adjacent cells. + + The default is to not be constrained to a circle. + + + + + Gets or sets the fraction of the grid cell side which will be treated as + a gutter, in which no points will be created. + + The provided value is clamped to the range [0.0, 1.0]. + + + + + Gets the containing the generated point + + A MultiPoint + + + + Simplifies a line (sequence of points) using + the standard Douglas-Peucker algorithm. + + + + + + + + + + + + + Creates an instance of this class using the provided array of coordinates + + An array of coordinates + + + + The distance tolerance for the simplification. + + + + + + + + + + + Simplifies a using the Douglas-Peucker algorithm. + + + Ensures that any polygonal geometries returned are valid. + Simple lines are not guaranteed to remain simple after simplification. + All geometry types are handled. + Empty and point geometries are returned unchanged. + Empty geometry components are deleted. + + Note that in general D-P does not preserve topology - + e.g. polygons can be split, collapse to lines or disappear + holes can be created or disappear, + and lines can cross. + To simplify point while preserving topology use TopologySafeSimplifier. + (However, using D-P is significantly faster). + + KNOWN BUGS: + In some cases the approach used to clean invalid simplified polygons + can distort the output geometry severely. + + + + + + Simplifies a geometry using a given tolerance. + + The geometry to simplify. + The tolerance to use. + A simplified version of the geometry. + + + + Creates a simplifier for a given geometry. + + The geometry to simplify. + + + + The distance tolerance for the simplification. + + + All vertices in the simplified geometry will be within this + distance of the original geometry. + The tolerance value must be non-negative. + + + + + Controls whether simplified polygons will be "fixed" + to have valid topology. + + + The caller may choose to disable this because: + + valid topology is not required + fixing topology is a relative expensive operation + in some pathological cases the topology fixing operation may either fail or run for too long + + The default is to fix polygon topology. + + + + + Gets the simplified geometry. + + The simplified geometry. + + + + The transformer class + + + + + + + + Simplifies a polygon, fixing it if required. + + The geometry to transform + The parent geometry + + + + + Simplifies a LinearRing. If the simplification results in a degenerate ring, remove the component. + + null if the simplification results in a degenerate ring + + + + + + + Creates a valid area point from one that possibly has + bad topology (i.e. self-intersections). + Since buffer can handle invalid topology, but always returns + valid point, constructing a 0-width buffer "corrects" the + topology. + Note this only works for area geometries, since buffer always returns + areas. This also may return empty geometries, if the input + has no actual area.
+ If the input is empty or is not polygonal, + this ensures that POLYGON EMPTY is returned. +
+ An area point possibly containing self-intersections. + A valid area point. +
+ + + An index of LineSegments. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ItemVisitor subclass to reduce volume of query results. + + + + + + + + + + + + + + + + + + + + + + Simplifies a linestring (sequence of points) using the + Visvalingam-Whyatt algorithm. + The Visvalingam-Whyatt algorithm simplifies geometry + by removing vertices while trying to minimize the area changed. + + 1.7 + + + + A LineSegment which is tagged with its location in a Geometry. + Used to index the segments in a point and recover the segment locations + from the index. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Simplifies a collection of TaggedLineStrings, preserving topology + (in the sense that no new intersections are introduced). + This class is essentially just a container for the common + indexes used by . + + + + + Gets or sets the distance tolerance for the simplification.
+ Points closer than this tolerance to a simplified segment may + be removed. +
+
+ + + Simplifies a collection of TaggedLineStrings. + + The collection of lines to simplify. + + + + Represents a which can be modified to a simplified shape. + This class provides an attribute which specifies the minimum allowable length + for the modified result. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Simplifies a TaggedLineString, preserving topology + (in the sense that no new intersections are introduced). + Uses the recursive Douglas-Peucker algorithm. + + + + + Sets the distance tolerance for the simplification. + All vertices in the simplified geometry will be within this + distance of the original geometry. + + + + + Simplifies the given + using the distance tolerance specified. + + The linestring to simplify. + + + + Flattens a section of the line between + indexes and , + replacing them with a line between the endpoints. + The input and output indexes are updated + to reflect this. + + The start index of the flattened section. + The end index of the flattened section. + The new segment created. + + + + Tests whether a segment is in a section of a . + + + + + + + + + Remove the segs in the section of the line. + + + + + + + + Simplifies a point and ensures that + the result is a valid point having the + same dimension and number of components as the input, + and with the components having the same topological + relationship. + + If the input is a polygonal geometry + ( or ): + + The result has the same number of shells and holes as the input, + with the same topological structure + The result rings touch at no more than the number of touching points in the input + (although they may touch at fewer points). + The key implication of this statement is that if the + input is topologically valid, so is the simplified output. + + For linear geometries, if the input does not contain + any intersecting line segments, this property + will be preserved in the output. + + For all geometry types, the result will contain + enough vertices to ensure validity. For polygons + and closed linear geometries, the result will have at + least 4 vertices; for open LineStrings the result + will have at least 2 vertices. + + All geometry types are handled. + Empty and point geometries are returned unchanged. + Empty geometry components are deleted. + + The simplification uses a maximum-distance difference algorithm + similar to the Douglas-Peucker algorithm. + + +

KNOWN BUGS

+ + May create invalid topology if there are components which are small + relative to the tolerance value. + In particular, if a small hole is very near an edge, + it is possible for the edge to be moved by a relatively large tolerance value + and end up with the hole outside the result shell (or inside another hole). + Similarly, it is possible for a small polygon component to end up inside + a nearby larger polygon. + A workaround is to test for this situation in post-processing and remove + any invalid holes or polygons. + +
+ +
+ + + + + + + + + + + Creates an instance of this class for the provided geometry + + The geometry to simplify + + + + Gets or sets the distance tolerance for the simplification.
+ Points closer than this tolerance to a simplified segment may + be removed. +
+
+ + + + + + + + + A LineString transformer + + + + > + + + + A filter to add linear geometries to the LineString map + with the appropriate minimum size constraint. + Closed s (including s + have a minimum output size constraint of 4, + to ensure the output is valid. + For all other LineStrings, the minimum size is 2 points. + + Martin Davis + + + + Filters linear geometries. + + A geometry of any type + + + + Simplifies a linestring (sequence of points) using the + Visvalingam-Whyatt algorithm. + The Visvalingam-Whyatt algorithm simplifies geometry + by removing vertices while trying to minimize the area changed. + + 1.7 + + + + Simplifies a using the Visvalingam-Whyatt area-based algorithm. + Ensures that any polygonal geometries returned are valid. Simple lines are not + guaranteed to remain simple after simplification. All geometry types are + handled. Empty and point geometries are returned unchanged. Empty geometry + components are deleted. + The simplification tolerance is specified as a distance. + This is converted to an area tolerance by squaring it. + + Known Bugs + * Not yet optimized for performance. + * Does not simplify the endpoint of rings. + To Do + * Allow specifying desired number of vertices in the output. + + + + Note that in general this algorithm does not preserve topology - e.g. polygons can be split, + collapse to lines or disappear holes can be created or disappear, and lines + can cross. + + 1.7 + + + + Simplifies a using a given tolerance. + + The to simplify. + The tolerance to use. + A simplified version of the . + + + + Creates a simplifier for a given . + + The to simplify. + + + + Sets the distance tolerance for the simplification. All vertices in the + simplified will be within this distance of the original geometry. + The tolerance value must be non-negative. + + + + + Controls whether simplified polygons will be "fixed" to have valid + topology. The caller may choose to disable this because: + * valid topology is not required. + * fixing topology is a relative expensive operation. + * in some pathological cases the topology fixing operation may either + fail or run for too long. + + The default is to fix polygon topology. + + + + Gets the simplified . + + The simplified . + + + + Simplifies a , fixing it if required. + + + + + + + + Simplifies a . If the simplification results in a degenerate + ring, remove the component. + + + + null if the simplification results in a degenerate ring. + + + + Simplifies a , fixing it if required. + + + + + + + + Creates a valid area geometry from one that possibly has bad topology + (i.e. self-intersections). Since buffer can handle invalid topology, but + always returns valid geometry, constructing a 0-width buffer "corrects" + the topology. Note this only works for area geometries, since buffer + always returns areas. This also may return empty geometries, if the input + has no actual area. + + An area geometry possibly containing self-intersections. + A valid area geometry. + + + + A utility class which creates Conforming Delaunay Triangulations + from collections of points and linear constraints, and extract the resulting + triangulation edges or triangles as geometries. + + Martin Davis + + + + Sets the sites (point or vertices) which will be triangulated. + All vertices of the given geometry will be used as sites. + The site vertices do not have to contain the constraint + vertices as well; any site vertices which are + identical to a constraint vertex will be removed + from the site vertex set. + + The geometry from which the sites will be extracted. + + + + Sets the linear constraints to be conformed to. + All linear components in the input will be used as constraints. + The constraint vertices do not have to be disjoint from + the site vertices. + The constraints must not contain duplicate segments (up to orientation). + + + + + Sets the snapping tolerance which will be used + to improved the robustness of the triangulation computation. + A tolerance of 0.0 specifies that no snapping will take place. + + + + + Gets the QuadEdgeSubdivision which models the computed triangulation. + + The subdivision containing the triangulation + + + + Gets the edges of the computed triangulation as a . + + The geometry factory to use to create the output + the edges of the triangulation + + + + Gets the faces of the computed triangulation as a + of . + + the geometry factory to use to create the output + the faces of the triangulation + + + + Computes a Conforming Delaunay Triangulation over a set of sites and a set of + linear constraints. + + + + A conforming Delaunay triangulation is a true Delaunay triangulation. In it + each constraint segment is present as a union of one or more triangulation + edges. Constraint segments may be subdivided into two or more triangulation + edges by the insertion of additional sites. The additional sites are called + Steiner points, and are necessary to allow the segments to be faithfully + reflected in the triangulation while maintaining the Delaunay property. + Another way of stating this is that in a conforming Delaunay triangulation + every constraint segment will be the union of a subset of the triangulation + edges (up to tolerance). + + + A Conforming Delaunay triangulation is distinct from a Constrained Delaunay triangulation. + A Constrained Delaunay triangulation is not necessarily fully Delaunay, + and it contains the constraint segments exactly as edges of the triangulation. + + + A typical usage pattern for the triangulator is: + + ConformingDelaunayTriangulator cdt = new ConformingDelaunayTriangulator(sites, tolerance); + + // optional + cdt.SplitPointFinder = splitPointFinder; + cdt.VertexFactory = vertexFactory; + + cdt.SetConstraints(segments, new List<Vertex>(vertexMap.Values)); + cdt.FormInitialDelaunay(); + cdt.EnforceConstraints(); + subdiv = cdt.Subdivision; + + + + David Skea + Martin Davis + + + + Creates a Conforming Delaunay Triangulation based on the given + unconstrained initial vertices. The initial vertex set should not contain + any vertices which appear in the constraint set. + + a collection of + the distance tolerance below which points are considered identical + + + + Sets the constraints to be conformed to by the computed triangulation. + The constraints must not contain duplicate segments (up to orientation). + The unique set of vertices (as es) + forming the constraints must also be supplied. + Supplying it explicitly allows the ConstraintVertexes to be initialized + appropriately (e.g. with external data), and avoids re-computing the unique set + if it is already available. + + list of the constraint s + the set of unique es referenced by the segments + + + + Gets or sets the to be + used during constraint enforcement. + Different splitting strategies may be appropriate + for special situations. + + the ConstraintSplitPointFinder to be used + + + + Gets the tolerance value used to construct the triangulation. + + a tolerance value + + + + Gets and sets the used to create new constraint vertices at split points. + + Allows the setting of a custom to be used + to allow vertices carrying extra information to be created. + + + + + Gets the which represents the triangulation. + + + + + Gets the which contains the vertices of the triangulation. + + + + + Gets the sites (vertices) used to initialize the triangulation. + + + + + Gets the s which represent the constraints. + + + + + Gets the convex hull of all the sites in the triangulation, + including constraint vertices. + Only valid after the constraints have been enforced. + + the convex hull of the sites + + + + Creates a vertex on a constraint segment + + the location of the vertex to create + the constraint segment it lies on + the new constraint vertex + + + + Inserts all sites in a collection + + a collection of ConstraintVertex + + + + Inserts a site into the triangulation, maintaining the conformal Delaunay property. + This can be used to further refine the triangulation if required + (e.g. to approximate the medial axis of the constraints, + or to improve the grading of the triangulation). + + the location of the site to insert + + + + Computes the Delaunay triangulation of the initial sites. + + + + + Enforces the supplied constraints into the triangulation. + + + if the constraints cannot be enforced + + + + Given a set of points stored in the kd-tree and a line segment defined by + two points in this set, finds a in the circumcircle of + the line segment, if one exists. This is called the Gabriel point - if none + exists then the segment is said to have the Gabriel condition. Uses the + heuristic of finding the non-Gabriel point closest to the midpoint of the + segment. + + the line segment + + A point which is non-Gabriel, + or null if no point is non-Gabriel + + + + + Indicates a failure during constraint enforcement. + + Martin Davis + 1.0 + + + + Creates a new instance with a given message. + + a string + + + + Creates a new instance with a given message and approximate location. + + a string + the location of the error + + + + Gets the approximate location of this error. + + a location + + + + A vertex in a Constrained Delaunay Triangulation. + The vertex may or may not lie on a constraint. + If it does it may carry extra information about the original constraint. + + Martin Davis + + + + Creates a new constraint vertex + + the location of the vertex + + + + Gets or sets whether this vertex lies on a constraint. + + true if the vertex lies on a constraint + + + + Gets or sets the external constraint object + + object which carries information about the constraint this vertex lies on + + + + Merges the constraint data in the vertex other into this vertex. + This method is called when an inserted vertex is + very close to an existing vertex in the triangulation. + + the constraint vertex to merge + + + + An interface for factories which create a + + Martin Davis + + + + A utility class which creates Delaunay Triangulations + from collections of points and extract the resulting + triangulation edges or triangles as geometries. + + Martin Davis + + + + Extracts the unique s from the given . + + the geometry to extract from + a List of the unique Coordinates + + + + Converts all s in a collection to es. + + the coordinates to convert + a List of Vertex objects + + + + Computes the of a collection of s. + + a List of Coordinates + the envelope of the set of coordinates + + + + Sets the sites (vertices) which will be triangulated. + All vertices of the given geometry will be used as sites. + + the geometry from which the sites will be extracted. + + + + Sets the sites (vertices) which will be triangulated + from a collection of s. + + a collection of Coordinates. + + + + Sets the snapping tolerance which will be used + to improved the robustness of the triangulation computation. + A tolerance of 0.0 specifies that no snapping will take place. + + + + + Gets the which models the computed triangulation. + + the subdivision containing the triangulation + + + + Gets the edges of the computed triangulation as a . + + the geometry factory to use to create the output + the edges of the triangulation + + + + Gets the faces of the computed triangulation as a + of . + + the geometry factory to use to create the output + the faces of the triangulation + + + + An interface for strategies for determining the location of split points on constraint segments. + The location of split points has a large effect on the performance and robustness of enforcing a + constrained Delaunay triangulation. Poorly chosen split points can cause repeated splitting, + especially at narrow constraint angles, since the split point will end up encroaching on the + segment containing the original encroaching point. With detailed knowledge of the geometry of the + constraints, it is sometimes possible to choose better locations for splitting. + + mbdavis + + + + Finds a point at which to split an encroached segment to allow the original segment to appear + as edges in a constrained Delaunay triangulation. + + the encroached segment + the encroaching point + the point at which to split the encroached segment + + + + Computes a Delaunay Triangulation of a set of es, using an + incremental insertion algorithm. + + Martin Davis + 1.0 + + + + Creates a new triangulator using the given . + The triangulator uses the tolerance of the supplied subdivision. + + a subdivision in which to build the TIN + + + + Inserts all sites in a collection. The inserted vertices MUST be + unique up to the provided tolerance value. (i.e. no two vertices should be + closer than the provided tolerance value). They do not have to be rounded + to the tolerance grid, however. + + a Collection of Vertex + if the location algorithm fails to converge in a reasonable number of iterations + + + + Inserts a new point into a subdivision representing a Delaunay + triangulation, and fixes the affected edges so that the result is still a + Delaunay triangulation. + + a quadedge containing the inserted vertex + + + + A simple split point finder which returns the midpoint of the split segment. This is a default + strategy only. Usually a more sophisticated strategy is required to prevent repeated splitting. + Other points which could be used are: +
    +
  • The projection of the encroaching point on the segment
  • +
  • A point on the segment which will produce two segments which will not be further encroached
  • +
  • The point on the segment which is the same distance from an endpoint as the encroaching
  • + point +
+
+ Martin Davis +
+ + + Gets the midpoint of the split segment + + + + + A strategy for finding constraint split points which attempts to maximise the length of the split + segments while preventing further encroachment. (This is not always possible for narrow angles). + + Martin Davis + + + + A basic strategy for finding split points when nothing extra is known about the geometry of + the situation. + + the encroached segment + the encroaching point + the point at which to split the encroached segment + + + + Computes a split point which is the projection of the encroaching point on the segment + + The segment + The enchroaching point + A split point on the segment + + + + Computes the Constrained Delaunay Triangulation of polygons. + The Constrained Delaunay Triangulation of a polygon is a set of triangles + covering the polygon, with the maximum total interior angle over all + possible triangulations. It provides the "best quality" triangulation + of the polygon. + + Holes are supported. + + Martin Davis + + + + Computes the Constrained Delaunay Triangulation of each polygon element in a geometry. + + The input geometry + A GeometryCollection of the computed triangle polygons + + + + Constructs a new Constrained Delaunay triangulator. + + The input geometry + + + + Gets the triangulation as a of triangular s. + + A collection of the result triangle polygons + + + + Gets the triangulation as a list of s. + + The list of Tris in the triangulation + + + + Computes the triangulation of a single polygon + and returns it as a list of s. + + The input polygon + A list of Tris forming the triangulation + + + + Triangulates a polygon using the Ear-Clipping technique. + The polygon is provided as a closed list of contiguous vertices + defining its boundary. + The vertices must have clockwise orientation. + + The polygon boundary must not self-cross, + but may self-touch at points or along an edge. + It may contain repeated points, which are treated as a single vertex. + By default every vertex is triangulated, + including ones which are "flat" (the adjacent segments are collinear). + These can be removed by setting . + + The polygon representation does not allow holes. + Polygons with holes can be triangulated by preparing them with . + + Martin Davis + + + + Triangulates a polygon via ear-clipping. + + The vertices of the polygon + A list of Tris + + + + The polygon vertices are provided in CW orientation. + Thus for convex interior angles + the vertices forming the angle are in CW orientation. + + + + + Indexing vertices improves ear intersection testing performance. + The polyShell vertices are contiguous, so are suitable for an SPRtree. + Note that a KDtree cannot be used because the vertex indices must be stored + and duplicates must be stored. + + + + + Creates a new instance of this class + + The vertices of the polygon to process + + + + Gets or sets whether flat corners formed by collinear adjacent line segments + are included in the triangulation. + Skipping flat corners reduces the number of triangles in the output. + However, it produces a triangulation which does not include + all input vertices. This may be undesirable for downstream processes + (such as computing a Constrained Delaunay Triangulation for + purposes of computing the medial axis). + + The default is to include all vertices in the result triangulation. + This still produces a valid triangulation, with no zero-area triangles. + + Note that repeated vertices are always skipped. + + A flag indicating if flat corners formed by collinear adjacent line segments + are included in the triangulation + + + + Finds a vertex contained in the corner triangle, if any. + Uses the vertex spatial index for efficiency. + + Also finds any vertex which is a duplicate of the corner apex vertex. + This requires a full scan of the vertices to confirm ear is valid. + This is usually a rare situation, so has little impact on performance. + + The index of the corner apex vertex + The corner vertices + The index of an intersecting or duplicate vertex, or if none + + + + Scan all vertices in current ring to check if any are duplicates + of the corner apex vertex, and if so whether the corner ear + intersects the adjacent segments and thus is invalid. + + The index of the corner apex + The corner vertices + true if the corner ia a valid ear + + + + Remove the corner apex vertex and update the candidate corner location. + + + + + Fetch the corner vertices from the indices. + + An array for the corner vertices + + + + Move to next corner. + + + + + Get the index of the next available shell coordinate starting from the given index. + + Coordinate position + Index of the next available shell coordinate + + + + Detects if a corner has repeated points (AAB or ABB), or is collapsed (ABA). + + The corner points + true if the corner is flat or collapsed + + + + Transforms a polygon with holes into a single self-touching (invalid) ring + by connecting holes to the exterior shell or to another hole. + The holes are added from the lowest upwards. + As the resulting shell develops, a hole might be added to what was + originally another hole. + + There is no attempt to optimize the quality of the join lines. + In particular, a hole which already touches at a vertex may be + joined at a different vertex. + + + + + Computes the joined ring. + + The points in the joined ring + + + + Adds a coordinate to the set and + clears the array. + + A coordinate + + + + Joins a single hole to the current shellRing. + + The hole to join + + + + Get the i'th in that the current should add after + + The coordinate of the shell vertex + The coordinate of the hole vertex + The i'th shellvertex + + + + Find the index of the coordinate in ShellCoords ArrayList, + skipping over some number of matches + + + + + + + + Gets a list of shell vertices that could be used to join with the hole. + This list contains only one item if the chosen vertex does not share the same + x value with + + The hole coordinate + A list of candidate join vertices + + + + Determine if a line segment between a hole vertex + and a shell vertex lies inside the input polygon. + + A hole coordinate + A shell coordinate + true if the line lies inside the polygon + + + + Tests whether a line segment crosses the polygon boundary. + + A vertex + A vertex + true if the line segment crosses the polygon boundary + + + + Add hole at proper position in shell coordinate list. + Also adds hole points to ordered coordinates. + + + + + + + + Sort the holes by minimum X, minimum Y. + + Polygon that contains the holes + A list of ordered hole geometry + + + + Gets a list of indices of the leftmost vertices in a ring. + + The hole ring + Index of the left most vertex + + + + Computes a triangulation of each polygon in a {@link Geometry}. + A polygon triangulation is a non-overlapping set of triangles which + cover the polygon and have the same vertices as the polygon. + The priority is on performance rather than triangulation quality, + so that the output may contain many narrow triangles. + + Holes are handled by joining them to the shell to form a + (self-touching) polygon shell with no holes. + Although invalid, this can be triangulated effectively. + + For better-quality triangulation use . + + + Martin Davis + + + + Computes a triangulation of each polygon in a geometry. + + A geometry containing polygons + A GeometryCollection containing the polygons + + + + Constructs a new triangulator. + + The input geometry + + + + Gets the triangulation as a of triangular s. + + A collection of the result triangle polygons + + + + Gets the triangulation as a list of s. + + The list of Tris in the triangulation + + + + Computes the triangulation of a single polygon + + A list of triangular polygons + + + + Improves the quality of a triangulation of s via + iterated Delaunay flipping. + This produces a Constrained Delaunay Triangulation + with the constraints being the boundary of the input triangulation. + + Martin Davis + + + + Improves the quality of a triangulation of {@link Tri}s via + iterated Delaunay flipping. + The Tris are assumed to be linked into a Triangulation + (e.g. via ). + + The list of Tris to improve + + + Improves a triangulation by examining pairs of adjacent triangles + (forming a quadrilateral) and testing if flipping the diagonal of + the quadrilateral would produce two new triangles with larger minimum + interior angles. + + The number of flips that were made + + + + Does a flip of the common edge of two Tris if the Delaunay condition is not met. + + A Tri + The index of the + true if the triangles were flipped + + + + Tests if the quadrilateral formed by two adjacent triangles is convex. + opp0-adj0-adj1 and opp1-adj1-adj0 are the triangle corners + and hence are known to be convex. + The quadrilateral is convex if the other corners opp0-adj0-opp1 + and opp1-adj1-opp0 have the same orientation (since at least one must be convex). + + The adjacent edge vertex 0 + The adjacent edge vertex 1 + The corner vertex of triangle 0 + The corner vertex of triangle 1 + true if the quadrilateral is convex + + + + Tests if either of a pair of adjacent triangles satisfy the Delaunay condition. + The triangles are opp0-adj0-adj1 and opp1-adj1-adj0. + The Delaunay condition is not met if one opposite vertex + lies is in the circumcircle of the other triangle. + + The adjacent edge vertex 0 + The adjacent edge vertex 1 + The corner vertex of triangle 0 + The corner vertex of triangle 1 + true if the triangles are Delaunay + + + + Tests whether a point p is in the circumcircle of a triangle abc + (oriented clockwise). + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point + true if the point is in the circumcircle + + + + A semi-static spatial index for points which occur + in a spatially-coherent sequence. + In particular, this is suitable for indexing the vertices + of a {@link LineString} or {@link Polygon} ring. + + The index is constructed in a batch fashion on a given sequence of coordinates. + Coordinates can be removed via the {@link #remove(int)} method. + + Note that this index queries only the individual points + of the input coordinate sequence, + not any line segments which might be lie between them. + + Martin Davis + + + + Number of items/nodes in a parent node. + Determined empirically. Performance is not too sensitive to this. + + + + + Creates a new tree over the given sequence of coordinates. + The sequence should be spatially coherent to provide query performance. + + A sequence of points + + + + Computes the level offsets. + This is the position in the bounds array of each level. + The levelOffsets array includes a sentinel value of offset[0] = 0. + The top level is always of size 1, + and so also indicates the total number of bounds. + + The level offsets + + + + Queries the index to find all items which intersect an extent. + The query result is a list of the indices of input coordinates + which intersect the extent. + + The query extent + An array of the indices of the input coordinates + + + + Removes the input item at the given index from the spatial index. + + Index the index of the item in the input + + + + A framework to visit sets of edge-connected s in breadth-first order + + Martin Davis + 1.0 + + + + Called to initialize the traversal queue with a given set of s + + a collection of QuadEdgeTriangle + + + + Subclasses call this method to perform the visiting process. + + + + + An interface for classes which locate an edge in a + which either contains a given V + or is an edge of a triangle which contains V. + Implementors may utilized different strategies for + optimizing locating containing edges/triangles. + + Martin Davis + + + + Interface for classes which process triangles visited during traversals of a + + + Martin Davis + + + + Visits a triangle during a traversal of a . An implementation of + this method may perform processing on the current triangle. It must also decide whether a + neighbouring triangle should be added to the queue so its neighbours are visited. Often it + will perform processing on the neighbour triangle as well, in order to mark it as processed + (visited) and/or to determine if it should be visited. Note that choosing not to + visit the neighbouring triangle is the terminating condition for many traversal algorithms. + In particular, if the neighbour triangle has already been visited, it should not be visited + again. + + the current triangle being processed + the index of the edge in the current triangle being traversed + a neighbouring triangle next in line to visit + true if the neighbour triangle should be visited + + + + An interface for algorithms which process the triangles in a . + + Martin Davis + 1.0 + + + + Visits the s of a triangle. + + an array of the 3 quad edges in a triangle (in CCW order) + + + + Locates s in a , + optimizing the search by starting in the + locality of the last edge found. + + Martin Davis + + + + Locates an edge e, such that either v is on e, or e is an edge of a triangle containing v. + The search starts from the last located edge and proceeds on the general direction of v. + + + + + A class that represents the edge data structure which implements the quadedge algebra. + The quadedge algebra was described in a well-known paper by Guibas and Stolfi, + "Primitives for the manipulation of general subdivisions and the computation of Voronoi diagrams", + ACM Transactions on Graphics, 4(2), 1985, 75-123. + + Each edge object is part of a quartet of 4 edges, + linked via their Rot references. + Any edge in the group may be accessed using a series of operations. + Quadedges in a subdivision are linked together via their Next references. + The linkage between the quadedge quartets determines the topology + of the subdivision. + + + The edge class does not contain separate information for vertices or faces; a vertex is implicitly + defined as a ring of edges (created using the Next field). + + + David Skea + Martin Davis + + + + Creates a new QuadEdge quartet from o to d. + + the origin Vertex + the destination Vertex + the new QuadEdge quartet + + + + Creates a new QuadEdge connecting the destination of a to the origin of + b, in such a way that all three have the same left face after the + connection is complete. Additionally, the data pointers of the new edge + are set. + + the connected edge + + + + Splices two edges together or apart. + Splice affects the two edge rings around the origins of a and b, and, independently, the two + edge rings around the left faces of a and b. + In each case, (i) if the two rings are distinct, + Splice will combine them into one, or (ii) if the two are the same ring, Splice will break it + into two separate pieces. Thus, Splice can be used both to attach the two edges together, and + to break them apart. + + an edge to splice + an edge to splice + + + + Turns an edge counterclockwise inside its enclosing quadrilateral. + + the quadedge to turn + + + + Quadedges must be made using {@link makeEdge}, + to ensure proper construction. + + + + + Gets the primary edge of this quadedge and its sym. + The primary edge is the one for which the origin + and destination coordinates are ordered + according to the standard ordering + + the primary quadedge + + + + Gets or sets the external data value for this edge. + + + an object containing external data + + + + + Marks this quadedge as being deleted. + This does not free the memory used by + this quadedge quartet, but indicates + that this edge no longer participates + in a subdivision. + + + + + Tests whether this edge has been deleted. + + true if this edge has not been deleted. + + + + Sets the connected edge + + edge + + + + Gets the dual of this edge, directed from its right to its left. + + Gets or Sets the rotated edge + + + + Gets the dual of this edge, directed from its left to its right. + + Gets the inverse rotated edge. + + + + Gets the edge from the destination to the origin of this edge. + + Gets the sym of the edge. + + + + Gets the next CCW edge around the origin of this edge. + + Gets the next linked edge. + + + + Gets the next CW edge around (from) the origin of this edge. + + Gets the previous edge. + + + + Gets the next CCW edge around (into) the destination of this edge. + + Get the next destination edge. + + + + Gets the next CW edge around (into) the destination of this edge. + + Get the previous destination edge. + + + + Gets the CCW edge around the left face following this edge. + + Gets the next left face edge. + + + + Gets the CCW edge around the left face before this edge. + + Get the previous left face edge. + + + + Gets the edge around the right face ccw following this edge. + + Gets the next right face edge. + + + + Gets the edge around the right face ccw before this edge. + + Gets the previous right face edge. + + + + Gets or sets the vertex for the edge's origin + + Gets the origin vertex + + + + Gets or sets the vertex for the edge's destination + + Gets the destination vertex + + + + Gets the length of the geometry of this quadedge. + + Gets the length of the quadedge + + + + Tests if this quadedge and another have the same line segment geometry, + regardless of orientation. + + a quadedge + true if the quadedges are based on the same line segment regardless of orientation + + + + Tests if this quadedge and another have the same line segment geometry + with the same orientation. + + a quadedge + true if the quadedges are based on the same line segment + + + + Creates a representing the + geometry of this edge. + + a LineSegment + + + + Converts this edge to a WKT two-point LINESTRING indicating + the geometry of this edge. + + a String representing this edge's geometry + + + + A class that contains the s representing a planar + subdivision that models a triangulation. + The subdivision is constructed using the + quadedge algebra defined in the class . + All metric calculations + are done in the class. + In addition to a triangulation, subdivisions + support extraction of Voronoi diagrams. + This is easily accomplished, since the Voronoi diagram is the dual + of the Delaunay triangulation. + + Subdivisions can be provided with a tolerance value. Inserted vertices which + are closer than this value to vertices already in the subdivision will be + ignored. Using a suitable tolerance value can prevent robustness failures + from happening during Delaunay triangulation. + + + Subdivisions maintain a frame triangle around the client-created + edges. The frame is used to provide a bounded "container" for all edges + within a TIN. Normally the frame edges, frame connecting edges, and frame + triangles are not included in client processing. + + + David Skea + Martin Davis + + + + Gets the edges for the triangle to the left of the given . + + + + if the edges do not form a triangle + + + + Creates a new instance of a quad-edge subdivision based on a frame triangle + that encloses a supplied bounding box. A new super-bounding box that + contains the triangle is computed and stored. + + the bounding box to surround + the tolerance value for determining if two sites are equal + + + + Gets the vertex-equality tolerance value + used in this subdivision + + Gets the tolerance value + + + + Gets the envelope of the Subdivision (including the frame). + + Gets the envelope + + + + Gets the collection of base s (one for every pair of + vertices which is connected). + + a collection of QuadEdges + + + + Sets the to use for locating containing triangles + in this subdivision. + + a QuadEdgeLocator + + + + Creates a new quadedge, recording it in the edges list. + + The origin vertex + The destination vertex + A new quadedge + + + + Creates a new QuadEdge connecting the destination of a to the origin of b, + in such a way that all three have the same left face after the connection + is complete. The quadedge is recorded in the edges list. + + A quadedge + A quadedge + A quadedge + + + + Deletes a quadedge from the subdivision. Linked quadedges are updated to + reflect the deletion. + + the quadedge to delete + + + + Locates an edge of a triangle which contains a location + specified by a Vertex v. + The edge returned has the + property that either v is on e, or e is an edge of a triangle containing v. + The search starts from startEdge amd proceeds on the general direction of v. + + + This locate algorithm relies on the subdivision being Delaunay. For + non-Delaunay subdivisions, this may loop for ever. + + the location to search for + an edge of the subdivision to start searching at + a QuadEdge which contains v, or is on the edge of a triangle containing v + + if the location algorithm fails to converge in a reasonable + number of iterations + + + + + Finds a quadedge of a triangle containing a location + specified by a , if one exists. + + the vertex to locate + a quadedge on the edge of a triangle which touches or contains the location
+ or null if no such triangle exists +
+
+ + + Finds a quadedge of a triangle containing a location + specified by a , if one exists. + + the Coordinate to locate + a quadedge on the edge of a triangle which touches or contains the location, + or null if no such triangle exists + + + + + Locates the edge between the given vertices, if it exists in the + subdivision. + + a coordinate + another coordinate + the edge joining the coordinates, if present, + or null if no such edge exists + + + + + Inserts a new site into the Subdivision, connecting it to the vertices of + the containing triangle (or quadrilateral, if the split point falls on an + existing edge). + + + + This method does NOT maintain the Delaunay condition. If desired, this must + be checked and enforced by the caller. + + + This method does NOT check if the inserted vertex falls on an edge. This + must be checked by the caller, since this situation may cause erroneous + triangulation + + + the vertex to insert + a new quad edge terminating in v + + + + Tests whether a QuadEdge is an edge incident on a frame triangle vertex. + + the edge to test + true if the edge is connected to the frame triangle + + + + Tests whether a QuadEdge is an edge on the border of the frame facets and + the internal facets. E.g. an edge which does not itself touch a frame + vertex, but which touches an edge which does. + + the edge to test + true if the edge is on the border of the frame + + + + Tests whether a vertex is a vertex of the outer triangle. + + the vertex to test + true if the vertex is an outer triangle vertex + + + + Tests whether a {@link Coordinate} lies on a {@link QuadEdge}, up to a + tolerance determined by the subdivision tolerance. + + a QuadEdge + a point + true if the vertex lies on the edge + + + + Tests whether a is the start or end vertex of a + , up to the subdivision tolerance distance. + + + + true if the vertex is a endpoint of the edge + + + + Gets the unique es in the subdivision, + including the frame vertices if desired. + + true if the frame vertices should be included + a collection of the subdivision vertices + + + + + Gets a collection of s whose origin + vertices are a unique set which includes + all vertices in the subdivision. + The frame vertices can be included if required. + + + This is useful for algorithms which require traversing the + subdivision starting at all vertices. + Returning a quadedge for each vertex + is more efficient than + the alternative of finding the actual vertices + using and then locating + quadedges attached to them. + + true if the frame vertices should be included + a collection of QuadEdge with the vertices of the subdivision as their origins + + + + Gets all primary quadedges in the subdivision. + A primary edge is a + which occupies the 0'th position in its array of associated quadedges. + These provide the unique geometric edges of the triangulation. + + true if the frame edges are to be included + a List of QuadEdges + + + + A TriangleVisitor which computes and sets the + circumcentre as the origin of the dual + edges originating in each triangle. + + mbdavis + + + + The quadedges forming a single triangle. + Only one visitor is allowed to be active at a + time, so this is safe. + + + + + Stores the edges for a visited triangle. Also pushes sym (neighbour) edges + on stack to visit later. + + + + + + the visited triangle edges,
+ or null if the triangle should not be visited (for instance, if it is outer) +
+
+ + + Gets a list of the triangles + in the subdivision, specified as + an array of the primary quadedges around the triangle. + + true if the frame triangles should be included + a List of QuadEdge[3] arrays + + + + Gets a list of the triangles in the subdivision, + specified as an array of the triangle es. + + true if the frame triangles should be included + a List of Vertex[3] arrays + + + + Gets the coordinates for each triangle in the subdivision as an array. + + true if the frame triangles should be included + a list of Coordinate[4] representing each triangle + + + + Gets the geometry for the edges in the subdivision as a + containing 2-point lines. + + the GeometryFactory to use + a MultiLineString + + + + Gets the geometry for the triangles in a triangulated subdivision as a + of triangular s. + + the GeometryFactory to use + a GeometryCollection of triangular Polygons + + + + Gets the cells in the Voronoi diagram for this triangulation. + The cells are returned as a of s + + + The userData of each polygon is set to be the + of the cell site. This allows easily associating external + data associated with the sites to the cells. + + a geometry factory + a GeometryCollection of Polygons + + + + Gets a List of s for the Voronoi cells + of this triangulation. + + + The UserData of each polygon is set to be the + of the cell site. This allows easily associating external + data associated with the sites to the cells. + + a geometry factory + a List of Polygons + + + + Gets the Voronoi cell around a site specified + by the origin of a QuadEdge. + + + The userData of the polygon is set to be the + of the site. This allows attaching external + data associated with the site to this cell polygon. + + a quadedge originating at the cell site + a factory for building the polygon + a polygon indicating the cell extent + + + + Models a triangle formed from s in a + which forms a triangulation. The class provides methods to access the + topological and geometric properties of the triangle and its neighbours in + the triangulation. Triangle vertices are ordered in CCW orientation in the + structure. + + + QuadEdgeTriangles support having an external data attribute attached to them. + Alternatively, this class can be subclassed and attributes can + be defined in the subclass. Subclasses will need to define + their own BuilderVisitor class + and CreateOn method. + + Martin Davis + 1.0 + + + + Creates s for all facets of a + representing a triangulation. + The data attributes of the s in the subdivision + will be set to point to the triangle which contains that edge. + This allows tracing the neighbour triangles of any given triangle. + + The QuadEdgeSubdivision to create the triangles on. + A List of the created QuadEdgeTriangles + + + + Tests whether the point pt is contained in the triangle defined by 3 es. + + an array containing at least 3 Vertexes + the point to test + true if the point is contained in the triangle + + + + Tests whether the point pt is contained in the triangle defined by 3 es. + + an array containing at least 3 QuadEdges + the point to test + true if the point is contained in the triangle + + + + Creates a new triangle from the given edges. + + An array of the edges of the triangle in CCW order + + + + Gets or sets the external data value for this triangle. + + + + + Gets the vertices for this triangle. + + a new array containing the triangle vertices + + + + Gets the index for the given edge of this triangle + + a QuadEdge + the index of the edge in this triangle,
+ or -1 if the edge is not an edge of this triangle +
+
+ + + Gets the index for the edge that starts at vertex v. + + the vertex to find the edge for + the index of the edge starting at the vertex,
+ or -1 if the vertex is not in the triangle +
+
+ + + + + + Tests whether this triangle is adjacent to the outside of the subdivision. + + true if the triangle is adjacent to the subdivision exterior + + + + Gets the triangles which are adjacent (include) to a + given vertex of this triangle. + + The vertex to query + A list of the vertex-adjacent triangles + + + + Gets the neighbours of this triangle. If there is no neighbour triangle, the array element is + null + + an array containing the 3 neighbours of this triangle + + + + Gets all edges which are incident on the origin of the given edge. + + the edge to start at + a List of edges which have their origin at the origin of the given + edge + + + + Algorithms for computing values and predicates + associated with triangles. + + + For some algorithms extended-precision + implementations are provided, which are more robust + (i.e. they produce correct answers in more cases). + Also, some more robust formulations of + some algorithms are provided, which utilize + normalization to the origin. + + Martin Davis + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + This test uses simple + double-precision arithmetic, and thus is not 100% robust. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + + + This test uses simple + double-precision arithmetic, and thus is not 100% robust. + However, by using normalization to the origin + it provides improved robustness and increased performance. + Based on code by J.R.Shewchuk. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Computes twice the area of the oriented triangle (a, b, c), i.e., the area is positive if the + triangle is oriented counterclockwise. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The area of the triangle defined by the points a, b, c + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + + + This method uses more robust computation. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + + + The computation uses arithmetic for robustness, but a faster approach. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Computes twice the area of the oriented triangle (a, b, c), i.e., the area + is positive if the triangle is oriented counterclockwise. + + + The computation uses {@link DD} arithmetic for robustness. + + a vertex of the triangle + a vertex of the triangle + a vertex of the triangle + The area of a triangle defined by the points a, b and c + + + + + + + + + + + + + + Computes the inCircle test using distance from the circumcentre. + Uses standard double-precision arithmetic. + + + In general this doesn't + appear to be any more robust than the standard calculation. However, there + is at least one case where the test point is far enough from the + circumcircle that this test gives the correct answer. +
+            LINESTRING (1507029.9878 518325.7547, 1507022.1120341457 518332.8225183258,
+            1507029.9833 518325.7458, 1507029.9896965567 518325.744909031)
+            
+
+ A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + The area of a triangle defined by the points a, b and c +
+ + + Models a site (node) in a . + The sites can be points on a line string representing a + linear site. + The vertex can be considered as a vector with a norm, length, inner product, cross + product, etc. Additionally, point relations (e.g., is a point to the left of a line, the circle + defined by this point and two others, etc.) are also defined in this class. + + It is common to want to attach user-defined data to + the vertices of a subdivision. + One way to do this is to subclass Vertex + to carry any desired information. + + David Skea + Martin Davis + + + + Creates an instance of this class using the given x- and y-ordinate valuse + + x-ordinate value + y-ordinate value + + + + Creates an instance of this class using the given x-, y- and z-ordinate values + + x-ordinate value + y-ordinate value + z-ordinate value + + + + Creates an instance of this class using a clone of the given . + + The coordinate + + + + Gets the x-ordinate value + + + + + Gets the y-ordinate value + + + + + Gets the z-ordinate value + + + + + Gets the coordinate + + + + + + + + Computes the cross product k = u X v. + + a vertex + returns the magnitude of u X v + + + + Computes the inner or dot product + + A vertex + The dot product u.v + + + + Computes the scalar product c(v) + + A vertex + The scaled vector + + + + Tests if this is inside the circle defined by the points a, b, c. This test uses simple + double-precision arithmetic, and thus may not be robust. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + true if this vertex is inside the circumcircle (a, b, c) + + + + Tests whether the triangle formed by this vertex and two + other vertices is in CCW orientation. + + a vertex + a vertex + true if the triangle is oriented CCW + + + + Computes the value of the ratio of the circumradius to shortest edge. If smaller than some + given tolerance B, the associated triangle is considered skinny. For an equal lateral + triangle this value is 0.57735. The ratio is related to the minimum triangle angle theta by: + circumRadius/shortestEdge = 1/(2sin(theta)). + + second vertex of the triangle + third vertex of the triangle + ratio of circumradius to shortest edge. + + + + returns a new vertex that is mid-way between this vertex and another end point. + + the other end point. + the point mid-way between this and that. + + + + Computes the centre of the circumcircle of this vertex and two others. + + + + the Coordinate which is the circumcircle of the 3 points. + + + + For this vertex enclosed in a triangle defined by three vertices v0, v1 and v2, interpolate + a z value from the surrounding vertices. + + + + + Interpolates the Z-value (height) of a point enclosed in a triangle + whose vertices all have Z values. + The containing triangle must not be degenerate + (in other words, the three vertices must enclose a + non-zero area). + + The point to interpolate the Z value of + A vertex of a triangle containing the + A vertex of a triangle containing the + A vertex of a triangle containing the + The interpolated Z-value (height) of the point + + + + Computes the interpolated Z-value for a point p lying on the segment p0-p1 + + The point to interpolate the Z value of + A vertex of the segment is lying on + A vertex of the segment is lying on + The interpolated Z-value (height) of the point + + + + Models a constraint segment in a triangulation. + A constraint segment is an oriented straight line segment between a start point + and an end point. + + David Skea + Martin Davis + + + + + Creates a new instance for the given ordinates. + + + + + Creates a new instance for the given ordinates, with associated external data. + + + + + Creates a new instance for the given points, with associated external data. + + the start point + the end point + an external data object + + + + Creates a new instance for the given points. + + the start point + the end point + + + + Gets the start coordinate of the segment + + a Coordinate + + + + Gets the end coordinate of the segment + + a Coordinate + + + + Gets the start X ordinate of the segment + + the X ordinate value + + + + Gets the start Y ordinate of the segment + + the Y ordinate value + + + + Gets the start Z ordinate of the segment + + the Z ordinate value + + + + Gets the end X ordinate of the segment + + the X ordinate value + + + + Gets the end Y ordinate of the segment + + he Y ordinate value + + + + Gets the end Z ordinate of the segment + + the Z ordinate value + + + + Gets a LineSegment modelling this segment. + + a LineSegment + + + + Gets or sets the external data associated with this segment + + a data object + + + + Determines whether two segments are topologically equal. + I.e. equal up to orientation. + + a segment + true if the segments are topologically equal + + + + Computes the intersection point between this segment and another one. + + a segment + the intersection point, or null if there is none + + + + Computes a string representation of this segment. + + a string + + + + Models a constraint segment which can be split in two in various ways, + according to certain geometric constraints. + + Martin Davis + + + + Computes the {@link Coordinate} that lies a given fraction along the line defined by the + reverse of the given segment. A fraction of 0.0 returns the end point of the + segment; a fraction of 1.0 returns the start point of the segment. + + the LineSegment + the fraction of the segment length along the line + the point at that distance + + + + A memory-efficient representation of a triangle in a triangulation. + Contains three vertices, and links to adjacent Tris for each edge. + Tris are constructed independently, and if needed linked + into a triangulation using . + + An edge of a Tri in a triangulation is called a boundary edge + if it has no adjacent triangle.
+ The set of Tris containing boundary edges are called the triangulation border. +
+ Martin Davis +
+ + + Creates a of s + representing the triangles in a list. + + A list of Tris + The GeometryFactory to use + The Polygons for the triangles + + + + Computes the area of a set of Tris. + + A set of tris + The total area of the triangles + + + + Validates a list of Tris. + + The list of Tris to validate + + + + Creates a triangle with the given vertices. + The vertices should be oriented clockwise. + + The first triangle vertex + The second triangle vertex + The third triangle vertex + The created trianlge + + + + Creates a triangle from an array with three vertex coordinates. + The vertices should be oriented clockwise. + + The array of vertex coordinates + The created triangle + + + + Creates a triangle with the given vertices. + The vertices should be oriented clockwise. + + The first triangle vertex + The second triangle vertex + The third triangle vertex + + + + Sets the adjacent triangles.
+ The vertices of the adjacent triangles are + assumed to match the appropriate vertices in this triangle. +
+ The triangle adjacent to edge 0 + The triangle adjacent to edge 1 + The triangle adjacent to edge 2 +
+ + + Sets the triangle adjacent to the edge originating + at a given vertex.
+ The vertices of the adjacent triangles are + assumed to match the appropriate vertices in this triangle. +
+ The edge start point + The adjacent triangle +
+ + + Sets the triangle adjacent to an edge.
+ The vertices of the adjacent triangle are + assumed to match the appropriate vertices in this triangle. +
+ The edge triangle is adjacent to + The adjacent triangle +
+ + + Splits a triangle by a point located inside the triangle. + Creates the three new resulting triangles with adjacent links + set correctly. + Returns the new triangle whose 0'th vertex is the splitting point. + + The point to insert + The new triangle whose 0'th vertex is + + + + Interchanges the vertices of this triangle and a neighbor + so that their common edge + becomes the the other diagonal of the quadrilateral they form. + Neighbour triangle links are modified accordingly. + + The index of the adjacent tri to flip with + + + + Replaces an adjacent triangle with a different one. + + An adjacent triangle + The triangle to replace with + + + + Computes the degree of a Tri vertex, which is the number of tris containing it. + This must be done by searching the entire triangulation, + since the containing tris may not be adjacent or edge-connected. + + The vertex index + The triangulation + The degree of the vertex + + + + Removes this tri from the triangulation containing it. + All links between the tri and adjacent ones are nulled. + + The triangulation + + + + Removes this triangle from a triangulation. + All adjacent references and the references to this + Tri in the adjacent Tris are set to null. + + + + + Gets the triangles adjacent to the quadrilateral + formed by this triangle and an adjacent one. + The triangles are returned in the following order: + + Order: + + opp0-adj0 edge + opp0-adj1 edge + opp1-adj0 edge + opp1-adj1 edge + + + An adjacent triangle + The index of the common edge in this triangle + The index of the common edge in the adjacent triangle + + + + + Validates that a is correct. + Currently just checks that orientation is CW. + + Thrown if is not valid + + + + Validates that the vertices of an adjacent linked triangle are correct. + + The index of the adjacent triangle + + + + Gets the coordinate for a vertex. + This is the start vertex of the edge. + + The vertex (edge) index + The vertex coordinate + + + + Gets the index of the triangle vertex which has a given coordinate (if any). + This is also the index of the edge which originates at the vertex. + + The coordinate to find + The vertex index, or -1 if it is not in the triangle + + + + Gets the edge index which a triangle is adjacent to (if any), + based on the adjacent triangle link. + + The Tri to find + The index of the edge adjacent to the triangle, or -1 if not found + + + + Gets the triangle adjacent to an edge. + + The edge index + The adjacent triangle (may be null) + + + + Tests if this tri has any adjacent tris. + + true if there is at least one adjacent tri + + + + Tests if there is an adjacent triangle to an edge. + + The edge index + true if there is a triangle adjacent to edge + + + + Tests if a triangle is adjacent to some edge of this triangle. + + The triangle to test + true if the triangle is adjacent + + + + + Computes the number of triangle adjacent to this triangle. + This is a number in the range [0,2]. + The number of adjacent triangles + + + + Tests if a tri vertex is interior. + A vertex of a triangle is interior if it + is fully surrounded by other triangles. + + The vertex index + true if the vertex is interior + + + + Tests if a tri contains a boundary edge, + and thus on the border of the triangulation containing it. + + true if the tri is on the border of the triangulation + + + + Tests if an edge is on the boundary of a triangulation. + + The index of an edge + true if the edge is on the boundary + + + + Computes the vertex or edge index which is the next one + (counter-clockwise) around the triangle. + + The index + The next index value + + + + Computes the vertex or edge index which is the previous one + (counter-clockwise) around the triangle. + + The index + The previous index value + + + + Gets the index of the vertex opposite an edge. + + The edge index + The index of the opposite vertex + + + + Gets the index of the edge opposite a vertex. + + The index of the vertex + The index of the opposite edge + + + + Computes a coordinate for the midpoint of a triangle edge. + + The edge index + the midpoint of the triangle edge + + + Gets the area of the triangle. + The area of the triangle + + + + Gets the length of the perimeter of the triangle. + + + + + Creates a representing this triangle. + + The geometry factory + A polygon + + + + + + + Builds a triangulation from a set of s + by populating the links to adjacent triangles. + + Martin Davis + + + + Computes the triangulation of a set of s. + + An enumeration of s + + + + Creates an instance of this class and computes the triangulation of a set of s. + + An enumeration of s + + + + Represents an edge in a , + to be used as a key for looking up Tris + while building a triangulation. + The edge value is normalized to allow lookup + of adjacent triangles. + + Martin Davis + + + + Gets or sets a value indicating the start point of this + + + + + Gets or sets a value indicating the end point of this + + + + + Creates an instance of this class + + A coordinate + A coordinate + + + + Creates a map between the vertex s of a + set of s, + and the parent geometry, and transfers the source geometry + data objects to geometry components tagged with the coordinates. + + + This class can be used in conjunction with + to transfer data objects from the input site geometries + to the constructed Voronoi polygons. + + Martin Davis + + + + + Loads the vertices of a geometry and maps them with th the . + + A geometry + + + + Loads the vertices of a collection of geometries and maps them with the . + + A collection of geometry + + + + Loads the vertices of the geometries of a GeometryCollection and maps them with the . + + A GeometryCollection + + + + Gets a value indicating the coordinates. + + A list of Coordinates. + + + + Input is assumed to be a multiGeometry + in which every component has its userData + set to be a Coordinate which is the key to the output data. + The Coordinate is used to determine + the output data object to be written back into the component. + + + + + + A utility class which creates Voronoi Diagrams + from collections of points. + The diagram is returned as a of s, + representing the faces of the Voronoi diagram. + /// The faces are clipped to the larger of: + + + an envelope supplied by . + + + an envelope determined by the input sites. + + + The userData attribute of each face Polygon is set to + the Coordinate of the corresponding input site. + This allows using a Map to link faces to data associated with sites. + + Martin Davis + + + + Sets the sites (point or vertices) which will be diagrammed. + All vertices of the given geometry will be used as sites. + + geom the geometry from which the sites will be extracted. + + + + Sets the sites (point or vertices) which will be diagrammed + from a collection of s. + + a collection of Coordinates. + + + + Sets the envelope to clip the diagram to. + The diagram will be clipped to the larger + of this envelope or an envelope surrounding the sites. + + the clip envelope. + + + + Sets the snapping tolerance which will be used + to improved the robustness of the triangulation computation. + A tolerance of 0.0 specifies that no snapping will take place. + + tolerance the tolerance distance to use + + + + Gets the which models the computed diagram. + + the subdivision containing the triangulation + + + + Gets the faces of the computed diagram as a + of s, clipped as specified. + + The attribute of each face is set to + the Coordinate of the corresponding input site. + This allows using a to link faces to data associated with sites. + + the geometry factory to use to create the output + a containing the face s of the diagram + + + + An alternative implementation of the priority queue abstract data type. + This allows us to do more than , which we + got from JTS. Ultimately, this queue enables scenarios that have more + favorable execution speed characteristics at the cost of less favorable + memory and usability characteristics. + + + The type of the priority for each queue node. + + + The type of data stored in the queue. + + + When enumerating over the queue, note that the elements will not be in + sorted order. To get at the elements in sorted order, use the copy + constructor and repeatedly elements from it. + + + + + Initializes a new instance of the + class. + + + + + Initializes a new instance of the + class. + + + The initial queue capacity. + + + is less than 1. + + + + + Initializes a new instance of the + class. + + + The to use to compare priority values, + or to use the default comparer for the type. + + + + + Initializes a new instance of the + class. + + + The initial queue capacity. + + + The to use to compare priority values, + or to use the default comparer for the type. + + + is less than 1. + + + + + Initializes a new instance of the + class. + + + The to + copy from. + + + is . + + + + + Gets the number of nodes currently stored in this queue. + + + + + Gets the node at the head of the queue. + This is the node whose compares + less than or equal to the priority of all other nodes in the queue. + + + + + Removes all nodes from this queue. + + + + + Determines whether the given node is contained within this queue. + + + The node to locate in the queue. + + + if is found in the + queue, otherwise . + + + + + Adds a given node to the queue with the given priority. + + + The node to add to the queue. + + + The priority for the node. + + + is . + + + + + Removes and returns the head of the queue. + + + The removed element. + + + + + Changes the priority of the given node. + + + The node whose priority to change. + + + The new priority for the node. + + + is . + + + + + Removes the given node from this queue if it is present. + + + The node to remove if present. + + + A value indicating whether the node was removed. + + + + + + + + + + + A utility for making programming assertions. + + + + + Tests if is true + + If the test fails, with no message is thrown. + + The assertion value + + + + Tests if is true + + If the test fails, with is thrown. + + The assertion value + A message describing the failure condition. + + + + Tests if two values are equal. + + If the test fails, with no specific message is thrown. + + The expected value + The actual value + + + + Tests if two values are equal. + + If the test fails, with is thrown. + + The expected value + The actual value + A message describing the failure condition. + + + + Throws an with no specific message text. + + + + + Throws an with as specific message text. + + A text describing the failure condition + + + + + + + + + + + + + + + + + + + + A CoordinateFilter that creates an array containing every coordinate in a Geometry. + + + + + Constructs a CoordinateArrayFilter. + + The number of points that the CoordinateArrayFilter will collect. + + + + Returns the Coordinates collected by this CoordinateArrayFilter. + + + + + + + + + + + CoordinateCompare is used in the sorting of arrays of Coordinate objects. + Implements a lexicographic comparison. + + + + + Compares two object and returns a value indicating whether one is less than, equal to or greater + than the other. + + First Coordinate object to compare. + Second Coordinate object to compare. + + <table cellspacing="0" class="dtTABLE"> + <TR VALIGN="top"> + <TH width=50%>Value</TH> + <TH width=50%>Condition</TH> + </TR> + <TR VALIGN="top"> + <TD width=50%>Less than zero</TD> + <TD width=50%><I>a</I> is less than <I>b</I>.</TD> + </TR> + <TR VALIGN="top"> + <TD width=50%>Zero</TD> + <TD width=50%><I>a</I> equals <I>b</I>.</TD> + </TR> + <TR VALIGN="top"> + <TD width=50%>Greater than zero</TD> + <TD width=50%><I>a</I> is greater than <I>b</I>.</TD> + </TR> + </table> + + If a implements IComparable, then a. CompareTo (b) is returned; otherwise, if b + implements IComparable, then b. CompareTo (a) is returned. + Comparing a null reference (Nothing in Visual Basic) with any type is allowed and does not + generate an exception when using IComparable. When sorting, a null reference (Nothing) is + considered to be less than any other object. + + + + + A CoordinateFilter that counts the total number of coordinates + in a Geometry. + + + + + Returns the result of the filtering. + + + + + + + + + + + Converts degrees to radians. + + + + + Converts degrees to radians. + + The angle in degrees. + The angle in radians. + + + + A utility class to get s, s + off of s or to build aggregate geometries. + + + + + Gets a default envelope + + + + + Gets the envelope of a geometry. + + A geometry + The envelope of or if g == null. + + + + Function to get the geometry factory of a geometry. If + is null, a default geometry + factory is returned. + + A geometry + A geometry factory + + + + Function to get the geometry factory of the first + geometry in a series of geometries. + If no geometry is provided in , + a default geometry factory is returned. + + An enumeration of geometries + A geometry factory + + + + Builds a geometry from a list of geometries. + + The function returns + + nullif the list is null or empty + [0]if the list contains one single item. + a if is a GeometryCollection. + a Multi-geometry in all other cases. + + + A list of geometries. + A parent geometry + A geometry. + + + + Builds a geometry from a list of geometries. + + The function returns + + nullif the list is null or empty + [0]if the list contains one single item. + a if is a GeometryCollection. + a Multi-geometry in all other cases. + + + A list of geometries. + A parent geometry + A geometry. + + + + Method to build a geometry. + + An array of geometries + A GEOMETRYCOLLECTION containing . + + + + Method to build a geometry. + + A geometry + A geometry + A GEOMETRYCOLLECTION containing and . + + + + Computes various kinds of common geometric shapes. + Allows various ways of specifying the location and extent of the shapes, + as well as number of line segments used to form them. + + + + + A geometry factory + + + + + A precision model + + + + + + Create a shape factory which will create shapes using the default GeometryFactory. + + + + + Create a shape factory which will create shapes using the given GeometryFactory. + + The factory to use. + + + + Gets/Sets the location of the shape by specifying the base coordinate + (which in most cases is the + lower left point of the envelope containing the shape). + + + + + Gets/Sets the location of the shape by specifying the centre of + the shape's bounding box. + + + + + Gets or sets the envelope of the shape + + + + + Gets/Sets the total number of points in the created Geometry. + + + + + Gets/Sets the size of the extent of the shape in both x and y directions. + + + + + Gets/Sets the width of the shape. + + + + + Gets/Sets the height of the shape. + + + + + Gets/Sets the rotation angle, in radians, to use for the shape. + The rotation is applied relative to the centre of the shape. + + + + + Rotates a geometry by angle + + The geometry to rotate + A rotated geometry + + + + Creates a coordinate at (, ) + + The x-ordinate value + The y-ordinate value + A coordinate + + + + Creates a translated coordinate at ( + , + ) + + The x-ordinate value + The y-ordinate value + A translation vector (coordinate) + A coordinate + + + + Creates a rectangular Polygon. + + A rectangular polygon. + + + + Creates a circular Polygon. + + A circular polygon. + + + + Creates an elliptical Polygon. + If the supplied envelope is square the + result will be a circle. + + An an ellipse or circle. + + + + Creates a squircular . + + a squircle + + + + Creates a supercircular + of a given positive power. + + a supercircle + + + + Creates a elliptical arc, as a LineString. + + The arc is always created in a counter-clockwise direction. + + Start angle in radians + Size of angle in radians + + + + + Creates an elliptical arc polygon. + + + The polygon is formed from the specified arc of an ellipse + and the two radii connecting the endpoints to the centre of the ellipse. + + Start angle in radians + Size of angle in radians + An elliptical arc polygon + + + + A dimension class for s + + + + + Gets or sets a value indicating the base of the shapes to be created + + + + + Gets or sets a value indicating the centre of the shapes to be created + + + + + Gets or sets a value indicating the width of the . + + + + + Gets or sets a value indicating the height of the . + + + + + Sets and to the same value + + + + + Gets a value indicating the minimum size of the shape's + + + + + Gets or sets a value indicating the bounds of the shape to be created + + + + + + + + + + + + + + + + + + + + + + + + + + A guard class + + + + + Checks if a value is not null. + + The value to check for null + The name of the property that belongs to. + + + + + + + + + Only static methods! + + + + + Convert the given numeric value (passed as string) of the base specified by baseIn + to the value specified by baseOut. + + Numeric value to be converted, as string. + Base of input value. + Base to use for conversion. + Converted value, as string. + + + + Utility functions to report memory usage. + + mbdavis + + + + Gets a value indicating the total memory used. + + + + + Gets a string describing the total memory used + + + + + Number of bytes in a kilo-byte + + + + + Number of bytes in mega-byte + + + + + Number of bytes in a giga-byte + + + + + Formats a number of bytes + + The number of bytes + A string describing a number of bytes + + + + Rounds a double to 2 decimal places + + The number to round + The rounded number + + + + A priority queue over a set of objects. + + Objects to add + Martin Davis + + + + Creates an instance of this class + + + + + Creates an instance of this class + + The capacity of the queue + The comparer to use for computing priority values + + + Insert into the priority queue. Duplicates are allowed. + + The item to insert. + + + + Test if the priority queue is logically empty. + + true if empty, false otherwise. + + + + Returns size. + + + + + Make the priority queue logically empty. + + + + + Remove the smallest item from the priority queue. + + The smallest item, or default(T) if empty. + + + + Gets the smallest item without removing it from the queue + + + + + > + + + + A container for a prioritized node that sites in an + . + + + The type to use for the priority of the node in the queue. + + + The type to use for the data stored by the node in the queue. + + + + + Initializes a new instance of the class. + + + The to store in this node. + + + + + Gets the that is stored in this node. + + + + + Gets the of this node in the queue. + + + The queue may update this priority while the node is still in the queue. + + + + + Gets or sets the index of this node in the queue. + + + This should only be read and written by the queue itself. + It has no "real" meaning to anyone else. + + + + + Converts radians to degress. + + + + + Converts radians to degress. + + Angle in radians. + The angle in degrees. + + + + + + + + + + + + + + + + + A + that extracts a unique array ofCoordinate s. + The array of coordinates contains no duplicate points. + + It preserves the order of the input points. + + + + + Convenience method which allows running the filter over an array of s. + + an array of coordinates + an array of the unique coordinates + + + + Returns the gathered s. + + The Coordinates collected by this ICoordinateArrayFilter + + + + + + + Buffer for characters. This approximates StringBuilder + but is designed to be faster for specific operations. + This is about 30% faster for the operations I'm interested in + (Append, Clear, Length, ToString). + This trades off memory for speed. + + + To make Remove from the head fast, this is implemented + as a ring buffer. + This uses head and tail indices into a fixed-size + array. This will grow the array as necessary. + + + + + Gets/Sets the number of characters in the character buffer. + Increasing the length this way provides indeterminate results. + + + + + Returns the capacity of this character buffer. + + + + + Default constructor. + + + + + Construct with a specific capacity. + + + + + + Reallocate the buffer to be larger. For the new size, this + uses the max of the requested length and double the current + capacity. + This does not shift, meaning it does not change the head or + tail indices. + + The new requested length. + + + + Ensure that we're set for the requested length by + potentially growing or shifting contents. + + + + + + Move the buffer contents such that headIndex becomes 0. + + + + + Overwrite this object's underlying buffer with the specified + buffer. + + The character array. + The number of characters to consider filled + in the input buffer. + + + + Append a character to this buffer. + + + + + + Append a string to this buffer. + + The string to append. + + + + Append a string to this buffer. + + The string to append. + + + + Remove a character at the specified index. + + The index of the character to remove. + + + + + Remove a specified number of characters at the specified index. + + The index of the characters to remove. + The number of characters to remove. + + + + Find the first instance of a character in the buffer, and + return its index. This returns -1 if the character is + not found. + + The character to find. + The index of the specified character, or -1 + for not found. + + + + Empty the buffer. + + + + + Indexer. + + + + + Return the current contents as a string. + + The new string. + + + + Exception class for unterminated tokens. + + + + + Construct with a particular message. + + The message to store in this object. + + + + Exception class for unterminated quotes. + + + + + Construct with a particular message. + + The message to store in this object. + + + + Exception class for unterminated block comments. + + + + + Construct with a particular message. + + The message to store in this object. + + + + Bitwise enumeration for character types. + + + + word characters (usually alpha, digits, and domain specific) + + + # or something for line comments + + + whitespace + + + ' or " type + + + usually 0 to 9 + + + usually 0 to 9, a-f and A-F + + + eof char + + + + This contains the settings that control the behavior of the tokenizer. + This is separated from the StreamTokenizer so that common settings + are easy to package and keep together. + + + + + This is the character type table. Each byte is bitwise encoded + with the character attributes, such as whether that character is + word or whitespace. + + + + + Whether or not to return whitespace tokens. If not, they're ignored. + + + + + Whether or not to return EolTokens on end of line. Eol tokens will not + break up other tokens which can be multi-line. For example block comments + and quotes will not be broken by Eol tokens. Therefore the number of + Eol tokens does not give you the line count of a stream. + + + + + Whether or not to look for // comments + + + + + Whether or not to look for /* */ block comments. + + + + + Whether or not to return comments. + + + + + Whether or not to check for unterminated quotes and block comments. + If true, and one is encoutered, an exception is thrown of the appropriate type. + + + + + Whether or not digits are specified as Digit type in the + character table. + This setting is based on the character types table, so this + setting interacts with character type table manipulation. + This setting may become incorrect if you modify the character + types table directly. + + + + + Whether or not to parse Hex (0xABCD...) numbers. + This setting is based on the character types table, so this + setting interacts with character type table manipulation. + + + + + Default constructor. + + + + + Copy constructor. + + + + + Sets this object to be the same as the specified object. + Note that some settings which are entirely embodied by the character + type table. + + + + + Setup default parse behavior. + This resets to same behavior as on construction. + + bool - true for success. + + + + Apply settings which are commonly used for code parsing + C-endCapStyle code, including C++, C#, and Java. + + + + + + Clear the character type settings. This leaves them unset, + as opposed to the default. Use SetDefaults() for default + settings. + + + + + Specify that a particular character is a word character. + Character table type manipulation method. + This adds the type to the char(s), rather + than overwriting other types. + + The character. + + + + Specify that a range of characters are word characters. + Character table type manipulation method. + This adds the type to the char(s), rather + than overwriting other types. + + First character. + Last character. + + + + Specify that a string of characters are word characters. + Character table type manipulation method. + This adds the type to the char(s), rather + than overwriting other types. + + + + + + Specify that a character is a whitespace character. + Character table type manipulation method. + This type is exclusive with other types. + + The character. + + + + Specify that a range of characters are whitespace characters. + Character table type manipulation method. + This adds the characteristic to the char(s), rather + than overwriting other characteristics. + + First character. + Last character. + + + + Remove other type settings from a range of characters. + Character table type manipulation method. + + + + + + + Remove other type settings from a character. + Character table type manipulation method. + + + + + + Specify that a particular character is a comment-starting character. + Character table type manipulation method. + + + + + + Specify that a particular character is a quote character. + Character table type manipulation method. + + + + + + Return a string representation of a character type setting. + Since the type setting is bitwise encoded, a character + can have more than one type. + + The character type byte. + The string representation of the type flags. + + + + Check whether the specified char type byte has a + particular type flag set. + + The char type byte. + The CharTypeBits entry to compare to. + bool - true or false + + + + Check whether the specified char has a + particular type flag set. + + The character. + The CharTypeBits entry to compare to. + bool - true or false + + + + Check whether the specified char has a + particular type flag set. + + The character. + The CharTypeBits entry to compare to. + bool - true or false + + + + Display the state of this object. + + + + + Display the state of this object, with a per-line prefix. + + The pre-line prefix. + + + + A StreamTokenizer similar to Java's. This breaks an input stream + (coming from a TextReader) into Tokens based on various settings. The settings + are stored in the TokenizerSettings property, which is a + StreamTokenizerSettings instance. + + + + This is configurable in that you can modify TokenizerSettings.CharTypes[] array + to specify which characters are which type, along with other settings + such as whether to look for comments or not. + + + WARNING: This is not internationalized. This treats all characters beyond + the 7-bit ASCII range (decimal 127) as Word characters. + + + There are two main ways to use this: 1) Parse the entire stream at + once and get an ArrayList of Tokens (see the Tokenize* methods), + and 2) call NextToken() successively. + This reads from a TextReader, which you can set directly, and this + also provides some convenient methods to parse files and strings. + This returns an Eof token if the end of the input is reached. + + + Here's an example of the NextToken() endCapStyle of use: + + StreamTokenizer tokenizer = new StreamTokenizer(); + tokenizer.GrabWhitespace = true; + tokenizer.Verbosity = VerbosityLevel.Debug; // just for debugging + tokenizer.TextReader = File.OpenText(fileName); + Token token; + while (tokenizer.NextToken(out token)) log.Info("Token = '{0}'", token); + + + + Here's an example of the Tokenize... endCapStyle of use: + + StreamTokenizer tokenizer = new StreamTokenizer("some string"); + ArrayList tokens = new ArrayList(); + if (!tokenizer.Tokenize(tokens)) + { + // error handling + } + foreach (Token t in tokens) Console.WriteLine("t = {0}", t); + + + + Comment delimiters are hardcoded (// and /*), not affected by char type table. + + + This sets line numbers in the tokens it produces. These numbers are normally + the line on which the token starts. + There is one known caveat, and that is that when GrabWhitespace setting + is true, and a whitespace token contains a newline, that token's line number + will be set to the following line rather than the line on which the token + started. + + + + + + This is the number of characters in the character table. + + + + + This is the TextReader that this object will read from. + Set this to set the input reader for the parse. + + + + + The settings which govern the behavior of the tokenization. + + + + + Default constructor. + + + + + Construct and set this object's TextReader to the one specified. + + The TextReader to read from. + + + + Construct and set this object's TextReader to the one specified. + + The TextReader to read from. + Tokenizer settings. + + + + Construct and set a string to tokenize. + + The string to tokenize. + + + + Utility function, things common to constructors. + + + + + Clear the stream settings. + + + + + Display the state of this object. + + + + + Display the state of this object, with a per-line prefix. + + The pre-line prefix. + + + + The states of the state machine. + + + + + Pick the next state given just a single character. This is used + at the start of a new token. + + The type of the character. + The character. + The state. + + + + Pick the next state given just a single character. This is used + at the start of a new token. + + The type of the character. + The character. + Exclude this state from the possible next state. + The state. + + + + Read the next character from the stream, or from backString + if we backed up. + + The next character. + + + + Get the next token. The last token will be an EofToken unless + there's an unterminated quote or unterminated block comment + and Settings.DoUntermCheck is true, in which case this throws + an exception of type StreamTokenizerUntermException or sub-class. + + The output token. + bool - true for success, false for failure. + + + + Starting from current stream location, scan forward + over an int. Determine whether it's an integer or not. If so, + push the integer characters to the specified CharBuffer. + If not, put them in backString (essentially leave the + stream as it was) and return false. + + If it was an int, the stream is left 1 character after the + end of the int, and that character is output in the thisChar parameter. + + The formats for integers are: 1, +1, and -1 + The + and - signs are included in the output buffer. + + The CharBuffer to append to. + Whether or not to consider + to be part + of an integer. + The last character read by this method. + true for parsed an int, false for not an int + + + + Parse the rest of the stream and put all the tokens + in the input ArrayList. This resets the line number to 1. + + The ArrayList to append to. + bool - true for success + + + + Parse all tokens from the specified TextReader, put + them into the input ArrayList. + + The TextReader to read from. + The ArrayList to append to. + bool - true for success, false for failure. + + + + Parse all tokens from the specified file, put + them into the input ArrayList. + + The file to read. + The ArrayList to put tokens in. + bool - true for success, false for failure. + + + + Tokenize a file completely and return the tokens in a Token[]. + + The file to tokenize. + A Token[] with all tokens. + + + + Parse all tokens from the specified string, put + them into the input ArrayList. + + + The ArrayList to put tokens in. + bool - true for success, false for failure. + + + + Parse all tokens from the specified Stream, put + them into the input ArrayList. + + + The ArrayList to put tokens in. + bool - true for success, false for failure. + + + + Gibt einen Enumerator zurück, der die Auflistung durchläuft. + + + Ein , der zum Durchlaufen der Auflistung verwendet werden kann. + + 1 + + + + Gibt einen Enumerator zurück, der eine Auflistung durchläuft. + + + Ein -Objekt, das zum Durchlaufen der Auflistung verwendet werden kann. + + 2 + + + + Token class used by StreamTokenizer. + This represents a single token in the input stream. + This is subclassed to provide specific token types, + such as CharToken, FloatToken, etc. + + + + + The line number in the input stream where this token originated. + This is base-1. + + + + + The line number where this token was found. This is base-1. + + + + + A storage object for the data of this token. + + + + + The Object stored by this token. This will be + a primitive C# type. + + + + + Backer for UntermError. + + + + + Whether or not there was an unterminated token problem + when creating this token. See UntermErrorMessage for + a message associated with the problem. + + + + An error message associated with unterm error. + + + + The error message if there was an unterminated token error + creating this token. + + + + + Construct a Token with the specified line number. + + The line number where this + token comes from. + + + + Equals override. + + The object to compare to. + bool - true for equals, false otherwise. + + + + Equals overload. + + The string to compare to. + bool + + + + Equals overload. + + The char to compare to. + bool + + + + Operator== overload. Compare a token and an object. + + The token to compare. + The other object. + bool + + + + Operator!= overload. Compare a token and an object. + + The token to compare. + The other object. + bool + + + + Operator== overload. Compare a token and a char. + + The token to compare. + The char. + bool + + + + Operator!= overload. Compare a token and a char. + + The token to compare. + The char. + bool + + + + Operator== overload. Compare a token and a string. + + The token to compare. + The string. + bool + + + + Operator!= overload. Compare a token and a string. + + The token to compare. + The string. + bool + + + + Override. Returns the ToString().GetHashCode(). + + The hash code. + + + + Return this token's value as a string. + + This token's value as a string. + + + + Produce a string which includes the line number. + + + + + + Produce a string which includes the token type. + + + + + + Create an object of the specified type corresponding to + this token. + + The type of object to create. + The new object, or null for error. + + + + Represents end-of-lines (line separator characters). + + + + Default constructor. + + + Constructor that takes line number. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Represents end of file/stream. + + + + Default constructor. + + + Constructor that takes line number. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Abstract base class for string tokens. + + + + Default constructor. + + + Constructor with the specified value + and line number. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Token type for words, meaning sequences of word + characters. + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for Quotes such as "this is a quote". + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for comments, including line and block + comments. + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for whitespace such as spaces and tabs. + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for characters, meaning non-word characters. + + + + Constructor with the specified value + and line number. + + + Constructor with the specified value. + + + Constructor with the specified value. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Token type for floating point numbers, stored internally as a Double. + + + + + Constructor with the specified value. + + + + + Constructor with the specified value. + + + + + Constructor with the specified value. + + + + + Constructor with the specified value and line number. + + + + + Constructor with the specified value and line number. + + + + + Override, see base + + + + + Override, see base + + + + + Override, see base + + + + + Override, see base + + + + + Override, see base + + + + + Token type for integer tokens. This handles both Int32 and Int64. + + + + Constructor with the specified value. + + + Constructor with the specified value. + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + Constructor with the specified value + and line number. + + + + Constructor for a 64 bit int + + + + + Parse a string known to be a hex string. This is faster + than Parse which doesn't assume the number is Hex. This will + throw an exception if the input number isn't hex. + + The hex number as a string. + The line where this token was found. + A new IntToken set to the value in the input string. + + + + Convert the input string to an integer, if possible + + The string to parse. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + This enumerates verbosity levels. + + + + For error messages. + + + For warn messages. + + + For info messages. + + + For debug messages. + + + diff --git a/PerfApp/nts_features/NetTopologySuite.Features.deps.json b/PerfApp/nts_features/NetTopologySuite.Features.deps.json new file mode 100644 index 0000000..b6da2e1 --- /dev/null +++ b/PerfApp/nts_features/NetTopologySuite.Features.deps.json @@ -0,0 +1,161 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "NetTopologySuite.Features/2.1.0-pre.190390561+local": { + "dependencies": { + "Microsoft.SourceLink.GitHub": "1.0.0", + "NETStandard.Library": "2.0.3", + "NetTopologySuite": "2.0.0" + }, + "runtime": { + "NetTopologySuite.Features.dll": {} + } + }, + "Microsoft.Build.Tasks.Git/1.0.0": {}, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "Microsoft.SourceLink.Common/1.0.0": {}, + "Microsoft.SourceLink.GitHub/1.0.0": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.0.0", + "Microsoft.SourceLink.Common": "1.0.0" + } + }, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "NetTopologySuite/2.0.0": { + "dependencies": { + "System.Memory": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/NetTopologySuite.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.0.0.0" + } + } + }, + "System.Buffers/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Memory/4.5.3": { + "dependencies": { + "System.Buffers": "4.4.0", + "System.Numerics.Vectors": "4.4.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.27617.2" + } + } + }, + "System.Numerics.Vectors/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.3.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.4.1", + "fileVersion": "4.6.26919.2" + } + } + } + } + }, + "libraries": { + "NetTopologySuite.Features/2.1.0-pre.190390561+local": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.Build.Tasks.Git/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-z2fpmmt+1Jfl+ZnBki9nSP08S1/tbEOxFdsK1rSR+LBehIJz1Xv9/6qOOoGNqlwnAGGVGis1Oj6S8Kt9COEYlQ==", + "path": "microsoft.build.tasks.git/1.0.0", + "hashPath": "microsoft.build.tasks.git.1.0.0.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "Microsoft.SourceLink.Common/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-G8DuQY8/DK5NN+3jm5wcMcd9QYD90UV7MiLmdljSJixi3U/vNaeBKmmXUqI4DJCOeWizIUEh4ALhSt58mR+5eg==", + "path": "microsoft.sourcelink.common/1.0.0", + "hashPath": "microsoft.sourcelink.common.1.0.0.nupkg.sha512" + }, + "Microsoft.SourceLink.GitHub/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-aZyGyGg2nFSxix+xMkPmlmZSsnGQ3w+mIG23LTxJZHN+GPwTQ5FpPgDo7RMOq+Kcf5D4hFWfXkGhoGstawX13Q==", + "path": "microsoft.sourcelink.github/1.0.0", + "hashPath": "microsoft.sourcelink.github.1.0.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "NetTopologySuite/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3ajBClEI9wx2/DjjGmV52sHW1m52vLg8sdz1pJbTf5ySj1X90qehQs3v1DRwGo0F8UKj/Z2SjNhRN/6LroAkqg==", + "path": "nettopologysuite/2.0.0", + "hashPath": "nettopologysuite.2.0.0.nupkg.sha512" + }, + "System.Buffers/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw==", + "path": "system.buffers/4.4.0", + "hashPath": "system.buffers.4.4.0.nupkg.sha512" + }, + "System.Memory/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==", + "path": "system.memory/4.5.3", + "hashPath": "system.memory.4.5.3.nupkg.sha512" + }, + "System.Numerics.Vectors/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", + "path": "system.numerics.vectors/4.4.0", + "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==", + "path": "system.runtime.compilerservices.unsafe/4.5.2", + "hashPath": "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/PerfApp/nts_features/NetTopologySuite.Features.dll b/PerfApp/nts_features/NetTopologySuite.Features.dll new file mode 100644 index 0000000..d34fa21 Binary files /dev/null and b/PerfApp/nts_features/NetTopologySuite.Features.dll differ diff --git a/PerfApp/nts_features/NetTopologySuite.Features.xml b/PerfApp/nts_features/NetTopologySuite.Features.xml new file mode 100644 index 0000000..4ff00ca --- /dev/null +++ b/PerfApp/nts_features/NetTopologySuite.Features.xml @@ -0,0 +1,281 @@ + + + + NetTopologySuite.Features + + + + + Stores all attributes associated with a single Geometry feature. + + + + + Gets or sets a value indicating if setting with a + nonexistant index will throw an exception or if the attribute/value pair will + silently be added. + + + + + Creates an instance of this class using the default equality comparer for names. + + + + + Creates an instance of this class using the given equality comparer for names. + + The to use for comparing names, or to use the default. + + + + Creates an instance of this class using the provided enumeration of key/value pairs and + the default equality comparer for names. + + An enumeration of key/value pairs + + + + Creates an instance of this class using the provided enumeration of key/value pairs and + the given equality comparer for names. + + An enumeration of key/value pairs + The to use for comparing names, or to use the default. + + + + Creates an instance of this class using the provided enumeration of key/value pairs + + An attributes dictionary + If the attributes are null + + + + + + + + + + + + + + + + + + + + + + + + + Method to merge this attribute table with another attribute table + + The other attribute table + A value indicating if values in this attribute table are preferable + over those in . The default is true. + + + + + + + + + + + + + + Standard implementation of . + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The geometry + The attributes + + + + Gets or sets a value indicating how bounding box on should be handled + + Default is false + + + + + + + + + + + + + Represents a feature collection. + + + + + The bounding box of this + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class, given a list of IFeature. + + + + + Gets or sets the (optional) Bounding box (bbox) Object. + + + A describing the bounding box or . + + + + + Function to compute the bounding box (when it isn't set) + + A bounding box for this + + + + Defines extensions for . + + + + + Gets an ID value from this , using its + property if it happens to implement that interface (otherwise, searching through its + looking for an attribute with a specified name). + + + The whose ID to get. + + + The name of the attribute to look for in , if the + is not an instance of . + + + The ID value, or if this instance has no ID. + + + + + Interface definition for an object capable of storing 's attribute data + + + + + Method to add the attribute "" from the attribute table. + + The name (or key) of the attribute + + + + + Method to delete the attribute "" from the attribute table. + + The name (or key) of the attribute + + + + Function to query the of the Attribute "" + + The name (or key) of the attribute + The of the specified attribute + + + + Gets or sets the attribute value for the specified . + + The name (or key) of the attribute + The attribute value + + + + Function to verify if attribute data for the specified does exist. + + The name of the attribute + true if the attribute data exists, otherwise false. + + + + Gets a value indicating the number of attributes + + + + + Function to retrieve the names (or keys) of the feature's attributes + + + Returns an array of values + + + + + Function to retrieve the attribute data of the feature + + + Returns an array of values + + + + + Gets the value associated with the attribute for the specified name, or + if the attribute does not exist. + + The name (or key) of the attribute. + + The value associated with , or + if the attribute does not exist. + + + + + Contains a and a description of its metadata. + + + + + Gets or sets the of this feature. + + + + + Gets or sets an that describes the bounds of this feature. + + + + + Gets or sets a representation of this feature's metadata, tagged by user-defined strings. + + + + + Interface for things tagged by an identifier that's assumed to be unique. + + + + + Gets the identifier of this object (assumed unique). + + + + diff --git a/PerfApp/nts_patch_595/NetTopologySuite.deps.json b/PerfApp/nts_patch_595/NetTopologySuite.deps.json new file mode 100644 index 0000000..46b678c --- /dev/null +++ b/PerfApp/nts_patch_595/NetTopologySuite.deps.json @@ -0,0 +1,152 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "NetTopologySuite/2.5.0-pre.190390492+local": { + "dependencies": { + "Microsoft.DotNet.ApiCompat": "6.0.0-beta.21159.11", + "Microsoft.SourceLink.GitHub": "1.1.1", + "NETStandard.Library": "2.0.3", + "System.Memory": "4.5.4" + }, + "runtime": { + "NetTopologySuite.dll": {} + } + }, + "Microsoft.Build.Tasks.Git/1.1.1": {}, + "Microsoft.DotNet.ApiCompat/6.0.0-beta.21159.11": {}, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "Microsoft.SourceLink.Common/1.1.1": {}, + "Microsoft.SourceLink.GitHub/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "System.Buffers/4.5.1": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Memory/4.5.4": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.4.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Numerics.Vectors/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.3.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.3": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.4.1", + "fileVersion": "4.6.28619.1" + } + } + } + } + }, + "libraries": { + "NetTopologySuite/2.5.0-pre.190390492+local": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.Build.Tasks.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==", + "path": "microsoft.build.tasks.git/1.1.1", + "hashPath": "microsoft.build.tasks.git.1.1.1.nupkg.sha512" + }, + "Microsoft.DotNet.ApiCompat/6.0.0-beta.21159.11": { + "type": "package", + "serviceable": true, + "sha512": "sha512-SVX3OOq+Jx+DbPETmOjZO4OlHtrJBkAK7+O99crSJYFndveqTLiIIPMI6v5E2xOBEnWQQPwtiFxaVhEtuqHwtA==", + "path": "microsoft.dotnet.apicompat/6.0.0-beta.21159.11", + "hashPath": "microsoft.dotnet.apicompat.6.0.0-beta.21159.11.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "Microsoft.SourceLink.Common/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==", + "path": "microsoft.sourcelink.common/1.1.1", + "hashPath": "microsoft.sourcelink.common.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.GitHub/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", + "path": "microsoft.sourcelink.github/1.1.1", + "hashPath": "microsoft.sourcelink.github.1.1.1.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "System.Buffers/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "path": "system.buffers/4.5.1", + "hashPath": "system.buffers.4.5.1.nupkg.sha512" + }, + "System.Memory/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "path": "system.memory/4.5.4", + "hashPath": "system.memory.4.5.4.nupkg.sha512" + }, + "System.Numerics.Vectors/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", + "path": "system.numerics.vectors/4.4.0", + "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3TIsJhD1EiiT0w2CcDMN/iSSwnNnsrnbzeVHSKkaEgV85txMprmuO+Yq2AdSbeVGcg28pdNDTPK87tJhX7VFHw==", + "path": "system.runtime.compilerservices.unsafe/4.5.3", + "hashPath": "system.runtime.compilerservices.unsafe.4.5.3.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/PerfApp/nts_patch_595/NetTopologySuite.dll b/PerfApp/nts_patch_595/NetTopologySuite.dll new file mode 100644 index 0000000..7d51b48 Binary files /dev/null and b/PerfApp/nts_patch_595/NetTopologySuite.dll differ diff --git a/PerfApp/nts_patch_595/NetTopologySuite.xml b/PerfApp/nts_patch_595/NetTopologySuite.xml new file mode 100644 index 0000000..8b7c0d9 --- /dev/null +++ b/PerfApp/nts_patch_595/NetTopologySuite.xml @@ -0,0 +1,47799 @@ + + + + NetTopologySuite + + + + + Utility functions for working with angles. + Unless otherwise noted, methods in this class express angles in radians. + + + + + Value of 2 * Pi + + + + + Value of Pi / 2 + + + + + Value of Pi / 4 + + + + + Converts from radians to degrees. + + An angle in radians + The angle in degrees + + + + Converts from degrees to radians. + + An angle in degrees + The angle in radians + + + + Returns the angle of the vector from p0 to p1, relative to the positive X-axis. + + The angle is normalized to be in the range [ -Pi, Pi ]. + The initial point of the vector. + The terminal point of the vector. + The normalized angle (in radians) that p0-p1 makes with the positive X-axis + + + + Returns the angle of the vector from (0,0) to p, relative to the positive X-axis. + + + The angle is normalized to be in the range ( -Pi, Pi ]. + + The terminal point of the vector. + The normalized angle (in radians) that (0,0)-p makes with the positive X-axis. + + + + Tests whether the angle between p0-p1-p2 is acute. + + + An angle is acute if it is less than 90 degrees. + Note: this implementation is not precise (deterministic) for angles very close to 90 degrees. + + An endpoint of the angle + The base of the angle + Another endpoint of the angle + if the angle is acute. + + + + Tests whether the angle between p0-p1-p2 is obtuse + + + An angle is obtuse if it is greater than 90 degrees. + Note: this implementation is not precise (deterministic) for angles very close to 90 degrees. + + An endpoint of the angle + The base of the angle + Another endpoint of the angle + if the angle is obtuse. + + + + Returns the unoriented smallest angle between two vectors. + + + The computed angle will be in the range [0, Pi). + + The tip of one vector + The tail of each vector + The tip of the other vector + + + + Returns the oriented smallest angle between two vectors. + The computed angle will be in the range (-Pi, Pi]. + A positive result corresponds to a rotation (CCW) from v1 to v2; + a negative result corresponds to a (CW) rotation; + a zero result corresponds to no rotation. + + The tip of v1 + The tail of each vector + The tip of v2 + The angle between v1 and v2, relative to v1 + + + + Computes the angle of the unoriented bisector + of the smallest angle between two vectors. + + The computed angle will be in the range (-Pi, Pi]. + The tip of v1 + The tail of each vector + The tip of v2 + The angle of the bisector between v1 and v2 + + + + Computes the interior angle between two segments of a ring. + The ring is assumed to be oriented in a clockwise direction. + + The computed angle will be in the range [0, 2Pi] + A point of the ring + The next point of the ring + The next point of the ring + The interior angle based at + + + + Returns whether an angle must turn clockwise or counterclockwise to overlap another angle. + + An angle (in radians) + An angle (in radians) + Whether a1 must turn , or to overlap a2. + + + + Computes the normalized value of an angle, which is the equivalent angle in the range ( -Pi, Pi ]. + + The angle to normalize + An equivalent angle in the range (-Pi, Pi] + + + + Computes the normalized positive value of an angle, which is the equivalent angle in the range [ 0, 2*Pi ). + + E.g. + + Function callResult + NormalizePositive(0.0)0.0 + NormalizePositive(-PI) + NormalizePositive(-2PI)0.0 + NormalizePositive(-3PI) + NormalizePositive(-4PI)0.0 + NormalizePositive(PI) + NormalizePositive(2PI)0.0 + NormalizePositive(3PI) + NormalizePositive(4PI)0.0 + + + + The angle to normalize, in radians. + An equivalent positive angle + + + + Computes the unoriented smallest difference between two angles. + + + + The angles are assumed to be normalized to the range [-Pi, Pi]. + The result will be in the range [0, Pi]. + + + The angle of one vector (in [-Pi, Pi] ) + The angle of the other vector (in range [-Pi, Pi] ) + The angle (in radians) between the two vectors (in range [0, Pi] ) + + + + Projects a point by a given angle and distance. + + The point to project + The angle at which to project + The distance to project + The projected point + + + + Functions for computing area. + + Martin Davis + + + + Computes the area for a ring. + + The coordinates forming the ring + The area of the ring + + + + Computes the area for a ring. + + The coordinates forming the ring + The area of the ring + + + + Computes the signed area for a ring. The signed area is positive if the + ring is oriented CW, negative if the ring is oriented CCW, and zero if the + ring is degenerate or flat. + + The coordinates forming the ring + The signed area of the ring + + + + Computes the signed area for a ring. The signed area is positive if the + + + value + meaning + + > 0 + The ring is oriented clockwise (CW) + < 0 + The ring is oriented counter clockwise (CCW) + == 0 + The ring is degenerate or flat + + ring is oriented CW, negative if the ring is oriented CCW, and zero if the + ring is degenerate or flat. + + The coordinates forming the ring + The signed area of the ring + + + + An interface for rules which determine whether node points + which are in boundaries of geometry components + are in the boundary of the parent geometry collection. + The SFS specifies a single kind of boundary node rule, + the rule. + However, other kinds of Boundary Node Rules are appropriate + in specific situations (for instance, linear network topology + usually follows the .) + Some JTS operations + (such as , and ) + allow the BoundaryNodeRule to be specified, + and respect the supplied rule when computing the results of the operation. + + An example use case for a non-SFS-standard Boundary Node Rule is + that of checking that a set of s have + valid linear network topology, when turn-arounds are represented + as closed rings. In this situation, the entry road to the + turn-around is only valid when it touches the turn-around ring + at the single (common) endpoint. This is equivalent + to requiring the set of LineStrings to be + simple under the . + The SFS-standard is not + sufficient to perform this test, since it + states that closed rings have no boundary points. + + This interface and its subclasses follow the Strategy design pattern. + + Martin Davis + + + + + + + + Tests whether a point that lies in boundaryCount + geometry component boundaries is considered to form part of the boundary + of the parent geometry. + + boundaryCount the number of component boundaries that this point occurs in + true if points in this number of boundaries lie in the parent boundary + + + + Provides access to static instances of common s. + + + + + The Mod-2 Boundary Node Rule (which is the rule specified in the OGC SFS). + + + + + The Endpoint Boundary Node Rule. + + + + The MultiValent Endpoint Boundary Node Rule. + + + + The Monovalent Endpoint Boundary Node Rule. + + + + + The Boundary Node Rule specified by the OGC Simple Features Specification, + which is the same as the Mod-2 rule. + + + + + + A specifies that points are in the + boundary of a lineal geometry if + the point lies on the boundary of an odd number + of components. + Under this rule s and closed + s have an empty boundary. + + + This is the rule specified by the OGC SFS, + and is the default rule used in JTS. + + Martin Davis + + + + A which specifies that any points which are endpoints + of lineal components are in the boundary of the + parent geometry. + This corresponds to the "intuitive" topological definition + of boundary. + Under this rule s have a non-empty boundary + (the common endpoint of the underlying LineString). + + + This rule is useful when dealing with linear networks. + For example, it can be used to check + whether linear networks are correctly noded. + The usual network topology constraint is that linear segments may touch only at endpoints. + In the case of a segment touching a closed segment (ring) at one point, + the Mod2 rule cannot distinguish between the permitted case of touching at the + node point and the invalid case of touching at some other interior (non-node) point. + The EndPoint rule does distinguish between these cases, + so is more appropriate for use. + + Martin Davis + + + + A which determines that only + endpoints with valency greater than 1 are on the boundary. + This corresponds to the boundary of a + being all the "attached" endpoints, but not + the "unattached" ones. + + Martin Davis + + + + A which determines that only + endpoints with valency of exactly 1 are on the boundary. + This corresponds to the boundary of a + being all the "unattached" endpoints. + + Martin Davis + + + + Computes the centroid of a of any dimension. + For collections the centroid is computed for the collection of + non-empty elements of highest dimension. + The centroid of an empty geometry is null + + +

Algorithm

+ + Dimension 2 - the centroid ic computed + as a weighted sum of the centroids + of a decomposition of the area into (possibly overlapping) triangles. + Holes and multipolygons are handled correctly. + See http://www.faqs.org/faqs/graphics/algorithms-faq/ + for further details of the basic approach. + Dimension 1 - Computes the average of the midpoints + of all line segments weighted by the segment length. + Zero-length lines are treated as points. + + Dimension 0 - Compute the average coordinate over all points. + Repeated points are all included in the average + + + If the input geometries are empty, a null Coordinate is returned. +
+ + + + 1.7 +
+ + + Computes the centroid point of a geometry. + + The geometry to use + + The centroid point, or null if the geometry is empty + + + + + the point all triangles are based at + + + + + temporary variable to hold centroid of triangle + + + + + Partial area sum + + + + + partial centroid sum + + + + + Creates a new instance for computing the centroid of a geometry + + + + + Adds a to the centroid total. + + >The to add. + + + + Gets the computed centroid. + + The computed centroid, or null if the input is empty + + + + Computes three times the centroid of the triangle p1-p2-p3. + The factor of 3 is + left in to permit division to be avoided until later. + + + + + Returns twice the signed area of the triangle p1-p2-p3. + The area is positive if the triangle is oriented CCW, and negative if CW. + + + + + Adds the line segments defined by an array of coordinates + to the linear centroid accumulators. + + An array of s + + + + Adds a point to the point centroid accumulator. + + A + + + + Basic computational geometry algorithms + for geometry and coordinates defined in 3-dimensional Cartesian space. + + Martin Davis + + + + Computes the distance between the points and + in 3D space + + The first point + The second point + The distance between the two points + + + + Computes the distance between the point and the + segment from to in 3D space + + The point + The start point of the segment + The end point of the segment + + + + Computes the distance between two 3D segments. + The start point of the first segment + The end point of the first segment + The start point of the second segment + The end point of the second segment + The distance between the segments + + + + Implements basic computational geometry algorithms using arithmetic. + + Martin Davis + + + + Returns the index of the direction of the point q relative to + a vector specified by p1-p2. + + The origin point of the vector + The final point of the vector + the point to compute the direction to + + + 1 if q is counter-clockwise (left) from p1-p2 + -1 if q is clockwise (right) from p1-p2 + 0 if q is collinear with p1-p2 + + + + + Returns the index of the direction of the point q relative to + a vector specified by p1-p2. + + The x-ordinate of the origin point of the vector + The y-ordinate of the origin point of the vector + The x-ordinate of the final point of the vector + The y-ordinate of the final point of the vector + The x-ordinate of the point to compute the direction to + The y-ordinate of the point to compute the direction to + + + 1 if q is counter-clockwise (left) from p1-p2 + -1 if q is clockwise (right) from p1-p2 + 0 if q is collinear with p1-p2 + + + + + Computes the sign of the determinant of the 2x2 matrix + with the given entries. + + + + + + + + -1 if the determinant is negative, + 1 if the determinant is positive, + 0 if the determinant is 0. + + + + + + A value which is safely greater than the + relative round-off error in double-precision numbers + + + + + A filter for computing the orientation index of three coordinates. + + If the orientation can be computed safely using standard DP + arithmetic, this routine returns the orientation index. + Otherwise, a value i > 1 is returned. + In this case the orientation index must + be computed using some other more robust method. + The filter is fast to compute, so can be used to + avoid the use of slower robust methods except when they are really needed, + thus providing better average performance. + + Uses an approach due to Jonathan Shewchuk, which is in the public domain. + + The x-ordinate of point A + The y-ordinate of point A + The x-ordinate of point B + The y-ordinate of point B + The x-ordinate of point C + The y-ordinate of point C + + + The orientation index if it can be computed safely + > 1 if the orientation index cannot be computed safely> + + + + + + Computes an intersection point between two lines + using DD arithmetic. + If the lines are parallel (either identical + or separate) a null value is returned. + + An endpoint of line segment 1 + An endpoint of line segment 1 + An endpoint of line segment 2 + An endpoint of line segment 2 + An intersection point if one exists, or null if lines are parallel. + + + + Constructs the Largest Empty Circle for a set + of obstacle geometries, up to a specified tolerance. + The obstacles are point and line geometries. + + The Largest Empty Circle is the largest circle which + has its center in the convex hull of the obstacles (the boundary), + and whose interior does not intersect with any obstacle. + The circle center is the point in the interior of the boundary + which has the farthest distance from the obstacles (up to tolerance). + The circle is determined by the center point + and a point lying on an obstacle indicating the circle radius. + + The implementation uses a successive-approximation technique + over a grid of square cells covering the obstacles and boundary. + The grid is refined using a branch-and-bound algorithm. + Point containment and distance are computed in a performant + way by using spatial indexes. + +

Future Enhancements

+ + Support polygons as obstacles + Support a client-defined boundary polygon + +
+ Martin Davis + + + +
+ + + Computes the center point of the Largest Empty Circle + within a set of obstacles, up to a given tolerance distance. + + A geometry representing the obstacles (points and lines) + The distance tolerance for computing the center point + The center point of the Largest Empty Circle + + + + Computes a radius line of the Largest Empty Circle + within a set of obstacles, up to a given distance tolerance. + + A geometry representing the obstacles (points and lines) + The distance tolerance for computing the center point + A line from the center of the circle to a point on the edge + + + + Creates a new instance of a Largest Empty Circle construction. + + A geometry representing the obstacles (points and lines) + The distance tolerance for computing the center point + + + + Sets the area boundary as the convex hull + of the obstacles. + + + + + Gets the center point of the Largest Empty Circle + (up to the tolerance distance). + + The center point of the Largest Empty Circle + + + + Gets a point defining the radius of the Largest Empty Circle. + This is a point on the obstacles which is + nearest to the computed center of the Largest Empty Circle. + The line segment from the center to this point + is a radius of the constructed circle, and this point + lies on the boundary of the circle. + + A point defining the radius of the Largest Empty Circle + + + + Gets a line representing a radius of the Largest Empty Circle. + + A line from the center of the circle to a point on the edge + + + + Computes the signed distance from a point to the constraints + (obstacles and boundary). + Points outside the boundary polygon are assigned a negative distance. + Their containing cells will be last in the priority queue + (but will still end up being tested since they may be refined). + + The point to compute the distance for + The signed distance to the constraints (negative indicates outside the boundary) + + + + Tests whether a cell may contain the circle center, + and thus should be refined (split into subcells + to be investigated further.) + + The cell to test + true if the cell might contain the circle center + + + + Initializes the queue with a grid of cells covering + the extent of the area. + + The area extent to cover + The queue to initialize + + + + A square grid cell centered on a given point + with a given side half-length, + and having a given distance from the center point to the constraints. + The maximum possible distance from any point in the cell to the + constraints can be computed. + This is used as the ordering and upper-bound function in + the branch-and-bound algorithm. + + + + + Constructs the Maximum Inscribed Circle for a + polygonal , up to a specified tolerance. + The Maximum Inscribed Circle is determined by a point in the interior of the area + which has the farthest distance from the area boundary, + along with a boundary point at that distance. + + In the context of geography the center of the Maximum Inscribed Circle + is known as the Pole of Inaccessibility. + A cartographic use case is to determine a suitable point + to place a map label within a polygon. + + The radius length of the Maximum Inscribed Circle is a + measure of how "narrow" a polygon is. It is the + distance at which the negative buffer becomes empty. + + The class supports polygons with holes and multipolygons. + + The implementation uses a successive-approximation technique + over a grid of square cells covering the area geometry. + The grid is refined using a branch-and-bound algorithm. + Point containment and distance are computed in a performant + way by using spatial indexes. +

Future Enhancements

+ + Support a polygonal constraint on placement of center + +
+ Martin Davis + + + +
+ + + Computes the center point of the Maximum Inscribed Circle + of a polygonal geometry, up to a given tolerance distance. + + A polygonal geometry + The distance tolerance for computing the center point + The center point of the maximum inscribed circle + + + + Computes a radius line of the Maximum Inscribed Circle + of a polygonal geometry, up to a given tolerance distance. + + A polygonal geometry + The distance tolerance for computing the center point + A line from the center to a point on the circle + + + + Creates a new instance of a Maximum Inscribed Circle computation. + + An areal geometry + The distance tolerance for computing the centre point + (must be positive) + Thrown if the tolerance is non-positive + Thrown if the input geometry is non-polygonal or empty + + + + Gets the center point of the maximum inscribed circle + (up to the tolerance distance). + The center point of the maximum inscribed circle + + + + Gets a point defining the radius of the Maximum Inscribed Circle. + This is a point on the boundary which is + nearest to the computed center of the Maximum Inscribed Circle. + The line segment from the center to this point + is a radius of the constructed circle, and this point + lies on the boundary of the circle. + + A point defining the radius of the Maximum Inscribed Circle + + + + Gets a line representing a radius of the Largest Empty Circle. + + A line from the center of the circle to a point on the edge + + + + Computes the signed distance from a point to the area boundary. + Points outside the polygon are assigned a negative distance. + Their containing cells will be last in the priority queue + (but may still end up being tested since they may need to be refined). + + The point to compute the distance for + The signed distance to the area boundary (negative indicates outside the area) + + + + Initializes the queue with a grid of cells covering + the extent of the area. + + The area extent to cover + The queue to initialize + + + + A square grid cell centered on a given point + with a given side half-length, + and having a given distance from the center point to the constraints. + The maximum possible distance from any point in the cell to the + constraints can be computed. + This is used as the ordering and upper-bound function in + the branch-and-bound algorithm. + + + + + Computes the convex hull of a . + The convex hull is the smallest convex Geometry that contains all the + points in the input Geometry. + Uses the Graham Scan algorithm. + + + + + Computes the convex hull for the given sequence of instances. + + + The instances whose convex hull to compute. + + + The convex hull of . + + + + + Create a new convex hull construction for the input Geometry. + + + + + + Create a new convex hull construction for the input array. + + + + + + + Returns a Geometry that represents the convex hull of the input point. + The point will contain the minimal number of points needed to + represent the convex hull. In particular, no more than two consecutive + points will be collinear. + + + If the convex hull contains 3 or more points, a Polygon; + 2 points, a LineString; + 1 point, a Point; + 0 points, an empty GeometryCollection. + + + + + Uses a heuristic to reduce the number of points scanned to compute the hull. + The heuristic is to find a polygon guaranteed to + be in (or on) the hull, and eliminate all points inside it. + A quadrilateral defined by the extremal points + in the four orthogonal directions + can be used, but even more inclusive is + to use an octilateral defined by the points in the 8 cardinal directions. + Note that even if the method used to determine the polygon vertices + is not 100% robust, this does not affect the robustness of the convex hull. + + To satisfy the requirements of the Graham Scan algorithm, + the returned array has at least 3 entries. + + + The coordinates to reduce + The reduced array of coordinates + + + + Pre sorts the coordinates + + + + + + + + + + + + + + + + + + + + Whether the three coordinates are collinear + and c2 lies between c1 and c3 inclusive. + + + + + + + + + + + + + + + + + + + + + The vertices of a linear ring, which may or may not be flattened (i.e. vertices collinear). + A 2-vertex LineString if the vertices are collinear; + otherwise, a Polygon with unnecessary (collinear) vertices removed. + + + + + + The vertices of a linear ring, which may or may not be flattened (i.e. vertices collinear). + The coordinates with unnecessary (collinear) vertices removed. + + + + Compares s for their angle and distance + relative to an origin. + + + + + Initializes a new instance of the class. + + + + + + + + + + + + + + + + + + + + + + + Functions to compute distance between basic geometric structures. + + Martin Davis + + + + Computes the distance from a line segment AB to a line segment CD + + Note: NON-ROBUST! + + The first point of the first line + The second point of the first line (must be different to A) + The first point of the second line + The second point of the second line (must be different to C) + The distance from a line segment AB to a line segment CD + + + + Computes the distance from a point to a sequence of line segments. + + A point + A sequence of contiguous line segments defined by their vertices + The minimum distance between the point and the line segments + + + + Computes the distance from a point to a sequence of line segments. + + A point + A sequence of contiguous line segments defined by their vertices + The minimum distance between the point and the line segments + + + + Computes the distance from a point p to a line segment AB + + Note: NON-ROBUST! + + The point to compute the distance for + The first point of the first line + The second point of the first line (must be different to A) + The distance from p to line segment AB + + + + Computes the perpendicular distance from a point p to the (infinite) line + containing the points AB + + The point to compute the distance for + The first point of the first line + The second point of the first line (must be different to A) + The perpendicular distance from p to line segment AB + + + + + Computes the Discrete Fréchet Distance between two s + using a cartesian distance computation function. + + The 1st geometry + The 2nd geometry + The cartesian distance between and + + + + Creates an instance of this class using the provided geometries. + + A geometry + A geometry + + + + Computes the Discrete Fréchet Distance between the input geometries + + The Discrete Fréchet Distance + + + + Creates a matrix to store the computed distances + + The number of rows + The number of cols + A matrix storage + + + + Gets the pair of s at which the distance is obtained. + + The pair of Coordinates at which the distance is obtained + + + + Computes the Fréchet Distance for the given distance matrix. + + An array of Coordinates + An array of Coordinates + An array of alternating col/row index values for the diagonal of the distance matrix + The distance matrix + A lookup for coordinate pairs based on a distance + + + + + Returns the minimum distance at the corner (, }). + + A (sparse) matrix + The row index + The column index + The minimum distance + + + + Computes relevant distances between pairs of s for the + computation of the Discrete Fréchet Distance. + + An array of Coordinates + An array of Coordinates + An array of alternating col/row index values for the diagonal of the distance matrix + The distance matrix + A lookup for coordinate pairs based on a distance + + +
+ Computes the indices for the diagonal of a numCols x numRows grid + using the + Bresenham's line algorithm. + + The number of columns + The number of rows + A packed array of column and row indices. + + + + Abstract base class for storing 2d matrix data + + + + + Gets a value indicating the number of rows + + + + + Gets a value indicating the number of columns + + + + + Gets a value indicating the default value + + + + Creates an instance of this class + The number of rows + The number of columns + A default value + + + + Gets or sets a value for the cell , + + The row index + The column index + The value of the cell , + + + + Gets a flag indicating if the matrix has a set value, e.g. one that is different + than . + + A flag indicating if the matrix has a set value + + + Straight forward implementation of a rectangular matrix + + + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified. + + The number of rows + The number of columns + A default value + + + + A matrix implementation that adheres to the + + Compressed sparse row format.
+ Note: Unfortunately not as fast as expected. +
+
+ + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified. + + The number of rows + The number of columns + A default value + + + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified as well as the number of values expected. + + The number of rows + The number of columns + A default value + The amount of expected values + + + + Computes an initial value for the number of expected values + + The number of rows + The number of columns + The expected number of values in the sparse matrix + + + + Ensures that the column index vector (ci) and value vector (v) are sufficiently large. + + The number of items to store in the matrix + + + + A sparse matrix based on . + + + + + Creates an instance of this matrix using the given number of rows and columns. + A default value can be specified. + + The number of rows + The number of columns + A default value + + + + An algorithm for computing a distance metric + which is an approximation to the Hausdorff Distance + based on a discretization of the input . + + + + The algorithm computes the Hausdorff distance restricted to discrete points + for one of the geometries. + The points can be either the vertices of the geometries (the default), + or the geometries with line segments densified by a given fraction. + Also determines two points of the Geometries which are separated by the computed distance. + + + This algorithm is an approximation to the standard Hausdorff distance. + Specifically, + + for all geometries a, b: DHD(a, b) <= HD(a, b) + + The approximation can be made as close as needed by densifying the input geometries. + In the limit, this value will approach the true Hausdorff distance: + + DHD(A, B, densifyFactor) -> HD(A, B) as densifyFactor -> 0.0 + + The default approximation is exact or close enough for a large subset of useful cases. + + + Examples of these are: + + + computing distance between Linestrings that are roughly parallel to each other, + and roughly equal in length. This occurs in matching linear networks. + + Testing similarity of geometries. + + + + An example where the default approximation is not close is: + + A = LINESTRING (0 0, 100 0, 10 100, 10 100) + B = LINESTRING (0 100, 0 10, 80 10) + + DHD(A, B) = 22.360679774997898 + HD(A, B) ~= 47.8 + + + + + + + Computes the Discrete Hausdorff Distance of two s. + + A geometry + A geometry + The Discrete Hausdorff Distance + + + + Computes the Discrete Hausdorff Distance of two s. + + A geometry + A geometry + The densify fraction. A value of 0 indicates, that no densification should take place + The Discrete Hausdorff Distance + + + + Value of 0.0 indicates that no densification should take place + + + + + Creates an instance of this class using the provided geometries + + A geometry + Another geometry + + + + Gets or sets the fraction by which to densify each segment. + + + Each segment will be (virtually) split into a number of equal-length + sub-segments, whose fraction of the total length is closest + to the given fraction. + + + + + Computes the discrete hausdorff distance between the two assigned geometries. + + The discrete hausdorff distance + + + + Computes the discrete hausdorff distance between the 1st and the 2nd assigned geometry + + The discrete hausdorff distance. + + + + Gets a value indicating the + + + + + A coordinate filter that computes the maximum between points of + an assigned Geometry and all filtered geometries. + + + + + Creates an instance of this class + + A geometry + + + + + + + Gets a value indicating the maximum distance between + an assigned Geometry and the filtered one. + + + + + A coordinate filter that computes the maximum between points of + an assigned Geometry and all filtered geometries. The filtered geometries' line segments + are + + + + + Creates an instance of this filter class + + The geometry to densify + The densification fraction + + + + + + + As this filter does not change the geometry, the return value is always false + + + + As this filter does not end prematurely, the return value is always false + + + + Gets a value indicating the maximum distance between p + + + + + Computes the Euclidean distance (L2 metric) from a to a . + + + Also computes two points on the geometry which are separated by the distance found. + + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The geometry + The Point + The PointPairDistance + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The LineString + The Point + The PointPairDistance + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The LineSegment + The Point + The PointPairDistance + + + + Computes the Euclidean distance (L2 metric) from a to a . + + The Polygon + The Point + The PointPairDistance + + + + Contains a pair of points and the distance between them. + + + Provides methods to update with a new point pair with either maximum or minimum distance. + + + + + Initializes this instance to null. + + + + + Initializes the points, computing the distance between them. + + 1st coordinate + 2nd coordinate + + + + Initializes the points, avoiding recomputing the distance. + + 1st coordinate + 2nd coordinate + the distance between and + + + + The distance between the paired coordinates + + The distance between the paired coordinates + + + + Gets a value indicating the paired coordinates. + + An array containing the paired points + + + + Gets the value of one of the paired points + + An index, valid are [0, 1]. + The Coordinate at index i. + + + + Updates this PointPairDistance if + has greater than this instance. + + The PointPairDistance to test. + + + + Updates this PointPairDistance if the distance between + and is greater than the + of this instance. + + The 1st point's coordinate + The 2nd point's coordinate + + + + Updates this PointPairDistance if + has a smaller than this instance. + + The PointPairDistance to test. + + + + Updates this PointPairDistance if the distance between + and is smaller than the + of this instance. + + The 1st point's coordinate + The 2nd point's coordinate + + + + + + + Represents a homogeneous coordinate in a 2-D coordinate space. + In NTS s are used as a clean way + of computing intersections between line segments. + + David Skea + + + + Computes the (approximate) intersection point between two line segments using homogeneous coordinates. + + + Note that this algorithm is + not numerically stable; i.e. it can produce intersection points which + lie outside the envelope of the line segments themselves. In order + to increase the precision of the calculation input points should be normalized + before passing them to this routine. + + 1st Coordinate of 1st linesegment + 2nd Coordinate of 1st linesegment + 1st Coordinate of 2nd linesegment + 2nd Coordinate of 2nd linesegment + + + + Computes the (approximate) intersection point between two line segments + using homogeneous coordinates. + Note that this algorithm is + not numerically stable; i.e. it can produce intersection points which + lie outside the envelope of the line segments themselves. In order + to increase the precision of the calculation input points should be normalized + before passing them to this routine. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Constructs a homogeneous coordinate which is the intersection of the lines s. + define by the homogeneous coordinates represented by two + + A coordinate + A coordinate + + + + Creates an instance of this + + + + + + + + + Constructs a concave hull of a set of points. + The hull is constructed by removing the longest outer edges + of the Delaunay Triangulation of the points + until a target criterion is reached. + + The target criteria are: + + Maximum Edge Length Ratiothe length of the longest edge of the hull is no larger + than this value. + Maximum Edge Length Factordetermine the Maximum Edge Length + as a fraction of the difference between the longest and shortest edge lengths + in the Delaunay Triangulation. + This normalizes the Maximum Edge Length to be scale-free. + A value of 1 produces the convex hull; a value of 0 produces maximum concaveness. + + The preferred criterion is the Maximum Edge Length Ratio, since it is + scale-free and local(so that no assumption needs to be made about the + total amount of concaveness present). + Other length criteria can be used by setting the Maximum Edge Length directly. + For example, use a length relative to the longest edge length + in the Minimum Spanning Tree of the point set. + Or, use a length derived from the value. + + The computed hull is always a single connected + (unless it is degenerate, in which case it will be a or a ). + This constraint may cause the concave hull to fail to meet the target criteria. + + Optionally the concave hull can be allowed to contain holes. + Note that when using the area-based criterion + this may result in substantially slower computation. + + Martin Davis + + + + Computes the approximate edge length of + a uniform square grid having the same number of + points as a geometry and the same area as its convex hull. + This value can be used to determine a suitable length threshold value + for computing a concave hull. + A value from 2 to 4 times the uniform grid length + seems to produce reasonable results. + + A geometry + The approximate uniform grid length + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length. + + The input geometry + The target maximum edge length + The concave hull + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length, + and optionally allowing holes. + + The input geometry + The target maximum edge length + A flag whether holes are allowed in the result + The concave hull + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length ratio. + The edge length ratio is a fraction of the length difference + between the longest and shortest edges + in the Delaunay Triangulation of the input points. + + The input geometry + The target edge length ratio + The concave hull + + + + Computes the concave hull of the vertices in a geometry + using the target criterion of maximum edge length ratio, + and optionally allowing holes. + The edge length factor is a fraction of the length difference + between the longest and shortest edges + in the Delaunay Triangulation of the input points. + + The input geometry + The target edge length ratio + A flag whether holes are allowed in the result + The concave hull + + + + Creates a new instance for a given geometry. + + The input geometry + + + Gets or sets the target maximum edge length for the concave hull. + The length value must be zero or greater. + + The value 0.0 produces the concave hull of smallest area + that is still connected. + Larger values produce less concave results. + A value equal or greater than the longest Delaunay Triangulation edge length + produces the convex hull. + + The value may be used as + the basis for estimating an appropriate target maximum edge length. + + + The target maximum edge length for the concave hull + + + + Gets or sets the target maximum edge length ratio for the concave hull. + The edge length ratio is a fraction of the difference + between the longest and shortest edge lengths + in the Delaunay Triangulation of the input points. + It is a value in the range 0 to 1. + + The value 0.0 produces a concave hull of minimum area + that is still connected. + The value 1.0 produces the convex hull. + + + The target maximum edge length factor for the concave hull + + + + Gets or sets whether holes are allowed in the concave hull polygon. + + + + + Gets the computed concave hull. + + The concave hull + + + Computes the concave hull using edge length as the target criteria. + + + The erosion is done in two phases: first the border, then any + internal holes (if required). + This allows an fast connection check to be used + when eroding holes, + which makes this much more efficient than the area-based algorithm. + + The triangulation + + + + Adds a Tri to the queue. + Only add tris with a single border edge, + sice otherwise that would risk isolating a vertex. + Sets the ordering size to the length of the border edge. + + The Tri to add + The priority queue to add to + + + + Finds tris which may be the start of holes. + + + Only tris which have a long enough edge and which do not touch the current hull + boundary are included.
+ This avoids the risk of disconnecting the result polygon. + The list is sorted in decreasing order of edge length. +
+ The triangulation + The minimum length of edges to consider + A list of candidate tris that may start a hole +
+ + + Erodes a hole starting at a given triangle, + and eroding all adjacent triangles with boundary edge length above target. + + The triangulation + A tri which is a hole + + + + Tris which are used to form a concave hull. + If a Tri has an edge (or edges) with no adjacent tri + the tri is on the boundary of the triangulation. + The edge is a boundary edge. + The union of those edges + forms the (linear) boundary of the triangulation. + The triangulation area may be a Polygon or MultiPolygon, and may or may not contain holes. + + Martin Davis + + + + Sets the size to be the length of the boundary edges. + This is used when constructing hull without holes, + by erosion from the triangulation boundary. + + + + + Gets an index of a boundary edge, if there is one. + + A boundary edge index, or -1 + + + + Gets the most CCW boundary edge index. + This assumes there is at least one non-boundary edge. + + The CCW boundary edge index + + + + Gets the most CW boundary edge index. + This assumes there is at least one non-boundary edge. + + The CW boundary edge index + + + + Tests if this tri is the only one connecting its 2 adjacents. + Assumes that the tri is on the boundary of the triangulation + and that the triangulation does not contain holes + + true if the tri is the only connection + + + + Gets the index of a vertex which is adjacent to two other tris (if any). + + The vertex index or -1 + + + + Tests whether some vertex of this Tri has degree = 1. + In this case it is not in any other Tris. + + The triangulation + true if any vertex of this tri has a degree of 1 + + + + PriorityQueues sort in ascending order. + To sort with the largest at the head, + smaller sizes must compare as greater than larger sizes. + (i.e. the normal numeric comparison is reversed). + If the sizes are identical (which should be an infrequent case), + the areas are compared, with larger areas sorting before smaller. + (The rationale is that larger areas indicate an area of lower point density, + which is more likely to be in the exterior of the computed shape.) + This improves the determinism of the queue ordering. + + + + + Tests if this tri has a vertex which is in the boundary, + but not in a boundary edge. + + true if the tri touches the boundary at a vertex + + + + Tests if a triangulation is edge-connected, if a triangle is removed.
+ NOTE: this is a relatively slow operation. +
+ The triangulation + The triangle to remove + true if the triangulation is still connected +
+ + + Functions to operate on triangulations represented as + lists of s. + + + + + Creates a polygonal geometry representing the area of a triangulation + which may be disconnected or contain holes. + + The triangulation + The geometry factory + The area polygonal geometry + + + + Creates a Polygon representing the area of a triangulation + which is connected and contains no holes. + + The triangulation + The geometry factory to use + The area polygon + + + + Extracts the coordinates of the edgees along the boundary of a triangulation, + by tracing CW around the border triangles.
+ Assumption: there are at least 2 tris, they are connected, + and there are no holes. + So each tri has at least one non-border edge, and there is only one border. +
+ The triangulation + The border of the triangulation +
+ + + Computes an interior point of a . + An interior point is guaranteed to lie in the interior of the Geometry, + if it possible to calculate such a point exactly. + For collections the interior point is computed for the collection of + non-empty elements of highest dimension. + Otherwise, the point may lie on the boundary of the geometry. + + The interior point of an empty geometry is POINT EMPTY. +

Algorithm

+ The point is chosen to be "close to the center" of the geometry. + The location depends on the dimension of the input: + + Dimension 2the interior point is constructed in the middle of the longest interior segment + of a line bisecting the area. + Dimension 1the interior point is the interior or boundary vertex closest to the centroid. + Dimension 0the point is the point closest to the centroid. + + + + +
+
+ + + Computes a location of an interior point in a . + + Handles all geometry types. + + A geometry in which to find an interior point + the location of an interior point, or POINT EMPTY if the input is empty + + + + + Computes a location of an interior point in a . + + Handles all geometry types. + + + This function is called GetInteriorPoint in JTS. + It has been renamed to GetInteriorCoord to prevent a breaking change. + A geometry in which to find an interior point + the location of an interior point, or null if the input is empty + + + + + Computes a point in the interior of an areal geometry. + The point will lie in the geometry interior + in all except certain pathological cases. + + +

Algorithm:

+ For each input polygon: + + + Determine a horizontal scan line on which the interior + point will be located. + To increase the chance of the scan line + having non-zero-width intersection with the polygon + the scan line Y ordinate is chosen to be near the centre of the polygon's + Y extent but distinct from all of vertex Y ordinates. + + + Compute the sections of the scan line + which lie in the interior of the polygon. + + + Choose the widest interior section + and take its midpoint as the interior point. + + + The final interior point is chosen as + the one occurring in the widest interior section. + + This algorithm is a tradeoff between performance + and point quality (where points further from the geometry + boundary are considered to be higher quality) + Priority is given to performance. + This means that the computed interior point + may not be suitable for some uses + (such as label positioning). + + + The algorithm handles some kinds of invalid/degenerate geometry, + including zero-area and self-intersecting polygons. + + + Empty geometry is handled by returning a point. + +

KNOWN BUGS

+ + + If a fixed precision model is used, + in some cases this method may return a point + which does not lie in the interior. + + + If the input polygon is extremely narrow the computed point + may not lie in the interior of the polygon. + + +
+
+ + + Computes an interior point for the + polygonal components of a Geometry. + + The geometry to compute. + + The computed interior point, + or if the geometry has no polygonal components. + + + + + + + + + + + + + Creates a new interior point finder + for an areal geometry. + + An areal geometry + + + + Gets the computed interior point + or if the input geometry is empty. + + + + + Processes a geometry to determine + the best interior point for + all component polygons. + + The geometry to process. + + + + Computes an interior point of a component Polygon + and updates current best interior point + if appropriate. + + The polygon to process. + + + + Computes an interior point in a single , + as well as the width of the scan-line section it occurs in + to allow choosing the widest section occurrence. + + + + + Initializes a new instance of the class. + + The polygon to test. + + + + Gets the computed interior point, + or if the input geometry is empty. + + + + + Gets the width of the scanline section containing the interior point. + Used to determine the best point to use. + + + + + Compute the interior point. + + + + + Finds the midpoint of the widest interior section. + Sets the location and the + + + The list of scan-line X ordinates + + + + Tests if an edge intersection contributes to the crossing count. + Some crossing situations are not counted, + to ensure that the list of crossings + captures strict inside/outside topology. + + An endpoint of the segment. + An endpoint of the segment. + The Y-ordinate of the horizontal line. + if the edge crossing is counted. + + + + Computes the intersection of a segment with a horizontal line. + The segment is expected to cross the horizontal line + - this condition is not checked. + Computation uses regular double-precision arithmetic. + Test seems to indicate this is as good as using DD arithmetic. + + An endpoint of the segment. + An endpoint of the segment. + The Y-ordinate of the horizontal line + + + + + Tests if an envelope intersects a horizontal line. + + The envelope to test. + The Y-ordinate of the horizontal line. + if the envelope and line intersect. + + + + Tests if a line segment intersects a horizontal line. + + A segment endpoint. + A segment endpoint. + The Y-ordinate of the horizontal line. + if the segment and line intersect. + + + + Finds a safe scan line Y ordinate by projecting + the polygon segments + to the Y axis and finding the + Y-axis interval which contains the centre of the Y extent. + The centre of + this interval is returned as the scan line Y-ordinate. + + Note that in the case of (degenerate, invalid) + zero-area polygons the computed Y value + may be equal to a vertex Y-ordinate. + + + Martin Davis + + + + Computes a point in the interior of an linear point. + Algorithm: + Find an interior vertex which is closest to + the centroid of the linestring. + If there is no interior vertex, find the endpoint which is + closest to the centroid. + + + + + Computes an interior point for the + linear components of a Geometry. + + The geometry to compute. + + The computed interior point, + or if the geometry has no linear components. + + + + + + + + + + + + + + + + Tests the interior vertices (if any) + defined by a linear Geometry for the best inside point. + If a Geometry is not of dimension 1 it is not tested. + + The point to add. + + + + + + + + + + Tests the endpoint vertices + defined by a linear Geometry for the best inside point. + If a Geometry is not of dimension 1 it is not tested. + + The point to add. + + + + + + + + + + + + + + + + Computes a point in the interior of an point point. + Algorithm: + Find a point which is closest to the centroid of the point. + + + + + Computes an interior point for the + puntal components of a Geometry. + + The geometry to compute. + + The computed interior point, + or if the geometry has no puntal components. + + + + + + + + + + + Tests the point(s) defined by a Geometry for the best inside point. + If a Geometry is not of dimension 0 it is not tested. + + The point to add. + + + + + + + + + + + + + + + Functions to compute intersection points between lines and line segments. + + In general it is not possible to compute + the intersection point of two lines exactly, due to numerical roundoff. + This is particularly true when the lines are nearly parallel. + These routines uses numerical conditioning on the input values + to ensure that the computed value is very close to the correct value. + + The Z-ordinate is ignored, and not populated. + + mdavis + + + + Computes the intersection point of two lines. + If the lines are parallel or collinear this case is detected + and null is returned. + + An endpoint of line 1 + An endpoint of line 1 + An endpoint of line 2 + An endpoint of line 2 + + + NOTE: In JTS this function is called Intersection. + + The intersection point between the lines, if there is one, + or null if the lines are parallel or collinear + + + + + Computes the intersection point of a line and a line segment (if any). + There will be no intersection point if: + + the segment does not intersect the line + the line or the segment are degenerate (have zero length) + + If the segment is collinear with the line the first segment endpoint is returned. + + The intersection point, or null if it is not possible to find an intersection + + + + An interface for classes which determine the of points in a + + Martin Davis + + + + Determines the of a point in the . + + The point to test + the location of the point in the geometry + + + + Functions for computing length. + + + Martin Davis + + + + + Computes the length of a LineString specified by a sequence of points. + + The points specifying the LineString + The length of the LineString + + + + A LineIntersector is an algorithm that can both test whether + two line segments intersect and compute the intersection point(s) + if they do. + + There are three possible outcomes when determining whether two line segments intersect: + + - the segments do not intersect + - the segments intersect in a single point + - the segments are collinear and they intersect in a line segment + + + + For segments which intersect in a single point, the point may be either an endpoint + or in the interior of each segment. + If the point lies in the interior of both segments, + this is termed a proper intersection. + The property test for this situation. + + The intersection point(s) may be computed in a precise or non-precise manner. + Computing an intersection point precisely involves rounding it + via a supplied . + + LineIntersectors do not perform an initial envelope intersection test + to determine if the segments are disjoint. + This is because this class is likely to be used in a context where + envelope overlap is already known to occur (or be likely). + + + + + + Indicates that line segments do not intersect + + + + + Indicates that line segments intersect in a single point + + + + + Indicates that line segments intersect in a line segment + + + + + Computes the "edge distance" of an intersection point p along a segment. + The edge distance is a metric of the point along the edge. + The metric used is a robust and easy to compute metric function. + It is not equivalent to the usual Euclidean metric. + It relies on the fact that either the x or the y ordinates of the + points in the edge are unique, depending on whether the edge is longer in + the horizontal or vertical direction. + NOTE: This function may produce incorrect distances + for inputs where p is not precisely on p1-p2 + (E.g. p = (139,9) p1 = (139,10), p2 = (280,1) produces distance 0.0, which is incorrect. + My hypothesis is that the function is safe to use for points which are the + result of rounding points which lie on the line, but not safe to use for truncated points. + + + + + This function is non-robust, since it may compute the square of large numbers. + Currently not sure how to improve this. + + + + + A value indicating the intersection result + + Possible values are: + + + + + + + + + + Array of coordinate arrays forming the lines + + + + + Array of + + + + + The indexes of the endpoints of the intersection lines, in order along + the corresponding line + + + + + Alias the [0] for ease of reference + + + + + Alias the [1] for ease of reference + + + + + If MakePrecise is true, computed intersection coordinates will be made precise + using Coordinate.MakePrecise. + + + + + Creates an instance of this class + + + + + Force computed intersection to be rounded to a given precision model. + No getter is provided, because the precision model is not required to be specified. + + + + + Gets an endpoint of an input segment. + + the index of the input segment (0 or 1) + the index of the endpoint (0 or 1) + The specified endpoint + + + + Compute the intersection of a point p and the line p1-p2. + This function computes the bool value of the hasIntersection test. + The actual value of the intersection (if there is one) + is equal to the value of p. + + + + + Gets a value indicating if the computed intersection is collinear + + + + + Computes the intersection of the lines p1-p2 and p3-p4. + This function computes both the bool value of the hasIntersection test + and the (approximate) value of the intersection point itself (if there is one). + + The 1st point of the 1st segment + The 2nd point of the 1st segment + The 1st point of the 2nd segment + The 2nd point of the 2nd segment + + + + Computes the intersection of two line segments, one defined by and , + the other by and . + + The 1st point of the 1st segment + The 2nd point of the 1st segment + The 1st point of the 2nd segment + The 2nd point of the 2nd segment + + + Don't use this function directly, it is not meant for public use. + Please call + and test or along with and + . + + + + + + + + Gets a value indicating if the intersection is an end-point intersection + + + + + Tests whether the input geometries intersect. + + true if the input geometries intersect. + + + + Returns the number of intersection points found. This will be either 0, 1 or 2. + + The number of intersection points found (0, 1, or 2) + + + + Returns the intIndex'th intersection point. + + is 0 or 1. + The intIndex'th intersection point. + + + + Computes the values. + + + + + Test whether a point is a intersection point of two line segments. + Note that if the intersection is a line segment, this method only tests for + equality with the endpoints of the intersection segment. + It does not return true if the input point is internal to the intersection segment. + + true if the input point is one of the intersection points. + + + + Tests whether either intersection point is an interior point of one of the input segments. + + + true if either intersection point is in the interior of one of the input segment. + + + + + Tests whether either intersection point is an interior point of the specified input segment. + + + true if either intersection point is in the interior of the input segment. + + + + + Tests whether an intersection is proper. + The intersection between two line segments is considered proper if + they intersect in a single point in the interior of both segments + (e.g. the intersection is a single point and is not equal to any of the endpoints). + The intersection between a point and a line segment is considered proper + if the point lies in the interior of the segment (e.g. is not equal to either of the endpoints). + + true if the intersection is proper. + + + + Computes the intIndex'th intersection point in the direction of + a specified input line segment. + + is 0 or 1. + is 0 or 1. + + The intIndex'th intersection point in the direction of the specified input line segment. + + + + + Computes the index (order) of the intIndex'th intersection point in the direction of + a specified input line segment. + + is 0 or 1. + is 0 or 1. + + The index of the intersection point along the segment (0 or 1). + + + + + Computes the intersection line index + + The segment index + + + + Computes the "edge distance" of an intersection point along the specified input line segment. + + is 0 or 1. + is 0 or 1. + The edge distance of the intersection point. + + + + Determines the of s relative to + an areal geometry, using indexing for efficiency. + This algorithm is suitable for use in cases where + many points will be tested against a given area. + + The Location is computed precisely, th that points + located on the geometry boundary or segments will + return . + + and geometries are supported. + + The index is lazy-loaded, which allows + creating instances even if they are not used. + + Thread-safe and immutable. + + Martin Davis + + + + Creates a new locator for a given . + and geometries are supported + + The Geometry to locate in + + + + Determines the of a point in an areal . + + The point to test + The location of the point in the geometry + + + + + Creates the indexed geometry, creating it if necessary. + + + + + An interface for classes which determine the of + points in areal geometries. + + Martin Davis + + + + Determines the of a point in an areal . + + The point to test + The location of the point in the geometry + + + + Static methods for classes + + + + + Convenience method to test a point for intersection with a geometry + + The geometry is wrapped in a class. + + The locator to use. + The coordinate to test. + true if the point is in the interior or boundary of the geometry. + + + + Computes the location of points + relative to an areal , + using a simple O(n) algorithm. + + The algorithm used reports + if a point lies in the interior, exterior, + or exactly on the boundary of the Geometry. + + + Instance methods are provided to implement + the interface . + However, they provide no performance + advantage over the class methods. + + + This algorithm is suitable for use in cases where + only a few points will be tested. + If many points will be tested, + may provide better performance. + + + The algorithm used is only guaranteed to return correct results for points which are not on the boundary of the Geometry. + + + + Determines the of a point in an areal . + The return value is one of: + + if the point is in the geometry interior + if the point lies exactly on the boundary + if the point is outside the geometry + + + The point to test + The areal geometry to test + The Location of the point in the geometry + + + + Determines whether a point is contained in a , + or lies on its boundary. + This is a convenience method for + + Location.Exterior != Locate(p, geom) + + + The point to test. + The geometry to test. + if the point lies in or on the geometry. + + + + Determines whether a point lies in a . + If the point lies on the polygon boundary it is + considered to be inside. + + The point to test + The areal geometry to test + true if the point lies in the polygon + + + + Determines whether a point lies in a LinearRing, using the ring envelope to short-circuit if possible. + + The point to test + A linear ring + true if the point lies inside the ring + + + + Initializes a new instance of the class, + using the provided areal geometry. + + The areal geometry to locate in. + + + + Determines the of a point in an areal . + The return value is one of: + + if the point is in the geometry interior + if the point lies exactly on the boundary + if the point is outside the geometry + + + The point to test + The Location of the point in the geometry. + + + + Measures the degree of similarity between two s + using the area of intersection between the geometries. + The measure is normalized to lie in the range [0, 1]. + Higher measures indicate a great degree of similarity. + + + NOTE: Currently experimental and incomplete. + + mbdavis + + + + Computes the similarity measure between two geometries + + A geometry. + A geometry. + + The value of the similarity measure, in [0.0, 1.0]. + + + + + Measures the degree of similarity between two + s using the Fréchet distance metric. + The measure is normalized to lie in the range [0, 1]. + Higher measures indicate a great degree of similarity. + + The measure is computed by computing the Fréchet distance + between the input geometries, and then normalizing + this by dividing it by the diagonal distance across + the envelope of the combined geometries. + + Note: the input should be normalized, especially when + measuring geometries because for the + Fréchet distance the order of {@link Coordinate}s is + important. + + Felix Obermaier + + + + Creates an instance of this class + + + + + + + + Measures the degree of similarity between two s using the Hausdorff distance metric. + + + + The measure is normalized to lie in the range [0, 1]. Higher measures indicate a great degree of similarity. + + + The measure is computed by computing the Hausdorff distance between the input geometries, and then normalizing + this by dividing it by the diagonal distance across the envelope of the combined geometries. + + + mbdavis + + + + + + + + + + + An interface for classes which measures the degree of similarity between two {@link Geometry}s. + + + The computed measure lies in the range [0, 1]. + Higher measures indicate a great degree of similarity. + A measure of 1.0 indicates that the input geometries are identical + A measure of 0.0 indicates that the geometries have essentially no similarity. + The precise definition of "identical" and "no similarity" may depend on the exact algorithm being used. + + mbdavis + + + + Function to measure the similarity between two s. + + A geometry + A geometry + The similarity value between two s + + + + Provides methods to mathematically combine values. + + Martin Davis + + + + + + + + + + + + Computes the Minimum Bounding Circle (MBC) for the points in a . + The MBC is the smallest circle which covers all the input points + (this is also sometimes known as the Smallest Enclosing Circle). + This is equivalent to computing the Maximum Diameter of the input point set. + + + + The computed circle can be specified in two equivalent ways, + both of which are provide as output by this class: + + As a centre point and a radius + By the set of points defining the circle. + Depending on the number of points in the input + and their relative positions, this set + contains from 0 to 3 points. + + 0 or 1 points indicate an empty or trivial input point arrangement. + 2 points define the diameter of the minimum bounding circle. + 3 points define an inscribed triangle of the minimum bounding circle. + + + + The class can also output a which approximates the + shape of the Minimum Bounding Circle (although as an approximation + it is not guaranteed to cover all the input points.) + + The Maximum Diameter of the input point set can + be computed as well. The Maximum Diameter is + defined by the pair of input points with maximum distance between them. + The points of the maximum diameter are two of the extremal points of the Minimum Bounding Circle. + They lie on the convex hull of the input. + However, that the maximum diameter is not a diameter + of the Minimum Bounding Circle in the case where the MBC is + defined by an inscribed triangle. + + Martin Davis + + + + Creates a new object for computing the minimum bounding circle for the + point set defined by the vertices of the given geometry. + + The geometry to use to obtain the point set + + + + Gets a geometry which represents the Minimum Bounding Circle. + + + + If the input is degenerate (empty or a single unique point), + this method will return an empty geometry or a single Point geometry. + Otherwise, a Polygon will be returned which approximates the + Minimum Bounding Circle. (Note that because the computed polygon is only an approximation, it may not precisely contain all the input points.) + + + A Geometry representing the Minimum Bounding Circle. + + + Gets a geometry representing the maximum diameter of the + input. The maximum diameter is the longest line segment + between any two points of the input. + + The points are two of the extremal points of the Minimum Bounding Circle. + They lie on the convex hull of the input. + + + The result is + + a LineString between the two farthest points of the input + a empty LineString if the input is empty + a Point if the input is a point + + + + + + Gets a geometry representing a line between the two farthest points + in the input. + + These points are two of the extremal points of the Minimum Bounding Circle + They lie on the convex hull of the input. + + A LineString between the two farthest points of the input + An empty LineString if the input is empty + A Point if the input is a point + + + + Finds the farthest pair out of 3 extremal points + + The array of extremal points + The pair of farthest points + + + + Gets a geometry representing the diameter of the computed Minimum Bounding Circle. + + + + the diameter line of the Minimum Bounding Circle + an empty line if the input is empty + a Point if the input is a point + + + + + + Gets the extremal points which define the computed Minimum Bounding Circle. + There may be zero, one, two or three of these points, depending on the number + of points in the input and the geometry of those points. + + 0 or 1 points indicate an empty or trivial input point arrangement. + 2 points define the diameter of the Minimum Bounding Circle. + 3 points define an inscribed triangle of which the Minimum Bounding Circle is the circumcircle. + The longest chords of the circle are the line segments [0-1] and[1 - 2] + + + The points defining the Minimum Bounding Circle + + + + Gets the centre point of the computed Minimum Bounding Circle. + + + + The centre point of the Minimum Bounding Circle or + null if the input is empty + + + + + + Gets the radius of the computed Minimum Bounding Circle. + + The radius of the Minimum Bounding Circle + + + + Computes the minimum diameter of a . + + + + The minimum diameter is defined to be the + width of the smallest band that contains the point, + where a band is a strip of the plane defined + by two parallel lines. + This can be thought of as the smallest hole that the point can be + moved through, with a single rotation. + + + The first step in the algorithm is computing the convex hull of the Geometry. + If the input Geometry is known to be convex, a hint can be supplied to + avoid this computation. + + + This class can also be used to compute a line segment representing + the minimum diameter, the supporting line segment of the minimum diameter, + and a minimum rectangle enclosing the input geometry. + This rectangle will + have width equal to the minimum diameter, and have one side + parallel to the supporting segment. + + + + + + + Gets the minimum rectangle enclosing a geometry. + + The geometry + The minimum rectangle enclosing the geometry + + + + Gets the minimum diameter enclosing a geometry. + + The geometry + The length of the minimum diameter of the geometry + + + + Compute a minimum diameter for a given . + + a Geometry. + + + + Compute a minimum diameter for a giver Geometry, + with a hint if + the Geometry is convex + (e.g. a convex Polygon or LinearRing, + or a two-point LineString, or a Point). + + a Geometry which is convex. + true if the input point is convex. + + + + Gets the length of the minimum diameter of the input Geometry. + + The length of the minimum diameter. + + + + Gets the Coordinate forming one end of the minimum diameter. + + A coordinate forming one end of the minimum diameter. + + + + Gets the segment forming the base of the minimum diameter. + + The segment forming the base of the minimum diameter. + + + + Gets a LineString which is a minimum diameter. + + A LineString which is a minimum diameter. + + + + + + + + + + + + + + + Compute the width information for a ring of Coordinates. + Leaves the width information in the instance variables. + + + + + + + + + + + + + + + + + + + + + + + Gets the minimum rectangular which encloses the input geometry. + + + + The rectangle has width equal to the minimum diameter, and a longer length. + If the convex hull of the input is degenerate (a line or point) a or is returned. + + + The minimum rectangle can be used as an extremely generalized representation for the given geometry. + + + The minimum rectangle enclosing the input (or a line or point if degenerate) + + + + + + + + + + + + + + Functions to compute the orientation of basic geometric structures + including point triplets(triangles) and rings. + Orientation is a fundamental property of planar geometries + (and more generally geometry on two-dimensional manifolds). + + Determining triangle orientation + is notoriously subject to numerical precision errors + in the case of collinear or nearly collinear points. + NTS uses extended-precision arithmetic to increase + the robustness of the computation. + + + Martin Davis + + + + + Returns the orientation index of the direction of the point relative to + a directed infinite line specified by p1->p2. + The index indicates whether the point lies to the + or of the line, or lies on it . + The index also indicates the orientation of the triangle formed by the three points + (, , or + ) + + The origin point of the line vector + The final point of the line vector + The point to compute the direction to + + The of q in regard to the vector p1->p2 + + + ValueDescription + + + , + is collinear with p1->p2 + + + , + is clockwise (right) from p1->p2 + + + , + is counter-clockwise (left) from p1->p2 + + + + + + + Tests if a ring defined by an array of s is + oriented counter-clockwise. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments (in particular, along the top of the ring). + + This algorithm is guaranteed to work with valid rings. + It also works with "mildly invalid" rings + which contain collapsed(coincident) flat segments along the top of the ring. + If the ring is "more" invalid (e.g.self-crosses or touches), + the computed result may not be correct. + + An array of Coordinates forming a ring (with first and last point identical) + true if the ring is oriented counter-clockwise. + + + + Tests if a ring defined by a is + oriented counter-clockwise. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments (in particular, along the top of the ring). + + This algorithm is guaranteed to work with valid rings. + It also works with "mildly invalid" rings + which contain collapsed(coincident) flat segments along the top of the ring. + If the ring is "more" invalid (e.g.self-crosses or touches), + the computed result may not be correct. + + A CoordinateSequences forming a ring (with first and last point identical). + true if the ring is oriented counter-clockwise. + + + + Tests if a ring defined by an array of s is + oriented counter-clockwise, using the signed area of the ring. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments + (in particular, along the top of the ring). + This handles rings which are invalid due to self-intersection + + This algorithm is guaranteed to work with valid rings. + For invalid rings (containing self-intersections), + the algorithm determines the orientation of + the largest enclosed area (including overlaps). + This provides a more useful result in some situations, such as buffering. + + However, this approach may be less accurate in the case of + rings with almost zero area. + (Note that the orientation of rings with zero area is essentially + undefined, and hence non-deterministic.) + + An array of Coordinates forming a ring (with first and last point identical) + true if the ring is oriented counter-clockwise. + + + + Tests if a ring defined by a is + oriented counter-clockwise, using the signed area of the ring. + + The list of points is assumed to have the first and last points equal. + This handles coordinate lists which contain repeated points. + This handles rings which contain collapsed segments + (in particular, along the top of the ring). + This handles rings which are invalid due to self-intersection + + This algorithm is guaranteed to work with valid rings. + For invalid rings (containing self-intersections), + the algorithm determines the orientation of + the largest enclosed area (including overlaps). + This provides a more useful result in some situations, such as buffering. + + However, this approach may be less accurate in the case of + rings with almost zero area. + (Note that the orientation of rings with zero area is essentially + undefined, and hence non-deterministic.) + + An array of Coordinates forming a ring (with first and last point identical) + true if the ring is oriented counter-clockwise. + + + + Re-orients an orientation. + + The orientation + + + + + Angle orientation + + + + A value that indicates an orientation of collinear, or no turn (straight) + + + A value that indicates an orientation of collinear, or no turn (straight) + + + A value that indicates an orientation of collinear, or no turn (straight) + + + A value that indicates an orientation of counterclockwise, or a left turn. + + + A value that indicates an orientation of counterclockwise, or a left turn. + + + A value that indicates an orientation of clockwise or a right turn. + + + A value that indicates an orientation of clockwise or a right turn. + + + + Functions for locating points within basic geometric + structures such as lines and rings. + + Martin Davis + + + + Tests whether a point lies on the line defined by a list of + coordinates. + + The point to test + The line coordinates + + true if the point is a vertex of the line or lies in the interior + of a line segment in the line + + + + + Tests whether a point lies on the line defined by a list of + coordinates. + + The point to test + The line coordinates + + true if the point is a vertex of the line or lies in the interior + of a line segment in the line + + + + + Tests whether a point lies inside or on a ring. The ring may be oriented in + either direction. A point lying exactly on the ring boundary is considered + to be inside the ring. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + An array of coordinates representing the ring (which must have + first point identical to last point) + true if p is inside ring + + + + + Tests whether a point lies inside or on a ring. The ring may be oriented in + either direction. A point lying exactly on the ring boundary is considered + to be inside the ring. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + A CoordinateSequence representing the ring (which must have + first point identical to last point) + true if p is inside ring + + + + Determines whether a point lies in the interior, on the boundary, or in the + exterior of a ring.The ring may be oriented in either direction. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + A CoordinateSequence representing the ring (which must have + first point identical to last point) + the of p relative to the ring + + + + Determines whether a point lies in the interior, on the boundary, or in the + exterior of a ring.The ring may be oriented in either direction. + + This method does not first check the point against the envelope of + the ring. + + The point to check for ring inclusion + A CoordinateSequence representing the ring (which must have + first point identical to last point) + + + + Computes the topological relationship () of a single point to a Geometry. + + + A may be specified to control the evaluation of whether the point lies on the boundary or not + The default rule is to use the SFS Boundary Determination Rule + + Notes: + + s do not enclose any area - points inside the ring are still in the EXTERIOR of the ring. + + Instances of this class are not reentrant. + + + + + + Initializes a new instance of the class. + The default boundary rule is . + + + + + Initializes a new instance of the class using the provided + boundary rule. + + The boundary rule to use. + + + + Convenience method to test a point for intersection with a Geometry + + The coordinate to test. + The Geometry to test. + true if the point is in the interior or boundary of the Geometry. + + + + Computes the topological relationship ({Location}) of a single point to a Geometry. + It handles both single-element and multi-element Geometries. + The algorithm for multi-part Geometries takes into account the boundaryDetermination rule. + + The Location of the point relative to the input Geometry. + + + + Counts the number of segments crossed by a horizontal ray extending to the right + from a given point, in an incremental fashion. + This can be used to determine whether a point lies in a geometry. + The class determines the situation where the point lies exactly on a segment. + When being used for Point-In-Polygon determination, this case allows short-circuiting the evaluation. + + + This class handles polygonal geometries with any number of shells and holes. + The orientation of the shell and hole rings is unimportant. + In order to compute a correct location for a given polygonal geometry, + it is essential that all segments are counted which + + touch the ray + lie in in any ring which may contain the point + + + The only exception is when the point-on-segment situation is detected, in which + case no further processing is required. + The implication of the above rule is that segments which can be a priori determined to not touch the ray + (i.e. by a test of their bounding box or Y-extent) do not need to be counted. This allows for optimization by indexing. + + + This implementation uses the extended-precision orientation test, + to provide maximum robustness and consistency within + other algorithms. + + + Martin Davis + + + + Determines the of a point in a ring. + This method is an exemplar of how to use this class. + + The point to test + An array of Coordinates forming a ring + The location of the point in the ring + + + + Determines the of a point in a ring. + + The point to test + A coordinate sequence forming a ring + The location of the point in the ring + + + + Creates an instance of this class + + A coordinate. + + + + Counts a segment + + An endpoint of the segment + Another endpoint of the segment + + + + Reports whether the point lies exactly on one of the supplied segments. + + + This method may be called at any time as segments are processed. If the result of this method is true, + no further segments need be supplied, since the result will never change again. + + + + + Gets the of the point relative to the ring, polygon + or multipolygon from which the processed segments were provided. + + + This property only determines the correct location + if all relevant segments have been processed. + + + + + Tests whether the point lies in or on + the ring, polygon or multipolygon from which the processed + segments were provided. + + + This property only determines the correct location + if all relevant segments have been processed + + + + + Computes whether a rectangle intersects line segments. + + + Rectangles contain a large amount of inherent symmetry + (or to put it another way, although they contain four + coordinates they only actually contain 4 ordinates + worth of information). + The algorithm used takes advantage of the symmetry of + the geometric situation + to optimize performance by minimizing the number + of line intersection tests. + + Martin Davis + + + + Creates a new intersector for the given query rectangle, + specified as an . + + The query rectangle, specified as an Envelope + + + + Tests whether the query rectangle intersects a given line segment. + + The first endpoint of the segment + The second endpoint of the segment + true if the rectangle intersects the segment + + + + Implements an algorithm to compute the + sign of a 2x2 determinant for double precision values robustly. + It is a direct translation of code developed by Olivier Devillers. + + The original code carries the following copyright notice: + ************************************************************************ + Author : Olivier Devillers + Olivier.Devillers@sophia.inria.fr + http:/www.inria.fr:/prisme/personnel/devillers/anglais/determinant.html + + Olivier Devillers has allowed the code to be distributed under + the LGPL (2012-02-16) saying "It is ok for LGPL distribution." + + ************************************************************************* + ************************************************************************* + Copyright (c) 1995 by INRIA Prisme Project + BP 93 06902 Sophia Antipolis Cedex, France. + All rights reserved + ************************************************************************* + + + + + Computes the sign of the determinant of the 2x2 matrix with the given entries, in a robust way. + + + + + + + + -1 if the determinant is negative, + 1 if the determinant is positive, + 0 if the determinant is null. + + + + + + Returns the index of the direction of the point q relative to + a vector specified by p1-p2. + + The origin point of the vector + The final point of the vector + the point to compute the direction to + + + 1 if q is counter-clockwise (left) from p1-p2 + -1 if q is clockwise (right) from p1-p2 + 0 if q is collinear with p1-p2 + + + + + A robust version of . + + + + + + + + + + + + + + + + This method computes the actual value of the intersection point. + To obtain the maximum precision from the intersection calculation, + the coordinates are normalized by subtracting the minimum + ordinate values (in absolute value). This has the effect of + removing common significant digits from the calculation to + maintain more bits of precision. + + + + + + + + + + Computes a segment intersection using homogeneous coordinates. + Round-off error can cause the raw computation to fail, + (usually due to the segments being approximately parallel). + If this happens, a reasonable approximation is computed instead. + + + + + Tests whether a point lies in the envelopes of both input segments. + A correctly computed intersection point should return true + for this test. + Since this test is for debugging purposes only, no attempt is + made to optimize the envelope test. + + + true if the input point lies within both input segment envelopes. + + + + Finds the endpoint of the segments P and Q which + is closest to the other segment. + This is a reasonable surrogate for the true + intersection points in ill-conditioned cases + (e.g. where two segments are nearly coincident, + or where the endpoint of one segment lies almost on the other segment). + + + This replaces the older CentralEndpoint heuristic, + which chose the wrong endpoint in some cases + where the segments had very distinct slopes + and one endpoint lay almost on the other segment. + + an endpoint of segment P + an endpoint of segment P + an endpoint of segment Q + an endpoint of segment Q + the nearest endpoint to the other segment + + + + Gets the Z value of a coordinate if present, or + interpolates it from the segment it lies on. + If the segment Z values are not fully populate + NaN is returned. + + A coordinate, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + The extracted or interpolated Z value (may be NaN) + + + + Interpolates a Z value for a point along + a line segment between two points. + The Z value of the interpolation point (if any) is ignored. + If either segment point is missing Z, + returns NaN. + + A coordinate, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + The extracted or interpolated Z value (may be NaN) + + + + Interpolates a Z value for a point along + two line segments and computes their average. + The Z value of the interpolation point (if any) is ignored. + If one segment point is missing Z that segment is ignored + if both segments are missing Z, returns NaN. + + A coordinate + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + A segment endpoint, possibly with Z + The averaged interpolated Z value (may be NaN) + + + + Structure for a closed 1-dimensional ℝ-interval + + + + + The lower bound of the interval + + + + + The upper bound of the interval + + + + + Initializes this structure with = = + + The value for min and max + + + + Initializes this structure with and values + + The minimum interval values + The maximum interval values + + + + Method to expand + + + + + + + Gets a value if this interval is empty/undefined + + + + + + + + + + + + + + + + + Gets a value indicating the width of the + + + + + Gets a value indicating the centre of the interval (Min + Width * 0.5) + + + + + Function to compute an interval that contains this and + + The interval + An interval + + + + Function to test if this overlaps . + + The interval to test + true if this interval overlaps + + + + Function to test if this overlaps the interval ℝ[, ]. + + The minimum value of the interval + The maximum value of the interval + true if this interval overlaps the interval ℝ[, ] + + + + Function to test if this contains . + + This is more rigid than + The interval to test + true if this interval contains + + + + Function to test if this contains the interval ℝ[, ]. + + This is more rigid than + The minimum value of the interval + The maximum value of the interval + true if this interval contains the interval ℝ[, ] + + + + Function to test if this contains the value . + + The value to test + true if this interval contains the value + + + + Function to test if this intersects the interval . + + + + true if this interval intersects + + + + Function to test if this intersects the interval ℝ[, ]. + + The minimum value of the interval + The maximum value of the interval + true if this interval intersects the interval ℝ[, ]. + + + + Creates an empty or uninitialized Interval + + An empty or uninitialized + + + + Creates an interval with the range ℝ[,] + + The value + An + + + + Creates an interval with the range ℝ[,].
+ If necessary, val1 and val2 are exchanged. +
+ The minimum value + The maximum value + An +
+ + + Creates an interval with the range ℝ[,]. + + The template interval + An + + + + Equality operator for s + + The left-hand-side + The right-hand-side + true if the s are equal. + + + + Inequality operator for s + + The left-hand-side + The right-hand-side + true if the s are not equal. + + + + Densifies a geometry by inserting extra vertices along the line segments + contained in the geometry. + All segments in the created densified geometry will be no longer + than the given distance tolerance + (that is, all segments in the output will have length less than or equal to + the distance tolerance). + + + Densified polygonal geometries are guaranteed to be topologically correct. + + The coordinates created during densification respect the input geometry's . + + By default polygonal results are processed to ensure they are valid. + This processing is costly, and it is very rare for results to be invalid. + Validation processing can be disabled by setting the property to false. + + Note: At some future point this class will offer a variety of densification strategies. + + Martin Davis + + + + Densifies a geometry using a given distance tolerance, and respecting the input geometry's . + + The geometry densify + The distance tolerance () + The densified geometry + + + + Densifies a list of coordinates. + + The coordinate list + The densify tolerance + The precision model to apply on the new coordinates + The densified coordinate sequence + + + + Indicates whether areas should be topologically validated. +
Note: JTS name _isValidated +
+
+ + Creates a new densifier instance + The geometry to densify + + + + Gets or sets the distance tolerance for the densification. All line segments + in the densified geometry will be no longer than the distance tolerance. + The distance tolerance must be positive. + + + + + Gets or sets whether polygonal results are processed to ensure they are valid. + + true if polygonal input is validated. + + + + Gets the densified geometry. + + The densified geometry + + + + Indicates whether areas should be topologically validated. +
Note: JTS name _isValidated +
+
+ + + Creates a valid area geometry from one that possibly has bad topology + (i.e. self-intersections). Since buffer can handle invalid topology, but + always returns valid geometry, constructing a 0-width buffer "corrects" + the topology. Note this only works for area geometries, since buffer + always returns areas. This also may return empty geometries, if the input + has no actual area. + + An area geometry possibly containing self-intersections + A valid area geometry + + + + A graph containing s. + + + + + A HalfEdge which carries information + required to support . + + + + + Tests whether this edge is the starting segment + in a LineString being dissolved. + + true if this edge is a start segment + + + + Sets this edge to be the start segment of an input LineString. + + + + + Dissolves the linear components + from a collection of s. + into a set of maximal-length s + in which every unique segment appears once only. + The output linestrings run between node vertices + of the input, which are vertices which have + either degree 1, or degree 3 or greater. + + + Use cases for dissolving linear components + include generalization + (in particular, simplifying polygonal coverages), + and visualization + (in particular, avoiding symbology conflicts when + depicting shared polygon boundaries). + + + This class does NOT node the input lines. + If there are line segments crossing in the input, + they will still cross in the output. + + + + + Dissolves the linear components in a geometry. + + the geometry to dissolve + the dissolved lines + + + + Creates an instance of this class + + + + + Adds a to be dissolved. + Any number of geometries may be added by calling this method multiple times. + Any type of Geometry may be added. The constituent linework will be + extracted to be dissolved. + + geometry to be line-merged + + + + Adds a collection of Geometries to be processed. May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be + extracted. + + the geometries to be line-merged + + + + Gets the dissolved result as a . + + the dissolved lines + + + + For each edge in stack + (which must originate at a node) + extracts the line it initiates. + + + + + Updates the tracked ringStartEdge + if the given edge has a lower origin + (using the standard ordering). + + + Identifying the lowest starting node meets two goals: + * It ensures that isolated input rings are created using the original node and orientation. + * For isolated rings formed from multiple input linestrings, + it provides a canonical node and orientation for the output + (rather than essentially random, and thus hard to test). + + + + + + Builds a line starting from the given edge. + The start edge origin is a node (valence = 1 or >= 3), + unless it is part of a pure ring. + + + A pure ring has no other incident lines. + In this case the start edge may occur anywhere on the ring. + + + The line is built up to the next node encountered, + or until the start edge is re-encountered + (which happens if the edges form a ring). + + + + + + Adds edges around this node to the stack. + + + + + + A graph comprised of s. + It supports tracking the vertices in the graph + via edges incident on them, + to allow efficient lookup of edges and vertices. + + + This class may be subclassed to use a + different subclass of HalfEdge, + by overriding . + If additional logic is required to initialize + edges then + can be overridden as well. + + + + + Creates a single HalfEdge. + Override to use a different HalfEdge subclass. + + the origin location + a new with the given origin + + + + Creates a pair, using the HalfEdge type of the graph subclass + + + + A pair + + + + Adds an edge between the coordinates orig and dest + to this graph. + + + Only valid edges can be added (in particular, zero-length segments cannot be added) + + the edge origin location + the edge destination location + The created edge + null if the edge was invalid and not added + + + + + Test if an the coordinates for an edge form a valid edge (with non-zero length) + + The start coordinate + The end coordinate + true of the edge formed is valid + + + + Inserts an edge not already present into the graph. + + the edge origin location + the edge destination location + an existing edge with same orig (if any) + the created edge + + + + Gets all s in the graph. + Both edges of edge pairs are included. + + An enumeration of the graph edges + + + + Finds an edge in this graph with the given origin + and destination, if one exists. + + the origin location + the destination location + an edge with the given orig and dest, or null if none exists + + + + Builds an edge graph from geometries containing edges. + + + + + Adds the edges of a Geometry to the graph. + May be called multiple times. + Any dimension of Geometry may be added; the constituent edges are extracted. + + geometry to be added + + + + Adds the edges in a collection of s to the graph. + May be called multiple times. + Any dimension of may be added. + + the geometries to be added + + + + Represents a directed component of an edge in an . + HalfEdges link vertices whose locations are defined by s. + HalfEdges start at an origin vertex, + and terminate at a destination vertex. + HalfEdges always occur in symmetric pairs, with the method + giving access to the oppositely-oriented component. + HalfEdges and the methods on them form an edge algebra, + which can be used to traverse and query the topology + of the graph formed by the edges. + + To support graphs where the edges are sequences of coordinates + each edge may also have a direction point supplied. + This is used to determine the ordering + of the edges around the origin. + HalfEdges with the same origin are ordered + so that the ring of edges formed by them is oriented CCW. + + By design HalfEdges carry minimal information + about the actual usage of the graph they represent. + They can be subclassed to carry more information if required. + + HalfEdges form a complete and consistent data structure by themselves, + but an is useful to allow retrieving edges + by vertex and edge location, as well as ensuring + edges are created and linked appropriately. + + Martin Davis + + + + Creates a HalfEdge pair representing an edge + between two vertices located at coordinates p0 and p1. + + a vertex coordinate + a vertex coordinate + the HalfEdge with origin at p0 + + + + Initialize a symmetric pair of halfedges. + Intended for use by + subclasses. + + The edges are initialized to have each other + as the edge, and to have + pointers which point to edge other. + This effectively creates a graph containing a single edge. + + A halfedge + A symmetric halfedge + The initialized edge e0 + + + + Creates an edge originating from a given coordinate. + + the origin coordinate + + + + Links this edge with its sym (opposite) edge. + This must be done for each pair of edges created. + + The sym edge to link. + + + + Initializes this edge with as edge. + + A symmetric half edge. + + + + Gets the origin coordinate of this edge. + + + + + Gets the destination coordinate of this edge. + + + + + Gets a value indicating the X component of the direction vector. + + The X component of the direction vector + + + + Gets a value indicating the Y component of the direction vector. + + The Y component of the direction vector + + + + Gets a value indicating the direction point of this edge. + In the base case this is the dest coordinate + of the edge. + + Subclasses may override to + allow a HalfEdge to represent an edge with more than two coordinates. + + The direction point for the edge + + + + Gets or sets the symmetric (opposite) edge of this edge. + + + + + Gets the next edge CCW around the destination vertex of this edge. + If the destination vertex has degree 1 then this is the Sym edge. + + The next outgoing edge CCW around the destination vertex + + + + Gets the previous edge CW around the origin + vertex of this edge, + with that vertex being its destination. + + It is always true that e.Next.Prev == e + + Note that this requires a scan of the origin edges, + so may not be efficient for some uses. + + The previous edge CW around the origin vertex + + + + Gets the next edge CCW around the origin of this edge, + with the same origin.
+ If the origin vertex has degree 1 then this is the edge itself. + + e.ONext is equal to e.Sym.Next() +
+ The next edge around the origin +
+ + + Finds the edge starting at the origin of this edge + with the given dest vertex, if any. + + the dest vertex to search for + + the edge with the required dest vertex, + if it exists, or null + + + + + Tests whether this edge has the given orig and dest vertices. + + the origin vertex to test + the destination vertex to test + true if the vertices are equal to the ones of this edge + + + + Inserts an edge + into the ring of edges around the origin vertex of this edge, + ensuring that the edges remain ordered CCW. + The inserted edge must have the same origin as this edge. + + the edge to insert + + + + Finds the insertion edge for a edge + being added to this origin, + ensuring that the star of edges + around the origin remains fully CCW. + + The edge being added + The edge to insert after + + + + Insert an edge with the same origin after this one. + Assumes that the inserted edge is in the correct + position around the ring. + + the edge to insert (with same origin) + + + + Tests whether the edges around the origin + are sorted correctly. + Note that edges must be strictly increasing, + which implies no two edges can have the same direction point. + + true if the origin edges are sorted correctly + + + + + Finds the lowest edge around the origin, + using the standard edge ordering. + + The lowest edge around the origin + + + + Compares edges which originate at the same vertex + based on the angle they make at their origin vertex with the positive X-axis. + This allows sorting edges around their origin vertex in CCW order. + + + + + Implements the total order relation. + The angle of edge a is greater than the angle of edge b, + where the angle of an edge is the angle made by + the first segment of the edge with the positive x-axis. + When applied to a list of edges originating at the same point, + this produces a CCW ordering of the edges around the point. + Using the obvious algorithm of computing the angle is not robust, + since the angle calculation is susceptible to round off error. + + + A robust algorithm is: + 1. compare the quadrants the edge vectors lie in. + If the quadrants are different, + it is trivial to determine which edge has a greater angle. + 2. If the vectors lie in the same quadrant, the + function + can be used to determine the relative orientation of the vectors. + + + + + The X component of the distance between the orig and dest vertices. + + + + + The Y component of the distance between the orig and dest vertices. + + + + + Computes a string representation of a HalfEdge. + + + + + Provides a string representation of the edges around + the origin node of this edge. + + + Uses the subclass representation for each edge. + + A string showing the edges around the origin + + + + Computes the degree of the origin vertex. + The degree is the number of edges + originating from the vertex. + + the degree of the origin vertex + + + + Finds the first node previous to this edge, if any. + If no such node exists (i.e. the edge is part of a ring) + then null is returned. + + + an edge originating at the node prior to this edge, if any, + or null if no node exists + + + + + A which supports + marking edges with a boolean flag. + Useful for algorithms which perform graph traversals. + + + + + Sets the mark for the given edge pair to a boolean value. + + an edge of the pair to update + the mark value to set + + + + Marks the edges in a pair. + + an edge of the pair to mark + + + + Creates a new marked edge. + + the coordinate of the edge origin + + + + Marks this edge. + + + + + A Depth object records the topological depth of the sides + of an Edge for up to two Geometries. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Calls GetDepth and SetDepth. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A Depth object is null (has never been initialized) if all depths are null. + + true if depth is null (has never been initialized) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Normalize the depths for each point, if they are non-null. + A normalized depth + has depth values in the set { 0, 1 }. + Normalizing the depths + involves reducing the depths by the same amount so that at least + one of them is 0. If the remaining value is > 0, it is set to 1. + + + + + + + + + + + + + + + + Computes the factor for the change in depth when moving from one location to another. + E.g. if crossing from the to the + the depth decreases, so the factor is -1. + + The current location + The next location + Change of depth moving from to + + + + The depth of each side (position) of this edge. + The 0 element of the array is never used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set depth for a position + + The position to update + The depth at the provided position + + + + + + + + + Gets or sets a value indicating if both Visited + and Sym.Visited are true. + + Setting the property marks both DirectedEdges attached to a given Edge. + + This is used for edges corresponding to lines, which will only + appear oriented in a single direction in the result. + + + + + + + + + + + + + + + + + + + + + + + + + + Gets a value indicating if this edge is a line edge. + It is if + + at least one of the labels is a line label + any labels which are not line labels have all Location = Exterior. + + + true if edge is a line edge + + + + This is an interior Area edge if + its label is an Area label for both Geometries + and for each Geometry both sides are in the interior. + + true if this is an interior Area edge. + + + + Compute the label in the appropriate orientation for this DirEdge. + + + + + Set both edge depths. + One depth for a given side is provided. + The other is computed depending on the Location + transition and the depthDelta of the edge. + + The position to update + The depth at the provided position + + + + Set both edge depths. + One depth for a given side is provided. + The other is computed depending on the Location + transition and the depthDelta of the edge. + + The position to update + The depth at the provided position + + + + + + + + + + + + + + + + A DirectedEdgeStar is an ordered list of outgoing DirectedEdges around a node. + It supports labelling the edges as well as linking the edges to form both + MaximalEdgeRings and MinimalEdgeRings. + + + + + A list of all outgoing edges in the result, in CCW order. + + + + + Insert a directed edge in the list. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compute the labelling for all dirEdges in this star, as well + as the overall labelling. + + + + + + For each dirEdge in the star, merge the label . + + + + + Update incomplete dirEdge labels from the labeling for the node. + + The label to apply + + + + + + + + + + Traverse the star of DirectedEdges, linking the included edges together. + To link two dirEdges, the next pointer for an incoming dirEdge + is set to the next outgoing edge. + DirEdges are only linked if: + they belong to an area (i.e. they have sides) + they are marked as being in the result + Edges are linked in CCW order (the order they are stored). + This means that rings have their face on the Right + (in other words, the topological location of the face is given by the RHS label of the DirectedEdge). + PRECONDITION: No pair of dirEdges are both marked as being in the result. + + + + + + + + + + + + + + + + Traverse the star of edges, maintaining the current location in the result + area at this node (if any). + If any L edges are found in the interior of the result, mark them as covered. + + + + + + + + + + + Compute the DirectedEdge depths for a subsequence of the edge array. + + The last depth assigned (from the R side of the last edge visited). + + + + + + + + + + + + + + + Updates an IM from the label for an edge. + Handles edges from both L and A geometries. + + An intersection matrix + A label + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The depthDelta is the change in depth as an edge is crossed from R to L. + + The change in depth as the edge is crossed from R to L. + + + + + + + + + + + + + + + + + + + + + + + + An Edge is collapsed if it is an Area edge and it consists of + two segments which are equal and opposite (eg a zero-width V). + + true if edge is consisting of two segments + which are equal and of oppose orientation (Zero-width V area edge) + + + + + + + + + + + + + + + + + + + + Adds EdgeIntersections for one or both + intersections found for a segment of an edge to the edge intersection list. + + A line intersector + A segment index + A geometry index + + + + Add an EdgeIntersection for intersection intIndex. + An intersection that falls exactly on a vertex of the edge is normalized + to use the higher of the two possible segmentIndexes. + + A line intersector + A segment index + A geometry index + The intersection index (0 or 1) + + + + Update the IM with the contribution for this component. + A component only contributes if it has a labelling for both parent geometries. + + + + + + Equals is defined to be: + e1 equals e2 + if + the coordinates of e1 are the same or the reverse of the coordinates in e2. + + + + + + + + + Equals is defined to be: + e1 equals e2 + if + the coordinates of e1 are the same or the reverse of the coordinates in e2. + + + + + + + + + + + + + + + + + + + + + + Check if coordinate sequences of the Edges are identical. + + The edge to test + + true if the coordinate sequences of the Edges are identical. + + + + > + + + + + + + + + + + + + + + + Models the end of an edge incident on a node. + + + + EdgeEnds have a direction determined by the direction of the ray from the initial + point to the next point. + + + EdgeEnds are IComparable under the ordering "a has a greater angle with the x-axis than b". + This ordering is used to sort EdgeEnds around a node. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Implements the total order relation: + a has a greater angle with the positive x-axis than b. + + Using the obvious algorithm of simply computing the angle is not robust, + since the angle calculation is obviously susceptible to round off. + + A robust algorithm is: + + first compare the quadrant. If the quadrants + are different, it it trivial to determine which vector is "greater". + if the vectors lie in the same quadrant, the computeOrientation function + can be used to decide the relative orientation of the vectors. + + + An EdgeEnd + The of compared to this . + + + + Subclasses should override this if they are using labels + + + + + + + + + + + + + + + A EdgeEndStar is an ordered list of EdgeEnds around a node. + They are maintained in CCW order (starting with the positive x-axis) around the node + for efficient lookup and topology building. + + + + + A map which maintains the edges in sorted order around the node. + + + + + A list of all outgoing edges in the result, in CCW order. + + + + + The location of the point for this star in Geometry i Areas. + + + + + Insert a EdgeEnd into this EdgeEndStar. + + An EdgeEnd + + + + Insert an EdgeEnd into the map, and clear the edgeList cache, + since the list of edges has now changed. + + An EdgeEnd + An EdgeEnd + + + + The coordinate for the node this star is based at. + + + + + + + + + + Iterator access to the ordered list of edges is optimized by + copying the map collection to a list. (This assumes that + once an iterator is requested, it is likely that insertion into + the map is complete). + + Access to ordered list of edges. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + An EdgeIntersection represents a point on an + edge which intersects with another edge. + The intersection may either be a single point, or a line segment + (in which case this point is the start of the line segment) + The label attached to this intersection point applies to + the edge from this point forwards, until the next + intersection or the end of the edge. + The intersection point must be precise. + + + + + The point of intersection. + + + + + The index of the containing line segment in the parent edge. + + + + + The edge distance of this point along the containing line segment. + + + + + Creates an instance of this class + + The point of intersection + The index of the containing line segment in the parent edge + The edge distance or this point along the containing line segment + + + + + + + Comparison with segment and distance. + + The index of the containing line segment + The distance of this point along the containing line segment + + -1 this EdgeIntersection is located before the argument location, + 0 this EdgeIntersection is at the argument location, + 1 this EdgeIntersection is located after the argument location. + + + + + + + + + + + + + + + + + + + + + A list of edge intersections along an Edge. + + + + + + + + + + + + + + + + Adds an intersection into the list, if it isn't already there. + The input segmentIndex and dist are expected to be normalized. + + The point of intersection + The index of the containing line segment in the parent edge + The edge distance of this point along the containing line segment + The EdgeIntersection found or added. + + + + Returns an iterator of EdgeIntersections. + + + + + + + + + + + + Adds entries for the first and last points of the edge to the list. + + + + + Creates new edges for all the edges that the intersections in this + list split the parent edge into. + Adds the edges to the input list (this is so a single list + can be used to accumulate all split edges for a Geometry). + + + + + + Create a new "split edge" with the section of points between + (and including) the two intersections. + The label for the new edge is the same as the label for the parent edge. + + + + + + + + + + + + + A EdgeList is a list of Edges. It supports locating edges + that are point-wise equals to a target edge. + + + + + An index of the edges, for fast lookup. + + + + + Remove the selected Edge element from the list if present. + + Edge element to remove from list + + + + Insert an edge unless it is already in the list. + + An Edge + + + + + + + + + + + + + + + If there is an edge equal to e already in the list, return it. + Otherwise return null. + + An Edge + + The equal edge, if there is one already in the list, + null otherwise. + + + + + + + + + + + + + + + + + + + + + + + + + If the edge e is already in the list, return its index. + + An Edge + + The index, if e is already in the list, + -1 otherwise. + + + + + + + + + + + Validates that a collection of is correctly noded. + Throws an appropriate exception if an noding error is found. + + Uses to perform the validation. + + + + + + Checks whether the supplied s are correctly noded. + + an enumeration of Edges. + If the SegmentStrings are not correctly noded + + + + Creates a new validator for the given collection of s. + + + + + Checks whether the supplied edges are correctly noded. + + If the SegmentStrings are not correctly noded + + + + + + + + + The directed edge which starts the list of edges for this EdgeRing. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compute a LinearRing from the point list previously collected. + Test if the ring is a hole (i.e. if it is CCW) and set the hole flag + accordingly. + + + + + + + + + + + + + + + + + + + Returns the list of DirectedEdges that make up this EdgeRing. + + A list of DirectedEdges + + + + Collect all the points from the DirectedEdges of this ring into a contiguous list. + + + + + + + + + + + + + + + + + + + + + + + + + + + Merge the RHS label from a DirectedEdge into the label for this EdgeRing. + The DirectedEdge label may be null. This is acceptable - it results + from a node which is NOT an intersection node between the Geometries + (e.g. the end node of a LinearRing). In this case the DirectedEdge label + does not contribute any information to the overall labelling, and is simply skipped. + + + + + + + + + + + + + + + This method will cause the ring to be computed. + It will also check any holes, if they have been assigned. + + The point to test + true if the ring contains point + + + + A GeometryGraph is a graph that models a given Geometry. + + + + + Determine boundary + + The boundary node rule to apply for determination of the boundary + The number of component boundaries that a point occurs in. + or + + + + The lineEdgeMap is a map of the linestring components of the + parentGeometry to the edges which are derived from them. + This is used to efficiently perform findEdge queries + + + + + If this flag is true, the Boundary Determination Rule will used when deciding + whether nodes are in the boundary or not + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the used with this geometry graph. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add a Point to the graph. + + + + + + Adds a polygon ring to the graph. Empty rings are ignored. + The left and right topological location arguments assume that the ring is oriented CW. + If the ring is in the opposite orientation, + the left and right locations must be interchanged. + + + + + + + + + + + + + + + + + + + + Add an Edge computed externally. The label on the Edge is assumed + to be correct. + + An Edge + + + + Add a point computed externally. The point is assumed to be a + Point Geometry part, which has a location of INTERIOR. + + A Coordinate + + + + Compute self-nodes, taking advantage of the Geometry type to + minimize the number of intersection tests. (E.g. rings are + not tested for self-intersection, since they are assumed to be valid). + + The LineIntersector to use. + If false, intersection checks are optimized to not test rings for self-intersection. + The computed SegmentIntersector, containing information about the intersections found. + + + + Compute self-nodes, taking advantage of the Geometry type to + minimize the number of intersection tests. (E.g.rings are + not tested for self-intersection, since they are assumed to be valid). + + The LineIntersector to use + If false, intersection checks are optimized to not test rings for self-intersection + Short-circuit the intersection computation if a proper intersection is found + + + + + + + + + + + + + + + + + + + + + Adds candidate boundary points using the current . + This is used to add the boundary + points of dim-1 geometries (Curves/MultiCurves). + + + + + + + + + + + + + Add a node for a self-intersection. + If the node is a potential boundary node (e.g. came from an edge which + is a boundary) then insert it as a potential boundary node. + Otherwise, just add it as a regular node. + + + + + + + + Determines the of the given in this geometry. + + The point to test + + The location of the point in the geometry + + + + + A GraphComponent is the parent class for the objects' + that form a graph. Each GraphComponent can carry a + Label. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsInResult indicates if this component has already been included in the result. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A coordinate in this component (or null, if there are none). + + + + + Compute the contribution to an IM for this component. + + An IntersectionMatrix + + + + An isolated component is one that does not intersect or touch any other + component. This is the case if the label has valid locations for + only a single Geometry. + + true if this component is isolated. + + + + Update the IM with the contribution for this component. + A component only contributes if it has a labelling for both parent geometries. + + An IntersectionMatrix + + + + An EdgeSetIntersector computes all the intersections between the + edges in the set. It adds the computed intersections to each edge + they are found on. It may be used in two scenarios: + determining the internal intersections between a single set of edges + determining the mutual intersections between two different sets of edges + It uses a SegmentIntersector to compute the intersections between + segments and to record statistics about what kinds of intersections were found. + + + + + Computes all self-intersections between edges in a set of edges, + allowing client to choose whether self-intersections are computed. + + A list of edges to test for intersections. + The SegmentIntersector to use + true if self-intersections are to be tested as well. + + + + Computes all mutual intersections between two sets of edges. + + A set of edges + A set of edges + The SegmentIntersector to use + + + + + + + + + + + + + + + + + + + + + + + MonotoneChains are a way of partitioning the segments of an edge to + allow for fast searching of intersections. + They have the following properties: + the segments within a monotone chain will never intersect each other, and + the envelope of any contiguous subset of the segments in a monotone chain + is simply the envelope of the endpoints of the subset. + Property 1 means that there is no need to test pairs of segments from within + the same monotone chain for intersection. + Property 2 allows + binary search to be used to find the intersection points of two monotone chains. + For many types of real-world data, these properties eliminate a large number of + segment comparisons, producing substantial speed gains. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests whether the envelopes of two chain sections overlap (intersect). + + true if the section envelopes overlap + + + + MonotoneChains are a way of partitioning the segments of an edge to + allow for fast searching of intersections. + + Specifically, a sequence of contiguous line segments + is a monotone chain if all the vectors defined by the oriented segments + lies in the same quadrant. + + Monotone Chains have the following useful properties: + the segments within a monotone chain will never intersect each other, and + the envelope of any contiguous subset of the segments in a monotone chain + is simply the envelope of the endpoints of the subset. + Property 1 means that there is no need to test pairs of segments from within + the same monotone chain for intersection. + Property 2 allows + binary search to be used to find the intersection points of two monotone chains. + For many types of real-world data, these properties eliminate a large number of + segment comparisons, producing substantial speed gains. + + + Note that due to the efficient intersection test, there is no need to limit the size + of chains to obtain fast performance. + + + + + + + + + + + + + The index of the last point in the monotone chain. + + + + + + Computes the intersection of line segments, + and adds the intersection to the edges containing the segments. + + + + + + + + + + + + + Testing only. + + + + + + + + + + + + + + + + + + + + The proper intersection point, or null if none was found. + + + + + + + + + + A proper intersection is an intersection which is interior to at least two + line segments. Note that a proper intersection is not necessarily + in the interior of the entire Geometry, since another edge may have + an endpoint equal to the intersection, which according to SFS semantics + can result in the point being on the Boundary of the Geometry. + + Indicates a proper intersection with an interior to at least two line segments + + + + A proper interior intersection is a proper intersection which is not + contained in the set of boundary nodes set for this SegmentIntersector. + + Indicates a proper interior intersection + + + + A trivial intersection is an apparent self-intersection which in fact + is simply the point shared by adjacent line segments. + Note that closed edges require a special check for the point shared by the beginning + and end segments. + + An Edge + The segment index of + Another Edge + The segment index of + + + + This method is called by clients of the EdgeIntersector class to test for and add + intersections for two segments of the edges being intersected. + Note that clients (such as MonotoneChainEdges) may choose not to intersect + certain pairs of segments for efficiency reasons. + + + + + + + + + + + + + + + + + + + + + + + + + Finds all intersections in one or two sets of edges, + using the straightforward method of + comparing all segments. + This algorithm is too slow for production use, but is useful for testing purposes. + + + + + + + + + + + + + + + + + + + + + Performs a brute-force comparison of every segment in each Edge. + This has n^2 performance, and is about 100 times slower than using + monotone chains. + + + + + + + + Finds all intersections in one or two sets of edges, + using an x-axis sweepline algorithm in conjunction with Monotone Chains. + While still O(n^2) in the worst case, this algorithm + drastically improves the average-case time. + The use of MonotoneChains as the items in the index + seems to offer an improvement in performance over a sweep-line alone. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Because Delete Events have a link to their corresponding Insert event, + it is possible to compute exactly the range of events which must be + compared to a given Insert event object. + + + + + + + + + + + + + + + + + + + + Finds all intersections in one or two sets of edges, + using a simple x-axis sweepline algorithm. + While still O(n^2) in the worst case, this algorithm + drastically improves the average-case time. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Because DELETE events have a link to their corresponding INSERT event, + it is possible to compute exactly the range of events which must be + compared to a given INSERT event object. + + + + + + + + + + + + + + + + + + + + + + + + + Creates an INSERT event. + + The edge set label for this object. + The event location + the object being inserted + + + + Creates a DELETE event. + + The event location + The corresponding INSERT event + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Events are ordered first by their x-value, and then by their eventType. + Insert events are sorted before Delete events, so that + items whose Insert and Delete events occur at the same x-value will be + correctly handled. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A Label indicates the topological relationship of a component + of a topology graph to a given Geometry. + This class supports labels for relationships to two Geometrys, + which is sufficient for algorithms for binary operations. + Topology graphs support the concept of labeling nodes and edges in the graph. + The label of a node or edge specifies its topological relationship to one or + more geometries. (In fact, since NTS operations have only two arguments labels + are required for only two geometries). A label for a node or edge has one or + two elements, depending on whether the node or edge occurs in one or both of the + input Geometrys. Elements contain attributes which categorize the + topological location of the node or edge relative to the parent + Geometry; that is, whether the node or edge is in the interior, + boundary or exterior of the Geometry. Attributes have a value + from the set {Interior, Boundary, Exterior}. In a node each + element has a single attribute On. For an edge each element has a + triplet of attributes Left, On, Right. + It is up to the client code to associate the 0 and 1 TopologyLocations + with specific geometries. + + + + + Converts a Label to a Line label (that is, one with no side Location). + + Label to convert. + Label as Line label. + + + + Construct a Label with a single location for both Geometries. + Initialize the locations to Null. + + A location value + + + + Construct a Label with a single location for both Geometries. + Initialize the location for the Geometry index. + + A geometry index, 0, or 1. + A location value for On + + + + Construct a Label with On, Left and Right locations for both Geometries. + Initialize the locations for both Geometries to the given values. + + A location value for On + A location value for Left + A location value for Right + + + + Construct a Label with On, Left and Right locations for both Geometries. + Initialize the locations for the given Geometry index. + + A geometry index, 0, or 1. + A location value for On + A location value for Left + A location value for Right + + + + Construct a Label with the same values as the argument Label. + + A Label + + + + Performs on both + s of this Label + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Merge this label with another one. + Merging updates any null attributes of this label with the attributes from . + + The Label to merge + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Converts one GeometryLocation to a Line location. + + The index of the TopologyLocation to convert (0 or 1) + + + + + + + + + + + + + + + Only non-null if this node is precise. + + + + + + + + + + + + Gets a value indicating the position of this + + The position of this Node + + + + Gets a value indicating the EdgeEndStar of this Node + + The EdgeEndStar of this Node + + + + Tests whether any incident edge is flagged as + being in the result. + This test can be used to determine if the node is in the result, + since if any incident edge is in the result, the node must be in the result as well. + + true if any incident edge in the in the result + + + + + + + + + Basic nodes do not compute IMs. + + + + + Add the edge to the list of edges at this node. + + An EdgeEnd + + + + Merges 's with this Node's Label. + + A Node + + + + To merge labels for two nodes, + the merged location for each LabelElement is computed. + The location for the corresponding node LabelElement is set to the result, + as long as the location is non-null. + + The Label to merge + + + + + + + + + + + Updates the label of a node to BOUNDARY, + obeying the mod-2 boundaryDetermination rule. + + An index for a (0 or 1) + + + + The location for a given eltIndex for a node will be one + of { Null, Interior, Boundary }. + A node may be on both the boundary and the interior of a point; + in this case, the rule is that the node is considered to be in the boundary. + The merged location is the maximum of the two input values. + + + + + + + + + + + + + + + + + + + A Factory to create s. + + + + + The basic node constructor does not allow for incident edges. + + A Coordinate + The created Node + + + + A map of nodes, indexed by the coordinate of the node. + + + + + Creates an instance of this class using the provided . + + A factory to create Nodes + + + + This method expects that a node has a coordinate value. + + A Coordinate + The Node for the provided Coordinate + + + + Adds a Node to this NodeMap. + If a Node with the same + is already present in this NodeMap, + their s are merged. + + The Node to add + Either or a Node with merged Labels + + + + Adds a node for the start point of this EdgeEnd + (if one does not already exist in this map). + Adds the EdgeEnd to the (possibly new) node. + + An EdgeEnd + + + + Searches for a Node at position. + + A Coordinate + + The node if found; null otherwise. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The computation of the IntersectionMatrix relies on the use of a structure + called a "topology graph". The topology graph contains nodes and edges + corresponding to the nodes and line segments of a Geometry. Each + node and edge in the graph is labeled with its topological location relative to + the source point. + Note that there is no requirement that points of self-intersection be a vertex. + Thus to obtain a correct topology graph, Geometrys must be + self-noded before constructing their graphs. + Two fundamental operations are supported by topology graphs: + Computing the intersections between all the edges and nodes of a single graph + Computing the intersections between the edges and nodes of two different graphs + + + + + For nodes in the Collection, link the DirectedEdges at the node that are in the result. + This allows clients to link only a subset of nodes in the graph, for + efficiency (because they know that only a subset is of interest). + + A collection of Nodes + + + + + + + + + + + + + + + + + + + Creates an instance of this class using the provided + + A factory to create Nodes + + + + Creates an instance of this class using the default . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Searches for a Node at Coordinate position + + A Coordinate position + + The node if found; null otherwise + + + + + Add a set of edges to the graph. For each edge two DirectedEdges + will be created. DirectedEdges are NOT linked by this method. + + A set of Edges to add. + + + + Link the DirectedEdges at the nodes of the graph. + This allows clients to link only a subset of nodes in the graph, for + efficiency (because they know that only a subset is of interest). + + + + + Link the DirectedEdges at the nodes of the graph. + This allows clients to link only a subset of nodes in the graph, for + efficiency (because they know that only a subset is of interest). + + + + + Returns the EdgeEnd which has edge e as its base edge + (MD 18 Feb 2002 - this should return a pair of edges). + + An Edge + The edge, if found null if the edge was not found. + + + + Returns the edge whose first two coordinates are p0 and p1. + + The 1st Coordinate + The 2nd Coordinate + The edge, if found null if the edge was not found. + + + + Returns the edge which starts at p0 and whose first segment is + parallel to p1. + + Starting Coordinate + Coordinate used to establish direction + The matching edge, if found null if the edge was not found. + + + + The coordinate pairs match if they define line segments lying in the same direction. + E.g. the segments are parallel and in the same quadrant + (as opposed to parallel and opposite!). + + + + + + + + + + + + + + + + + + + + An indicator that a Location is on a GraphComponent (0) + + + + + An indicator that a Location is to the left of a GraphComponent (1) + + + + + An indicator that a Location is to the right of a GraphComponent (2) + + + + + An indicator that a Location is is parallel to x-axis of a GraphComponent (-1) + /// + + + + A Position indicates the position of a Location relative to a graph component + (Node, Edge, or Area). + + + + + Returns Positions.Left if the position is Positions.Right, + Positions.Right if the position is Left, or the position + otherwise. + + + + + + Utility functions for working with quadrants, which are numbered as follows: + + 1 | 0 + --+-- + 2 | 3 + + + + + + North-East + + + + + North-West + + + + + South-West + + + + + South-East + + + + + Only static methods! + + + + + Returns the quadrant of a directed line segment (specified as x and y + displacements, which cannot both be 0). + + + + If the displacements are both 0 + + + + Returns the quadrant of a directed line segment from p0 to p1. + + + + if the points are equal + + + + Returns true if the quadrants are 1 and 3, or 2 and 4. + + + + + + + Returns the right-hand quadrant of the halfplane defined by the two quadrants, + or -1 if the quadrants are opposite, or the quadrant if they are identical. + + + + + + + Returns whether the given quadrant lies within the given halfplane (specified + by its right-hand quadrant). + + + + + + + Returns true if the given quadrant is 0 or 1. + + + + + + A TopologyLocation is the labelling of a + GraphComponent's topological relationship to a single Geometry. + + + If the parent component is an area edge, each side and the edge itself + have a topological location. These locations are named: + + Onon the edge + Leftleft-hand side of the edge + Rightright-hand side + + + If the parent component is a line edge or node, there is a single + topological relationship attribute, On. + + The possible values of a topological location are + { , , , } + + The labelling is stored in an array _location[j] where + where j has the values On, Left, Right. + + + + + + + + + + + + Constructs a TopologyLocation specifying how points on, to the left of, and to the + right of some GraphComponent relate to some Geometry. Possible values for the + parameters are Location.Null, Location.Exterior, Location.Boundary, + and Location.Interior. + + Location for On position + Location for Left position + Location for Right position + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get calls Get(Positions posIndex), + Set calls SetLocation(Positions locIndex, Location locValue) + + + + + + + Get calls Get(Positions posIndex), + Set calls SetLocation(Positions locIndex, Location locValue) + + + + + + + true if all locations are Null. + + + + + true if any locations are Null. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Merge updates only the Null attributes of this object + with the attributes of another. + + + + + + + + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane. + + The base data object is suitable for use with coordinate sequences with + dimension = 2 and measures = 0. + + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a Coordinate only contains ordinate values + and properties. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + The value used to indicate a null or missing ordinate value. + In particular, used for the value of ordinates for dimensions + greater than the defined dimension of a coordinate. + + + + + Gets or sets the X-ordinate value. + + + + + Gets or sets the Y-ordinate value. + + + + + Gets or sets the Z-ordinate value, if supported. + If no Z value is present, returns . + + + Thrown if an attempt is made to set the Z-ordinate value on an instance where + the Z-ordinate value is not supported. + + + + + Gets or sets the value of the measure, if supported. + If no measure value is present, returns . + + + Thrown if an attempt is made to set the measure value on an instance where + measures are not supported. + + + + + Constructs a Coordinate at (x,y). + + The X value + The Y value + + + + Constructs a Coordinate at (0,0). + + + + + Constructs a Coordinate having the same (x,y,z) values as + . + + Coordinate to copy. + + + + Gets or sets the value for the given ordinate. + + The ordinate. + The ordinate value + Thrown if is not one of , , , or . + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X) and 1 (Y) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets Coordinates (x,y,z) values. + + + + Gets a value indicating if the Coordinate + has valid x- and y ordinate values + + An ordinate value is valid if it is finite. + + true if the coordinate is valid + + + + + + Predicate to check if a value is finite. + + It is finite if both and return false + + The value to test + value + + + + Returns whether the planar projections of the two Coordinates are equal. + + Coordinate with which to do the 2D comparison. + + true if the x- and y-coordinates are equal; + the Z coordinates do not have to be equal. + + + + + Tests if another Coordinate has the same values for the X and Y ordinates, + within a specified tolerance value. The Z ordinate is ignored. + + A . + The tolerance value to use. + true if the X and Y ordinates are within the given tolerance. + The Z ordinate is ignored. + + + + + + + + + + + Compares this object with the specified object for order. + Since Coordinates are 2.5D, this routine ignores the z value when making the comparison. + Returns + -1 : this.x < other.x || ((this.x == other.x) AND (this.y < other.y)) + 0 : this.x == other.x AND this.y = other.y + 1 : this.x > other.x || ((this.x == other.x) AND (this.y > other.y)) + + Coordinate with which this Coordinate is being compared. + + A negative integer, zero, or a positive integer as this Coordinate + is less than, equal to, or greater than the specified Coordinate. + + + + + Compares this object with the specified object for order. + Since Coordinates are 2.5D, this routine ignores the z value when making the comparison. + Returns + -1 : this.x < other.x || ((this.x == other.x) AND (this.y < other.y)) + 0 : this.x == other.x AND this.y = other.y + 1 : this.x > other.x || ((this.x == other.x) AND (this.y > other.y)) + + Coordinate with which this Coordinate is being compared. + + A negative integer, zero, or a positive integer as this Coordinate + is less than, equal to, or greater than the specified Coordinate. + + + + + Create a copy of this . + + A copy of this coordinate. + + + + Create a Coordinate of the same type as this Coordinate, using the provided values. + + Depending on the actual type the following limitations are in place: + + Coordinate (Sub-)ClassLimitation + Coordinate-parameter and -parameter are silently dropped. + CoordinateZ-parameter is silently dropped. + CoordinateM-parameter is silently dropped. + CoordinateZMNo parameter is dropped. + + + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Computes the 2-dimensional Euclidean distance to another location. + + A with which to do the distance comparison. + the 2-dimensional Euclidean distance between the locations. + The Z-ordinate is ignored. + + + + Returns true if other has the same values for the x and y ordinates. + Since Coordinates are 2.5D, this routine ignores the z value when making the comparison. + + Coordinate with which to do the comparison. + true if other is a Coordinate with the same values for the x and y ordinates. + + + + Gets a hashcode for this coordinate. + + A hashcode for this coordinate. + + + + Returns a string of the form (x,y,z) . + + string of the form (x,y,z) + + + + Useful utility functions for handling Coordinate arrays. + + + + + Determine dimension based on subclass of . + + pts supplied coordinates + number of ordinates recorded + + + + Determine number of measures based on subclass of . + + supplied coordinates + number of measures recorded + + + + Utility method ensuring array contents are of consistent dimension and measures. + + Array is modified in place if required, coordinates are replaced in the array as required + to ensure all coordinates have the same dimension and measures. The final dimension and + measures used are the maximum found when checking the array. + + Modified in place to coordinates of consistent dimension and measures. + + + + Utility method ensuring array contents are of the specified dimension and measures. + + Array is returned unmodified if consistent, or a copy of the array is made with + each inconsistent coordinate duplicated into an instance of the correct dimension and measures. + + A coordinate array + + + Input array or copy created if required to enforce consistency. + + + + Tests whether an array of s forms a ring, by checking length and closure. + Self-intersection is not checked. + + An array of Coordinates + true if the coordinate form a ring. + + + + Finds a in a list of s + which is not contained in another list of s. + + The s to test. + An array of s to test the input points against. + + A from + which is not in , or null. + + + + + Compares two arrays + in the forward direction of their coordinates, + using lexicographic ordering. + + + + + + + + Determines which orientation of the array is (overall) increasing. + In other words, determines which end of the array is "smaller" + (using the standard ordering on ). + Returns an integer indicating the increasing direction. + If the sequence is a palindrome, it is defined to be + oriented in a positive direction. + + The array of Coordinates to test. + + 1 if the array is smaller at the start or is a palindrome, + -1 if smaller at the end. + + + + + Determines whether two arrays of equal length + are equal in opposite directions. + + + + + + + + Creates a deep copy of the argument Coordinate array. + + Array of Coordinates. + Deep copy of the input. + + + + Creates a deep copy of a given section of a source array into a destination Coordinate array. + The destination array must be an appropriate size to receive the copied coordinates. + + An array of Coordinates + The index to start copying from + The array to receive the deep-copied coordinates + The destination index to start copying to + The number of items to copy + + + + Converts the given of + s into a array. + + of coordinates. + + + + + Returns whether returns true + for any two consecutive coordinates in the given array. + + An array of Coordinates. + true if coord has repeated points; false otherwise. + + + + Returns either the given coordinate array if its length is greater than + the given amount, or an empty coordinate array. + + Length amount. + Array of Coordinates. + New Coordinate array. + + + + If the coordinate array argument has repeated points, + constructs a new array containing no repeated points. + Otherwise, returns the argument. + + An array of Coordinates + The array with repeated coordinates removed + + + + Tests whether an array has any repeated or invalid coordinates. + + An array of coordinates + true if the array contains repeated or invalid coordinates + + + + + If the coordinate array argument has repeated or invalid points, + constructs a new array containing no repeated points. + Otherwise, returns the argument. + + An array of coordinates + The array with repeated or invalid coordinates removed. + + + + + + Collapses a coordinate array to remove all null elements. + + The coordinate array to collapse + An Array containing only non-null elements + + + + Reverses the coordinates in an array in-place. + + Array of Coordinates. + + + + Returns true if the two arrays are identical, both null, or pointwise + equal (as compared using Coordinate.Equals). + + First array of Coordinates. + Second array of Coordinates. + true if two Coordinates array are equals; false otherwise + + + + Compares two arrays + in the forward direction of their coordinates, + using lexicographic ordering. + + + + + Compares the specified s arrays. + + An array of coordinates + An array of coordinates + + + + A comparator for arrays modulo their directionality. + E.g. if two coordinate arrays are identical but reversed + they will compare as equal under this ordering. + If the arrays are not equal, the ordering returned + is the ordering in the forward direction. + + + + + Compares the specified s arrays. + + An array of coordinates + An array of coordinates + + + + + + + Returns true if the two arrays are identical, both null, or pointwise + equal, using a user-defined + for s. + + An array of s. + Another array of s. + + A for s. + + + + + + Returns the minimum coordinate, using the usual lexicographic comparison. + + Array to search. + The minimum coordinate in the array, found using CompareTo. + + + + Shifts the positions of the coordinates until firstCoordinate is first. + + Array to rearrange. + Coordinate to make first. + + + + Shifts the positions of the coordinates until the coordinate + at indexOfFirstCoordinate is first. + + The array of coordinates to arrange + The index of the coordinate to make first + + + + Shifts the positions of the coordinates until the coordinate + at indexOfFirstCoordinate is first. + + + If is true, first and last + coordinate of the returned array are equal. + + The array of coordinates to arrange + The index of the coordinate to make first + A flag indicating if returned array should form a ring. + + + + Returns the index of in . + The first position is 0; the second is 1; etc. + + A to search for. + A array to search. + The position of coordinate, or -1 if it is not found. + + + + Extracts a subsequence of the input array + from indices to (inclusive). + The input indices are clamped to the array size; + If the end index is less than the start index, + the extracted array will be empty. + + The input array. + The index of the start of the subsequence to extract. + The index of the end of the subsequence to extract. + A subsequence of the input array. + + + + Computes the of the coordinates. + + the array to scan. + the of the . + + + + Extracts the coordinates which intersect an . + + The coordinates to scan + The envelope to intersect with + An array of coordinates which intersect with the envelope + + + + A class that can be used to test coordinates for equality. + + It uses the algorithm that was default for NTS prior to v2.2, + i.e. checks if the 2d distance between coordinates x + and y is less than or equal to a tolerance value. + + + + + + + + Compares s and for equality allowing for a . + + A Coordinate + A Coordinate + A tolerance value. + true if and can be considered equal; otherwise false. + + + + + + + Method to test 2 s for equality, allowing a tolerance. + + The 1st Coordinate + The 2nd Coordinate + A tolerance value + true if and can be considered equal. + + + + A class that can be used to test coordinates for equality. + + This class test for each ordinate if the distance is less + than a tolerance value. + + + + + Method to test 2 s for equality, allowing a tolerance. + + The 1st Coordinate + The 2nd Coordinate + A tolerance value + true if and can be considered equal. + + + + Computes the distance between two values + + 1st double + 2nd double + The distance between and + + + + A list of Coordinates, which may + be set to prevent repeated coordinates from occurring in the list. + + + + + Constructs a new list without any coordinates + + + + + Constructs a new list without any coordinates but an initial capacity + + The initial capacity of the list. + + + + Constructs a new list from an array of Coordinates, allowing repeated points. + (I.e. this constructor produces a with exactly the same set of points + as the input array.) + + Initial coordinates + + + + Constructs a new list from a collection of Coordinates, + allows repeated points. + + Collection of coordinates to load into the list. + + + + Constructs a new list from a collection of Coordinates, + allowing caller to specify if repeated points are to be removed. + + Collection of coordinates to load into the list. + If false, repeated points are removed. + + + + Constructs a new list from an array of Coordinates, + allowing caller to specify if repeated points are to be removed. + + Array of coordinates to load into the list. + If false, repeated points are removed. + + + + Returns the coordinate at specified index. + + Coordinate index. + Coordinate specified. + + + + Adds a section of an array of coordinates to the list. + + The coordinates + If set to false, repeated coordinates are collapsed + The index to start from + The index to add up to but not including + true (as by general collection contract) + + + + Adds an array of coordinates to the list. + + Coordinates to be inserted. + If set to false, repeated coordinates are collapsed. + If false, the array is added in reverse order. + Return true. + + + + Adds an array of coordinates to the list. + + Coordinates to be inserted. + If set to false, repeated coordinates are collapsed. + Return true. + + + + Adds a coordinate to the list. + + Coordinate to be inserted, as object. + If set to false, repeated coordinates are collapsed. + Return true. + + + + Adds a coordinate to the end of this list. + + Coordinate to be inserted. + If set to false, repeated coordinates are collapsed. + Return true if all ok. + + + + Inserts the specified coordinate at the specified position in this list. + + The position at which to insert + the coordinate to insert + if set to false, repeated coordinates are collapsed + + + + Add an array of coordinates. + + Coordinates collection to be inserted. + If set to false, repeated coordinates are collapsed. + Return true if at least one element has added (IList not empty). + + + + Ensure this coordList is a ring, by adding the start point if necessary. + + + + + Returns the Coordinates in this collection. + + Coordinates as Coordinate[] array. + + + + Creates an array containing the coordinates in this list, + oriented in the given direction (forward or reverse). + + The direction value: true for forward, false for reverse + An oriented array of coordinates + + + + Returns a deep copy of this collection. + + The copied object. + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane + and an additional measure () value. + + This data object is suitable for use with coordinate sequences with + dimension = 3 and measures = 1. + + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a CoordinateM only contains ordinate values + and properties. + + CoordinateMs are two-dimensional points, with an additional M-ordinate. + If an M-ordinate value is not specified or not defined, + constructed coordinates have a M-ordinate of NaN + (which is also the value of ). + Apart from the basic accessor functions, NTS supports + only specific operations involving the M-ordinate. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + Gets or sets the M-ordinate value. + + + + + Constructs a CoordinateM at (x,y,z). + + The X value + The Y value + The measure value + + + + Constructs a CoordinateM at (0,0,NaN). + + + + + Constructs a CoordinateM having the same (x,y) values as + . + + Coordinate to copy. + + + + Constructs a CoordinateM at (x,y,NaN). + + X value. + Y value. + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X), 1 (Y) and 2 (M) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets CoordinateMs (x,y,z) values. + + + + + Create a Coordinate of the same type as this Coordinate, + using the provided values for , and . + + A provided value for will be silently dropped. + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Returns a string of the form (x, y, m=m). + + string of the form (x, y, m=m) + + + + Useful utility functions for handling Coordinate objects. + + + + + Factory method providing access to common Coordinate implementations. + + + created coordinate + + + + Factory method providing access to common Coordinate implementations. + + + + created coordinate + + + + Determine dimension based on subclass of . + + supplied coordinate + number of ordinates recorded + + + + Determine number of measures based on subclass of . + + supplied coordinate + number of measures recorded + + + + + + + Initializes a new instance of the class. + + The value for . + The value for . + The value for . + + Thrown when any argument is negative. + + + Thrown when and specify fewer + than two (2) spatial dimensions. + + + + + Returns the dimension (number of ordinates in each coordinate) for this sequence. + + This total includes any measures, indicated by non-zero . + + + + + + Gets the number of measures included in for each coordinate for this + sequence. + + + For a measured coordinate sequence a non-zero value is returned. + + For sequence measures is zero + For sequence measure is one + For sequence measure is zero + For sequence measure is one + Values greater than one are supported + + + + + + Gets the number of non-measure dimensions included in for each + coordinate for this sequence. + + Equivalent to Dimension - Measures. + + + + + + Gets the kind of ordinates this sequence supplies. + + + + + Gets a value indicating if is supported. + + + + + Gets a value indicating if is supported. + + + + + Gets the index of the Z ordinate (for use with or + ), or -1 if is + . + + + It's just a cache for with . + + + + + Gets the index of the M ordinate (for use with or + ), or -1 if is + . + + + It's just a cache for with . + + + + + Creates a coordinate for use in this sequence. + + + The coordinate is created supporting the same number of and + as this sequence and is suitable for use with . + + A coordinate for use with this sequence + + + + Returns (possibly a copy of) the ith Coordinate in this collection. + Whether or not the Coordinate returned is the actual underlying + Coordinate or merely a copy depends on the implementation. + Note that in the future the semantics of this method may change + to guarantee that the Coordinate returned is always a copy. Callers are + advised not to assume that they can modify a CoordinateSequence by + modifying the Coordinate returned by this method. + + + + + + + Returns a copy of the i'th coordinate in this sequence. + This method optimizes the situation where the caller is + going to make a copy anyway - if the implementation + has already created a new Coordinate object, no further copy is needed. + + The index of the coordinate to retrieve. + A copy of the i'th coordinate in the sequence + + + + Copies the i'th coordinate in the sequence to the supplied Coordinate. + At least the first two dimensions must be copied. + + The index of the coordinate to copy. + A Coordinate to receive the value. + + + + Returns ordinate X (0) of the specified coordinate. + + + The value of the X ordinate in the index'th coordinate. + + + + Returns ordinate Y (1) of the specified coordinate. + + + The value of the Y ordinate in the index'th coordinate. + + + + Returns ordinate Z of the specified coordinate if available. + + + + The value of the Z ordinate in the index'th coordinate, or + if not defined. + + + + + Returns ordinate M of the specified coordinate if available. + + + + The value of the M ordinate in the index'th coordinate, or + if not defined. + + + + + Sets ordinate X (0) of the specified coordinate to the specified value. + + + The index of the coordinate whose X value to set. + + + The value to set the coordinate's X value to. + + + + + Sets ordinate Y (1) of the specified coordinate to the specified value. + + + The index of the coordinate whose Y value to set. + + + The value to set the coordinate's Y value to. + + + + + Sets ordinate Z of the specified coordinate to the specified value if present. + + + The index of the coordinate whose Z value to set if present. + + + The value to set the coordinate's Z value to if present. + + + + + Sets ordinate M of the specified coordinate to the specified value if present. + + + The index of the coordinate whose M value to set if present. + + + The value to set the coordinate's M value to if present. + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure + values as described by and . + + + If the sequence does not provide value for the required ordinate, the implementation must not throw an exception, it should return . + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + The ordinate value, or if the sequence does not provide values for "/> + + + + Returns the ordinate of a coordinate in this sequence. + + The coordinate index in the sequence. + The ordinate value to get. + The ordinate value, or if the sequence does not provide values for "/> + + + + Gets a value indicating the first Coordinate in this sequence.
+ For LineStrings e.g. this is the starting point. +
+ First Coordinate in sequence or null if empty. +
+ + + Gets a value indicating the last Coordinate in this sequence.
+ For LineStrings e.g. this is the ending point. +
+ Last Coordinate in sequence or null if empty. +
+ + + Gets a value indicating the number of coordinates in this sequence. + + + + + Sets the value for a given ordinate of a coordinate in this sequence. + + + If the sequence can't store the ordinate value, the implementation must not throw an exception, it should simply ignore the call. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + The new ordinate value. + + + + Sets the value for a given ordinate of a coordinate in this sequence. + + The coordinate index in the sequence. + The ordinate value to set. + The new ordinate value. + + + + Returns (possibly copies of) the Coordinates in this collection. + Whether or not the Coordinates returned are the actual underlying + Coordinates or merely copies depends on the implementation. Note that + if this implementation does not store its data as an array of Coordinates, + this method will incur a performance penalty because the array needs to + be built from scratch. + + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + Returns a deep copy of this collection. + + A copy of the coordinate sequence containing copies of all points + + + + Returns a reversed copy of this . + + + A reversed copy of this . + + + Thrown when returned . + + + + + Retrieves the index at which this sequence stores a particular 's + values, if that ordinate is present in . + + + The value whose index to retrieve. + + + When this method returns, contains the index of the requested ordinate, if the ordinate + is present in this sequence; otherwise, -1. This parameter is passed uninitialized. + + + if this sequence contains ; otherwise, + . + + + + + Compares two s. + + + For sequences of the same dimension, the ordering is lexicographic. + Otherwise, lower dimensions are sorted before higher. + The dimensions compared can be limited; if this is done + ordinate dimensions above the limit will not be compared. + + + If different behaviour is required for comparing size, dimension, + or coordinate values, any or all methods can be overridden. + + + + + Compare two doubles, allowing for NaN values. + NaN is treated as being less than any valid number. + + A double + A double + -1, 0, or 1 depending on whether a is less than, equal to or greater than b + + + + The number of dimensions to test + + + + + Creates a comparator which will test all dimensions. + + + + + Creates a comparator which will test only the specified number of dimensions. + + The number of dimensions to test + + + + Compares two s for relative order. + + A coordinate sequence + A coordinate sequence + -1, 0, or 1 depending on whether o1 is less than, equal to, or greater than o2 + + + + Compares the same coordinate of two s + + A coordinate sequence + A coordinate sequence + The index of the coordinate to test + the number of dimensions to test + + + + Compares two s for relative order. + + A coordinate sequence + A coordinate sequence + -1, 0, or 1 depending on whether s1 is less than, equal to, or greater than s2 + + + + An object that knows how to build a particular implementation of + CoordinateSequence from an array of Coordinates. + + + + + + Initializes a new instance of the class.` + + + + + Initializes a new instance of the class. + + + The maximum set of flags that this instance will be + able to create sequences for. + + + + + Gets the Ordinate flags that sequences created by this factory can maximal cope with. + + + + + Returns a based on the given array; + whether or not the array is copied is implementation-dependent. + + A coordinates array, which may not be null nor contain null elements + A coordinate sequence. + + + + Creates a which is a copy + of the given . + This method must handle null arguments by creating an empty sequence. + + + A coordinate sequence + + + + Creates a of the specified size and dimension. + For this to be useful, the implementation must be mutable. + + + If the requested dimension is larger than the CoordinateSequence implementation + can provide, then a sequence of maximum possible dimension should be created. + An error should not be thrown. + + + the dimension of the coordinates in the sequence + (if user-specifiable, otherwise ignored) + A coordinate sequence + + + + Creates a of the specified size and dimension + with measure support. For this to be useful, the + implementation must be mutable. + + + If the requested dimension or measures are larger than the CoordinateSequence implementation + can provide, then a sequence of maximum possible dimension should be created. + An error should not be thrown. + + The number of coordinates in the sequence + The dimension of the coordinates in the sequence (if user-specifiable, + otherwise ignored) + The number of measures of the coordinates in the sequence (if user-specifiable, + otherwise ignored) + + + + Creates a of the specified size and ordinates. + For this to be useful, the implementation must be mutable. + + The number of coordinates. + + The ordinates each coordinate has. is fix, and can be set. + + A coordinate sequence. + + + + Gets the three parameters needed to create any instance + (, , and + ) such that the sequence can store all the data + from a given array of instances. + + + The array of instances that the sequence will be created from. + + + The values of the three parameters to use for creating the sequence. + + + + + Utility functions for manipulating s. + + + + + Reverses the coordinates in a sequence in-place. + + The coordinate sequence to reverse. + + + + Swaps two coordinates in a sequence. + + seq the sequence to modify + the index of a coordinate to swap + the index of a coordinate to swap + + + + Copies a section of a to another . + The sequences may have different dimensions; + in this case only the common dimensions are copied. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a section of a to another . + The sequences must have same dimensions. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a section of a to another . + The sequences must have same dimensions. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a section of a to another . + The sequences must have same dimensions. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a coordinate of a to another . + The sequences may have different dimensions; + in this case only the common dimensions are copied. + + The sequence to copy coordinate from + The index of the coordinate to copy + The sequence to which the coordinate should be copied to + The index of the coordinate in + + + + Copies a coordinate of a to another . + The sequences may have different dimensions; + in this case only the common dimensions are copied. + + The sequence to copy coordinate from + The index of the coordinate to copy + The sequence to which the coordinate should be copied to + The index of the coordinate in + The number of spatial ordinates to copy + The number of measure ordinates to copy + + + + Tests whether a forms a valid , + by checking the sequence length and closure + (whether the first and last points are identical in 2D). + Self-intersection is not checked. + + The sequence to test + True if the sequence is a ring + + + + + Ensures that a CoordinateSequence forms a valid ring, + returning a new closed sequence of the correct length if required. + If the input sequence is already a valid ring, it is returned + without modification. + If the input sequence is too short or is not closed, + it is extended with one or more copies of the start point. + + The CoordinateSequenceFactory to use to create the new sequence + The sequence to test + The original sequence, if it was a valid ring, or a new sequence which is valid. + + + + Extends a given . + + Because coordinate sequences are fix in size, extending is done by + creating a new coordinate sequence of the requested size. + + The new, trailing coordinate entries (if any) are filled with the last + coordinate of the input sequence + + The factory to use when creating the new sequence. + The sequence to extend. + The required size of the extended sequence + The extended sequence + + + + Tests whether two s are equal. + To be equal, the sequences must be the same length. + They do not need to be of the same dimension, + but the ordinate values for the smallest dimension of the two + must be equal. + Two NaN ordinates values are considered to be equal. + + a CoordinateSequence + a CoordinateSequence + true if the sequences are equal in the common dimensions + + + + Tests whether two Coordinates s are equal. + They do not need to be of the same dimension, + but the ordinate values for the common ordinates of the two + must be equal. + Two NaN ordinates values are considered to be equal. + + A CoordinateSequence + The index of the Coordinate in . + a CoordinateSequence + The index of the Coordinate in . + true if the sequences are equal in the common dimensions + + + + Tests whether two Coordinates s are equal. + They do not need to be of the same dimension, + but the ordinate values for the common ordinates of the two + must be equal. + Two NaN ordinates values are considered to be equal. + + A CoordinateSequence + The index of the Coordinate in . + a CoordinateSequence + The index of the Coordinate in . + The number of spatial ordinates to compare + The number of measure ordinates to compare + true if the sequences are equal in the common dimensions + + + + Creates a string representation of a . + The format is: + + ( ord0,ord1.. ord0,ord1,... ... ) + + + the sequence to output + the string representation of the sequence + + + + Returns the minimum coordinate, using the usual lexicographic comparison. + + The coordinate sequence to search + The minimum coordinate in the sequence, found using + + + + Returns the index of the minimum coordinate of the whole + coordinate sequence, using the usual lexicographic comparison. + + The coordinate sequence to search + The index of the minimum coordinate in the sequence, found using + + + + Returns the index of the minimum coordinate of a part of + the coordinate sequence (defined by + and ), using the usual lexicographic + comparison. + + The coordinate sequence to search + The lower search index + The upper search index + The index of the minimum coordinate in the sequence, found using + + + + Shifts the positions of the coordinates until firstCoordinate is first. + + The coordinate sequence to rearrange + The coordinate to make first"> + + + + Shifts the positions of the coordinates until the coordinate at firstCoordinateIndex + is first. + + The coordinate sequence to rearrange + The index of the coordinate to make first + + + + Shifts the positions of the coordinates until the coordinate at firstCoordinateIndex + is first. + + The coordinate sequence to rearrange + The index of the coordinate to make first + Makes sure that will be a closed ring upon exit + + + + Returns the index of coordinate in a + The first position is 0; the second, 1; etc. + + The Coordinate to search for + The coordinate sequence to search + + The position of coordinate, or -1 if it is not found + + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane + and an additional z-ordinate () value. + + This base data object is suitable for use with coordinate sequences with + dimension = 3 and measures = 0. + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a CoordinateZ only contains ordinate values + and properties. + + CoordinateZs are two-dimensional points, with an additional Z-ordinate. + If an Z-ordinate value is not specified or not defined, + constructed coordinates have a Z-ordinate of NaN + (which is also the value of ). + + Apart from the basic accessor functions, NTS supports + only specific operations involving the Z-ordinate. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + Gets or sets the Z-ordinate value. + + + + + Constructs a CoordinateZ at (x,y,z). + + The X value + The Y value + The Z value + + + + Constructs a CoordinateZ at (0,0,NaN). + + + + + Constructs a CoordinateZ having the same (x,y) values as + . + + Coordinate to copy. + + + + Constructs a CoordinateZ at (x,y,NaN). + + X value. + Y value. + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X), 1 (Y) and 2 (Z) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets CoordinateZs (x,y,z) values. + + + + + Create a Coordinate of the same type as this Coordinate, + using the provided values for , and . + + A provided value for will be silently dropped. + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Returns true if + has the same values for X, Y and Z. + + A with which to do the 3D comparison. + + true if is a + with the same values for X, Y and Z. + + + + + Tests if another CoordinateZ has the same value for Z, within a tolerance. + + A . + The tolerance value. + true if the Z ordinates are within the given tolerance. + + + + Returns a string of the form (x, y, z) . + + string of the form (x, y, z) + + + + Computes the 3-dimensional Euclidean distance to another location. + + A with which to do the distance comparison. + the 3-dimensional Euclidean distance between the locations. + + + + A lightweight class used to store coordinates on the 2-dimensional Cartesian plane + and additional z- and m-ordinate values (, ). + + This data object is suitable for use with coordinate sequences with + dimension = 4 and measures = 1. + + + + It is distinct from , which is a subclass of . + Unlike objects of type (which contain additional + information such as an envelope, a precision model, and spatial reference + system information), a CoordinateZM only contains ordinate values + and properties. + + CoordinateZMs are two-dimensional points, with an additional Z-ordinate. + If an Z-ordinate value is not specified or not defined, + constructed coordinates have a Z-ordinate of NaN + (which is also the value of ). + + Apart from the basic accessor functions, NTS supports + only specific operations involving the Z- and/or M-ordinate. + + Implementations may optionally support Z-ordinate and M-measure values + as appropriate for a . Use of + and setters or indexer are recommended. + + + + + Gets or sets the measure-ordinate value. + + + + + Constructs a CoordinateZM at (x,y,z). + + The X value + The Y value + The Z value + The Measure value + + + + Constructs a CoordinateZM at (0,0,NaN,NaN). + + + + + Constructs a CoordinateZM having the same (x,y) values as + . + + Coordinate to copy. + + + + Constructs a CoordinateZM at (x,y,NaN). + + X value. + Y value. + + + + Gets or sets the ordinate value for the given index. + + + The base implementation supports 0 (X), 1 (Y) and 2 (Z) as values for the index. + + The ordinate index + The ordinate value + Thrown if is not in the valid range. + + + + Gets/Sets CoordinateZMs (x,y,z) values. + + + + + Create a Coordinate of the same type as this Coordinate, + using the provided values for , , and . + + The x-ordinate value, if not provided, it is 0d. + The y-ordinate value, if not provided, it is 0d. + The z-ordinate value, if not provided, it is . + The m-ordinate value, if not provided, it is . + A new + + + + Returns a string of the form (x, y, z, m=m) . + + string of the form (x, y, z, m=m) + + + + Provides constants representing the dimensions of a point, a curve and a surface. + + + Also provides constants representing the dimensions of the empty geometry and + non-empty geometries, and the wildcard constant meaning "any dimension". + These constants are used as the entries in s. + + + + + Dimension value of a point (0). + + + + + Dimension value of a point (0). + + + + + Dimension value of a curve (1). + + + + + Dimension value of a curve (1). + + + + + Dimension value of a surface (2). + + + + + Dimension value of a surface (2). + + + + + Dimension value of a empty point (-1). + + + + + Dimension value of non-empty geometries (= {Point,Curve,Surface}). + + + + + Dimension value for any dimension (= {False, True}). + + + + + Dimension value for a unknown spatial object + + + + + Dimension value for a collapsed surface or curve + + + + + Class containing static methods for conversions + between dimension values and characters. + + + + + Symbol for the FALSE pattern matrix entry + + + + + Symbol for the TRUE pattern matrix entry + + + + + Symbol for the DONTCARE pattern matrix entry + + + + + Symbol for the P (dimension 0) pattern matrix entry + + + + + Symbol for the L (dimension 1) pattern matrix entry + + + + + Symbol for the A (dimension 2) pattern matrix entry + + + + + Converts the dimension value to a dimension symbol, + for example, True => 'T' + + Number that can be stored in the IntersectionMatrix. + Possible values are True, False, Dontcare, 0, 1, 2. + Character for use in the string representation of an IntersectionMatrix. + Possible values are T, F, * , 0, 1, 2. + + + + Converts the dimension symbol to a dimension value, + for example, '*' => Dontcare + + Character for use in the string representation of an IntersectionMatrix. + Possible values are T, F, * , 0, 1, 2. + Number that can be stored in the IntersectionMatrix. + Possible values are True, False, Dontcare, 0, 1, 2. + + + + Defines a rectangular region of the 2D coordinate plane. + + + It is often used to represent the bounding box of a Geometry, + e.g. the minimum and maximum x and y values of the Coordinates. + Note that Envelopes support infinite or half-infinite regions, by using the values of + Double.PositiveInfinity and Double.NegativeInfinity. + When Envelope objects are created or initialized, + the supplied extent values are automatically sorted into the correct order. + + + + + Test the point q to see whether it intersects the Envelope + defined by p1-p2. + + One extremal point of the envelope. + Another extremal point of the envelope. + Point to test for intersection. + true if q intersects the envelope p1-p2. + + + + Tests whether the envelope defined by p1-p2 + and the envelope defined by q1-q2 + intersect. + + One extremal point of the envelope Point. + Another extremal point of the envelope Point. + One extremal point of the envelope Q. + Another extremal point of the envelope Q. + true if Q intersects Point + + + + The minimum x-coordinate + + + + + The maximum x-coordinate + + + + + The minimum y-coordinate + + + + + The maximum y-coordinate + + + + + Creates a null Envelope. + + + + + Creates an Envelope for a region defined by maximum and minimum values. + + The first x-value. + The second x-value. + The first y-value. + The second y-value. + + + + Creates an Envelope for a region defined by two Coordinates. + + The first Coordinate. + The second Coordinate. + + + + Creates an Envelope for a region defined by a single Coordinate. + + The Coordinate. + + + + Creates an Envelope for a region defined by an enumeration of Coordinates. + + The Coordinates. + + + + Creates an Envelope for a region defined by a CoordinateSequences. + + The CoordinateSequence. + + + + Create an Envelope from an existing Envelope. + + The Envelope to initialize from. + + + + Initialize to a null Envelope. + + + + + Initialize an Envelope for a region defined by maximum and minimum values. + + The first x-value. + The second x-value. + The first y-value. + The second y-value. + + + + Initialize an Envelope for a region defined by two Coordinates. + + The first Coordinate. + The second Coordinate. + + + + Initialize an Envelope for a region defined by a single Coordinate. + + The Coordinate. + + + + Initialize an Envelope from an existing Envelope. + + The Envelope to initialize from. + + + + Makes this Envelope a "null" envelope.. + + + + + Returns true if this Envelope is a "null" envelope. + + + true if this Envelope is uninitialized + or is the envelope of the empty point. + + + + + Returns the difference between the maximum and minimum x values. + + max x - min x, or 0 if this is a null Envelope. + + + + Returns the difference between the maximum and minimum y values. + + max y - min y, or 0 if this is a null Envelope. + + + + Gets the length of the diameter (diagonal) of the envelope. + + The diameter length + + + + Returns the Envelopes minimum x-value. min x > max x + indicates that this is a null Envelope. + + The minimum x-coordinate. + + + + Returns the Envelopes maximum x-value. min x > max x + indicates that this is a null Envelope. + + The maximum x-coordinate. + + + + Returns the Envelopes minimum y-value. min y > max y + indicates that this is a null Envelope. + + The minimum y-coordinate. + + + + Returns the Envelopes maximum y-value. min y > max y + indicates that this is a null Envelope. + + The maximum y-coordinate. + + + + Gets the area of this envelope. + + The area of the envelope, or 0.0 if envelope is null + + + + Expands this envelope by a given distance in all directions. + Both positive and negative distances are supported. + + The distance to expand the envelope. + + + + Expands this envelope by a given distance in all directions. + Both positive and negative distances are supported. + + The distance to expand the envelope along the the X axis. + The distance to expand the envelope along the the Y axis. + + + + Gets the minimum extent of this envelope across both dimensions. + + + + + + Gets the maximum extent of this envelope across both dimensions. + + + + + + Enlarges this Envelope so that it contains + the given . + Has no effect if the point is already on or within the envelope. + + The Coordinate. + + + + Enlarges this Envelope so that it contains + the given . + + Has no effect if the point is already on or within the envelope. + The value to lower the minimum x to or to raise the maximum x to. + The value to lower the minimum y to or to raise the maximum y to. + + + + Enlarges this Envelope so that it contains + the other Envelope. + Has no effect if other is wholly on or + within the envelope. + + the Envelope to expand to include. + + + + Enlarges this Envelope so that it contains + the other Envelope. + Has no effect if other is wholly on or + within the envelope. + + the Envelope to expand to include. + + + + Translates this envelope by given amounts in the X and Y direction. + + The amount to translate along the X axis. + The amount to translate along the Y axis. + + + + Computes the coordinate of the centre of this envelope (as long as it is non-null). + + + The centre coordinate of this envelope, + or null if the envelope is null. + . + + + + Computes the intersection of two s. + + The envelope to intersect with + + A new Envelope representing the intersection of the envelopes (this will be + the null envelope if either argument is null, or they do not intersect + + + + + Check if the region defined by other + intersects the region of this Envelope. + + The Envelope which this Envelope is + being checked for intersecting. + + + true if the Envelopes intersect. + + + + + Check if the point p overlaps (lies inside) the region of this Envelope. + + the Coordinate to be tested. + true if the point overlaps this Envelope. + + + + Check if the point (x, y) overlaps (lies inside) the region of this Envelope. + + the x-ordinate of the point. + the y-ordinate of the point. + true if the point overlaps this Envelope. + + + + Tests if the extent defined by two extremal points + intersects the extent of this Envelope. + + A point + Another point + true if the extents intersect + + + + Tests if the region defined by other + is disjoint from the region of this Envelope. + + The Envelope being checked for disjointness + true if the Envelopes are disjoint + + + + + Tests if the Envelope other lies wholely inside this Envelope (inclusive of the boundary). + + + Note that this is not the same definition as the SFS contains, + which would exclude the envelope boundary. + + The Envelope to check + true if other is contained in this Envelope + + + + + Tests if the given point lies in or on the envelope. + + + Note that this is not the same definition as the SFS contains, + which would exclude the envelope boundary. + + the point which this Envelope is being checked for containing + true if the point lies in the interior or on the boundary of this Envelope. + + + + + Tests if the given point lies in or on the envelope. + + + Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary. + + the x-coordinate of the point which this Envelope is being checked for containing + the y-coordinate of the point which this Envelope is being checked for containing + + true if (x, y) lies in the interior or on the boundary of this Envelope. + + + + + + Tests if the given point lies in or on the envelope. + + the x-coordinate of the point which this Envelope is being checked for containing + the y-coordinate of the point which this Envelope is being checked for containing + true if (x, y) lies in the interior or on the boundary of this Envelope. + + + + Tests if the given point lies in or on the envelope. + + the point which this Envelope is being checked for containing + true if the point lies in the interior or on the boundary of this Envelope. + + + + Tests if the Envelope other lies wholely inside this Envelope (inclusive of the boundary). + + the Envelope to check + true if this Envelope covers the other + + + + Computes the distance between this and another + Envelope. + The distance between overlapping Envelopes is 0. Otherwise, the + distance is the Euclidean distance between the closest points. + + The distance between this and another Envelope. + + + + + + + + + + Compares two envelopes using lexicographic ordering. + The ordering comparison is based on the usual numerical + comparison between the sequence of ordinates. + Null envelopes are less than all non-null envelopes. + + An envelope + + + + Compares two envelopes using lexicographic ordering. + The ordering comparison is based on the usual numerical + comparison between the sequence of ordinates. + Null envelopes are less than all non-null envelopes. + + An envelope + + + + + + + Function to get a textual representation of this envelope + + A textual representation of this envelope + + + + Creates a deep copy of the current envelope. + + + + + + Method to parse an envelope from its value + + The envelope string + The envelope + + + + A representation of a planar, linear vector geometry. + + + +

Binary Predicates:

+ Because it is not clear at this time what semantics for spatial + analysis methods involving GeometryCollections would be useful, + GeometryCollections are not supported as arguments to binary + predicates or the Relate method. +
+ +

Overlay Methods:

+ The spatial analysis methods will + return the most specific class possible to represent the result. If the + result is homogeneous, a Point, LineString, or + Polygon will be returned if the result contains a single + element; otherwise, a MultiPoint, MultiLineString, + or MultiPolygon will be returned. If the result is + heterogeneous a GeometryCollection will be returned. +
+ + Representation of Computed Geometries: + The SFS states that the result + of a set-theoretic method is the "point-set" result of the usual + set-theoretic definition of the operation (SFS 3.2.21.1). However, there are + sometimes many ways of representing a point set as a Geometry. + The SFS does not specify an unambiguous representation of a given point set + returned from a spatial analysis method. One goal of NTS is to make this + specification precise and unambiguous. NTS uses a canonical form for + Geometrys returned from overlay methods. The canonical + form is a Geometry which is simple and noded: + Simple means that the Geometry returned will be simple according to + the NTS definition of IsSimple. + Noded applies only to overlays involving LineStrings. It + means that all intersection points on LineStrings will be + present as endpoints of LineStrings in the result. + This definition implies that non-simple geometries which are arguments to + spatial analysis methods must be subjected to a line-dissolve process to + ensure that the results are simple. + + + Constructed Points And The Precision Model: + The results computed by the set-theoretic methods may + contain constructed points which are not present in the input Geometrys. + These new points arise from intersections between line segments in the + edges of the input Geometrys. In the general case it is not + possible to represent constructed points exactly. This is due to the fact + that the coordinates of an intersection point may contain twice as many bits + of precision as the coordinates of the input line segments. In order to + represent these constructed points explicitly, NTS must truncate them to fit + the PrecisionModel. + Unfortunately, truncating coordinates moves them slightly. Line segments + which would not be coincident in the exact result may become coincident in + the truncated representation. This in turn leads to "topology collapses" -- + situations where a computed element has a lower dimension than it would in + the exact result. + When NTS detects topology collapses during the computation of spatial + analysis methods, it will throw an exception. If possible the exception will + report the location of the collapse. + + + +

Geometry Equality

+ There are two ways of comparing geometries for equality: + structural equality and topological equality. +

Structural Equality

+ Structural Equality is provided by the + method. + This implements a comparison based on exact, structural pointwise + equality. + The is a synonym for this method, + to provide structural equality semantics for + use in collections. + It is important to note that structural pointwise equality + is easily affected by things like + ring order and component order. In many situations + it will be desirable to normalize geometries before + comparing them (using the + or methods). + is provided + as a convenience method to compute equality over + normalized geometries, but it is expensive to use. + Finally, + allows using a tolerance value for point comparison. + +

Topological Equality

+ Topological Equality is provided by the + method. + It implements the SFS definition of point-set equality + defined in terms of the DE-9IM matrix. + To support the SFS naming convention, the method + is also provided as a synonym. + However, due to the potential for confusion with + its use is discouraged. +
+ + Since and are overridden, + Geometries can be used effectively in .Net collections. + +
+
+ + + An enumeration of sort values for geometries + + + NOTE:
+ For JTS v1.17 the values in this enum have been renamed to 'TYPECODE...' + In order not to break binary compatibility we did not follow. +
+
+ + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + Sort hierarchy value of a + + + + The name of point geometries + + + + + The name of multi-point geometries + + + + + The name of linestring geometries + + + + + The name of linearring geometries + + + + + The name of multi-linestring geometries + + + + + The name of polygon geometries + + + + + The name of multi-polygon geometries + + + + + The name of geometry collection geometries. + + + + + Gets the factory which contains the context in which this point was created. + + The factory for this point. + + + + Gets/Sets the user data object for this point, if any. + + + A simple scheme for applications to add their own custom data to a Geometry. + An example use might be to add an object representing a Coordinate Reference System. + Note that user data objects are not present in geometries created by + construction methods. + + + + + The bounding box of this Geometry. + + + + + Sets the ID of the Spatial Reference System used by the Geometry. + + + + NOTE: This method should only be used for exceptional circumstances or + for backwards compatibility. Normally the SRID should be set on the + used to create the geometry. + SRIDs set using this method will change the . + + + + + + + Creates a new Geometry via the specified GeometryFactory. + + The factory + + + + Returns the name of this Geometry's actual class. + + The name of this Geometrys actual class. + + + + Gets the OGC geometry type + + + + + Returns true if the array contains any non-empty Geometrys. + + an array of Geometrys; no elements may be null + + true if any of the Geometrys + IsEmpty methods return false. + + + + + Returns true if the array contains any null elements. + + an array to validate. + true if any of arrays elements are null. + + + + Returns true if the array contains any null elements. + + an array to validate. + true if any of arrays elements are null. + + + + Returns the PrecisionModel used by the Geometry. + + + the specification of the grid of allowable points, for this + Geometry and all other Geometrys. + + + + + Returns a vertex of this Geometry + (usually, but not necessarily, the first one). + + + The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation. + + a Coordinate which is a vertex of this Geometry. + null if this Geometry is empty. + + + + + Returns an array containing the values of all the vertices for + this geometry. + + + If the geometry is a composite, the array will contain all the vertices + for the components, in the order in which the components occur in the geometry. + + In general, the array cannot be assumed to be the actual internal + storage for the vertices. Thus modifying the array + may not modify the geometry itself. + Use the or + method + (possibly on the components) to modify the underlying data. + If the coordinates are modified, + must be called afterwards. + + + The vertices of this Geometry. + + + + + + + Gets an array of ordinate values + + The ordinate index + An array of ordinate values + + + + Returns the count of this Geometrys vertices. The Geometry + s contained by composite Geometrys must be + Geometry's; that is, they must implement NumPoints. + + The number of vertices in this Geometry. + + + + Returns the number of Geometryes in a GeometryCollection, + or 1, if the geometry is not a collection. + + + + + Returns an element Geometry from a GeometryCollection, + or this, if the geometry is not a collection. + + The index of the geometry element. + The n'th geometry contained in this geometry. + + + + Tests whether this is simple. + + The SFS definition of simplicity + follows the general rule that a Geometry is simple if it has no points of + self-tangency, self-intersection or other anomalous points. + + Simplicity is defined for each subclass as follows: + + Valid polygonal geometries are simple, since their rings + must not self-intersect. IsSimple + tests for this condition and reports false if it is not met. + (This is a looser test than checking for validity). + Linear rings have the same semantics. + Linear geometries are simple if they do not self-intersect at points + other than boundary points. + Zero-dimensional geometries (points) are simple if they have no + repeated points. + Empty Geometrys are always simple. + + + true if this Geometry is simple + + + + + Tests whether this Geometry is topologically + valid, according to the OGC SFS specification. + For validity rules see the documentation for the specific geometry subclass. + + true if this Geometry is valid. + + + + Tests whether the set of points covered in this Geometry is empty. + + Note this test is for topological emptiness, not structural emptiness.
+ A collection containing only empty elements is reported as empty.
+ To check structural emptiness use . +
+ true if this Geometry does not cover any points. +
+ + + Returns the minimum distance between this Geometry + and another Geometry g. + + The Geometry from which to compute the distance. + The distance between the geometries + 0 if either input geometry is empty + if g is null + + + + Tests whether the distance from this Geometry + to another is less than or equal to a specified value. + + the Geometry to check the distance to. + the distance value to compare. + true if the geometries are less than distance apart. + + + + Returns the area of this Geometry. + Areal Geometries have a non-zero area. + They override this function to compute the area. + Others return 0.0 + + The area of the Geometry. + + + + Gets a value indicating if the value for has been set. + + + + + Returns the length of this Geometry. + Linear geometries return their length. + Areal geometries return their perimeter. + They override this function to compute the length. + Others return 0.0 + + The length of the Geometry. + + + + Gets a value indicating if the value for has been set. + + + + + Computes the centroid of this Geometry. + The centroid + is equal to the centroid of the set of component Geometries of highest + dimension (since the lower-dimension geometries contribute zero + "weight" to the centroid). + + The centroid of an empty geometry is POINT EMPTY. + + A Point which is the centroid of this Geometry. + + + + Computes an interior point of this Geometry. + + + An interior point is guaranteed to lie in the interior of the Geometry, + if it possible to calculate such a point exactly. Otherwise, + the point may lie on the boundary of the point. + + The interior point of an empty geometry is POINT EMPTY. + + A Point which is in the interior of this Geometry. + + + + + + + + + Returns the dimension of this geometry. + + + The dimension of a geometry is is the topological + dimension of its embedding in the 2-D Euclidean plane. + In the NTS spatial model, dimension values are in the set {0,1,2}. + + Note that this is a different concept to the dimension of + the vertex s. + The geometry dimension can never be greater than the coordinate dimension. + For example, a 0-dimensional geometry (e.g. a Point) + may have a coordinate dimension of 3 (X,Y,Z). + + + + The topological dimensions of this geometry + + + + + Returns the boundary, or an empty geometry of appropriate dimension + if this Geometry is empty. + For a discussion of this function, see the OpenGIS Simple + Features Specification. As stated in SFS Section 2.1.13.1, "the boundary + of a Geometry is a set of Geometries of the next lower dimension." + + The closure of the combinatorial boundary of this Geometry. + + + + Returns the dimension of this Geometrys inherent boundary. + + + The dimension of the boundary of the class implementing this + interface, whether or not this object is the empty point. Returns + Dimension.False if the boundary is the empty point. + + + + + Gets a geometry representing the envelope (bounding box) of this Geometry. + + If this Geometry is + + empty, returns an empty Point + a point, returns a Point + a line parallel to an axis, a two-vertex LineString, + otherwise, returns a + Polygon whose vertices are (minx, miny), (maxx, miny), + (maxx, maxy), (minx, maxy), (minx, miny). + + + + A Geometry representing the envelope of this Geometry + + + + + + Gets an containing + the minimum and maximum x and y values in this Geometry. + If the geometry is empty, an empty Envelope + is returned. + + + The returned object is a copy of the one maintained internally, + to avoid aliasing issues. + For best performance, clients which access this + envelope frequently should cache the return value. + the envelope of this Geometry. + An empty Envelope if this Geometry is empty + + + + Notifies this geometry that its coordinates have been changed by an external + party (for example, via a ). + + + When this method is called the geometry will flush + and/or update any derived information it has cached (such as its ). + The operation is applied to all component Geometries. + + + + + Notifies this Geometry that its Coordinates have been changed by an external + party. When GeometryChanged is called, this method will be called for + this Geometry and its component Geometries. + + + + + Tests whether this geometry is disjoint from the argument geometry. + + + The Disjoint predicate has the following equivalent definitions: + + The DE-9IM intersection matrix for the two geometries matches FF*FF****. + !g.intersects(this) == true
(Disjoint is the inverse of Intersects)
+
+
+ The Geometry with which to compare this Geometry. + true if the two Geometrys are disjoint. + +
+ + + Tests whether this geometry touches the argument geometry + + + The Touches predicate has the following equivalent definitions: + + The geometries have at least one point in common, + but their interiors do not intersect + The DE-9IM Intersection Matrix for the two geometries matches + at least one of the following patterns + + FT*******, + F**T***** or + F***T****. + + + If both geometries have dimension 0, the predicate returns false, + since points have only interiors. + This predicate is symmetric. + + The Geometry with which to compare this Geometry. + + true if the two Geometrys touch; + Returns false if both Geometrys are points. + + + + + Tests whether this geometry intersects the argument geometry. + + + The Intersects predicate has the following equivalent definitions: + + The two geometries have at least one point in common + The DE-9IM Intersection Matrix for the two geometries matches
+ [T********] or
+ [*T*******] or
+ [***T*****] or
+ [****T****]
+ !g.disjoint(this)
+ (Intersects is the inverse of Disjoint)
+
+ The Geometry with which to compare this Geometry. + true if the two Geometrys intersect. + +
+ + + Tests whether this geometry crosses the specified geometry. + + + The Crosses predicate has the following equivalent definitions: + + The geometries have some but not all interior points in common. + The DE-9IM Intersection Matrix for the two geometries matches + one of the following patterns: + + CodeDescription + [T*T******]for P/L, P/A, and L/A situations + [T*****T**]for L/P, A/P, and A/L situations) + [0********]for L/L situations + + + + For the A/A and P/P situations this predicate returns false. + + The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. + To make the relation symmetric, + NTS extends the definition to apply to L/P, A/P and A/L situations as well. + + + The Geometry with which to compare this Geometry + true if the two Geometrys cross. + + + + Tests whether this geometry is within the specified geometry. + + + The within predicate has the following equivalent definitions: + + + Every point of this geometry is a point of the other geometry, + and the interiors of the two geometries have at least one point in common. + + The DE-9IM Intersection Matrix for the two geometries matches [T*F**F***] + g.contains(this) == true
(Within is the converse of )
+
+ + An implication of the definition is that "The boundary of a geometry is not within the Polygon". + In other words, if a geometry A is a subset of the points in the boundary of a geometry B, A.within(B) == false + (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) + For a predicate with similar behaviour but avoiding + this subtle limitation, see . + +
+ The Geometry with which to compare this Geometry. + true if this Geometry is within other. + + +
+ + + Tests whether this geometry contains the argument geometry. + + + The Contains predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry, + and the interiors of the two geometries have at least one point in common. + The DE-9IM Intersection Matrix for the two geometries matches the pattern + [T*****FF*] + g.within(this)
+ (Contains is the converse of )
+
+ + An implication of the definition is that "Geometries do not + contain their boundary". In other words, if a geometry A is a subset of + the points in the boundary of a geometry B, B.Contains(A) == false. + (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) + For a predicate with similar behaviour but avoiding + this subtle limitation, see . + +
+ the Geometry with which to compare this Geometry + true if this Geometry contains g + + +
+ + + Tests whether this geometry overlaps the specified geometry. + + + The Overlaps predicate has the following equivalent definitions: + + The geometries have at least one point each not shared by the other (or equivalently neither covers the other), + they have the same dimension, + and the intersection of the interiors of the two geometries has + the same dimension as the geometries themselves. + The DE-9IM Intersection Matrix for the two geometries matches + [T*T***T**] (for two points or two surfaces) + or [1*T***T**] (for two curves) + + If the geometries are of different dimension this predicate returns false. + + The Geometry with which to compare this Geometry. + + true if the two Geometrys overlap. + For this function to return true, the Geometry + s must be two points, two curves or two surfaces. + + + + + Tests whether this geometry covers the argument geometry + + + The covers predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry. + The DE-9IM Intersection Matrix for the two geometries matches at least + one of the following patterns: + + [T*****FF*] or
+ [*T****FF*] or
+ [***T**FF*] or
+ [****T*FF*] +
+
+ g.CoveredBy(this) == true
+ (covers is the converse of )
+
+ If either geometry is empty, the value of this predicate is false. + + This predicate is similar to , + but is more inclusive (i.e. returns true for more cases). + In particular, unlike Contains it does not distinguish between + points in the boundary and in the interior of geometries. + For most situations, Covers should be used in preference to Contains. + As an added benefit, Covers is more amenable to optimization, + and hence should be more performant. + +
+ The Geometry with which to compare this Geometry + true if this Geometry covers + + +
+ + Tests whether this geometry is covered by the specified geometry. + + The CoveredBy predicate has the following equivalent definitions: + + Every point of this geometry is a point of the other geometry. + The DE-9IM Intersection Matrix for the two geometries matches + at least one of the following patterns: + + [T*F**F***] + [*TF**F***] + [**FT*F***] + [**F*TF***] + g.Covers(this) == true
+ (CoveredBy is the converse of ) +
+
+ If either geometry is empty, the value of this predicate is false. + + This predicate is similar to , + but is more inclusive (i.e. returns true for more cases). + +
+ the Geometry with which to compare this Geometry + true if this Geometry is covered by g + + +
+ + + Tests whether the elements in the DE-9IM + for the two Geometrys match the elements in intersectionPattern. + + + The pattern is a 9-character string, with symbols drawn from the following set: + + 0(dimension 0) + 1(dimension 1) + 2(dimension 2) + T( matches 0, 1 or 2) + F( matches FALSE) + *( matches any value) + + For more information on the DE-9IM, see the OpenGIS Simple Features + Specification. + + the Geometry with which to compare this Geometry + the pattern against which to check the + intersection matrix for the two Geometrys + true if the DE-9IM intersection + matrix for the two Geometrys match intersectionPattern + + + + + Returns the DE-9IM intersection matrix for the two Geometrys. + + The Geometry with which to compare this Geometry + + A matrix describing the intersections of the interiors, + boundaries and exteriors of the two Geometrys. + + + + + Tests whether this geometry is + topologically equal to the argument geometry. + + This method is included for backward compatibility reasons. + It has been superseded by the method, + which has been named to clearly denote its functionality. + + This method should NOT be confused with the method + , which implements + an exact equality comparison. + + The Geometry with which to compare this Geometry + true if the two Geometrys are topologically equal. + + + + + Tests whether this geometry is topologically equal to the argument geometry + as defined by the SFS Equals predicate. + + + The SFS equals predicate has the following equivalent definitions: + + The two geometries have at least one point in common, + and no point of either geometry lies in the exterior of the other geometry. + The DE-9IM Intersection Matrix for the two geometries matches + the pattern T*F**FFF* +
+            T*F
+            **F
+            FF*
+            
+
+ Note that this method computes topologically equality. + For structural equality, see {@link #equalsExact(Geometry)}. +
+ the Geometry with which to compare this Geometry + true if the two Geometrys are topologically equal +
+ + + Tests whether this geometry is structurally and numerically equal + to a given Object. + + + If the argument Object is not a Geometry, + the result is false. + Otherwise, the result is computed using + . + + This method is provided to fulfill the Java contract + for value-based object equality. + In conjunction with + it provides semantics which are most useful + for using + Geometrys as keys and values in Java collections. + + Note that to produce the expected result the input geometries + should be in normal form. It is the caller's + responsibility to perform this where required + (using + or as appropriate). + + The object to compare + true if this geometry is exactly equal to the argument + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets a hash code for the Geometry. + + + An integer value suitable for use as a hashcode + + + + + Returns the Well-known Text representation of this Geometry. + For a definition of the Well-known Text format, see the OpenGIS Simple + Features Specification. + + + The Well-known Text representation of this Geometry. + + + + + Returns the Well-known Text representation of this Geometry. + For a definition of the Well-known Text format, see the OpenGIS Simple + Features Specification. + + + The Well-known Text representation of this Geometry. + + + + + + + + + + + Returns the Well-known Binary representation of this Geometry. + For a definition of the Well-known Binary format, see the OpenGIS Simple + Features Specification. + + The Well-known Binary representation of this Geometry. + + + + + + + + + + Returns the feature representation as GML 2.1.1 XML document. + This XML document is based on Geometry.xsd schema. + NO features or XLink are implemented here! + + + + + Computes a buffer area around this geometry having the given width. The + buffer of a Geometry is the Minkowski sum or difference of the geometry + with a disc of radius Abs(distance). + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The buffer geometry is constructed using 8 segments per quadrant to approximate + the circular arcs. + The end cap style is EndCapStyle.Round. + + The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + + + + The width of the buffer (may be positive, negative or 0), interpreted according to the + PrecisionModel of the Geometry. + + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + + + + + Computes a buffer region around this Geometry having the given width. + The buffer of a Geometry is the Minkowski sum or difference of the geometry + with a disc of radius Abs(distance). + + + The end cap style specifies the buffer geometry that will be + created at the ends of linestrings. The styles provided are: +
    +
  • - (default) a semi-circle
  • +
  • - a straight line perpendicular to the end segment
  • +
  • - a half-square
  • +
+ The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . +
+ + The width of the buffer, interpreted according to the + PrecisionModel of the Geometry. + + Cap Style to use for compute buffer. + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + +
+ + + Computes a buffer region around this Geometry having the given + width and with a specified accuracy of approximation for circular arcs. + The buffer of a Geometry is the Minkowski sum of the Geometry with + a disc of radius distance. Curves in the buffer polygon are + approximated with line segments. This method allows specifying the + accuracy of that approximation. + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The quadrantSegments argument allows controlling the accuracy of + the approximation by specifying the number of line segments used to + represent a quadrant of a circle + The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + + + + The width of the buffer (may be positive, negative or 0), interpreted according to the + PrecisionModel of the Geometry. + + The number of segments to use to approximate a quadrant of a circle. + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + + + + + Computes a buffer region around this Geometry having the given + width and with a specified number of segments used to approximate curves. + The buffer of a Geometry is the Minkowski sum of the Geometry with + a disc of radius distance. Curves in the buffer polygon are + approximated with line segments. This method allows specifying the + accuracy of that approximation. + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The quadrantSegments argument allows controlling the accuracy of + the approximation by specifying the number of line segments used to + represent a quadrant of a circle + The end cap style specifies the buffer geometry that will be + created at the ends of linestrings. The styles provided are: +
    +
  • - (default) a semi-circle
  • +
  • - a straight line perpendicular to the end segment
  • +
  • - a half-square
  • +
+ The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + +
+ + The width of the buffer, interpreted according to the + PrecisionModel of the Geometry. + + The number of segments to use to approximate a quadrant of a circle. + Cap Style to use for compute buffer. + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + +
+ + + Computes a buffer region around this Geometry having the given + width and with a specified number of segments used to approximate curves. + The buffer of a Geometry is the Minkowski sum of the Geometry with + a disc of radius distance. Curves in the buffer polygon are + approximated with line segments. This method allows specifying the + accuracy of that approximation. + + Mathematically-exact buffer area boundaries can contain circular arcs. + To represent these arcs using linear geometry they must be approximated with line segments. + The bufferParameters argument has a property QuadrantSegments controlling the accuracy of + the approximation by specifying the number of line segments used to + represent a quadrant of a circle + The EndCapStyle property of the bufferParameters argument specifies the buffer geometry that will be + created at the ends of linestrings. The styles provided are: +
    +
  • - (default) a semi-circle
  • +
  • - a straight line perpendicular to the end segment
  • +
  • - a half-square
  • +
+ The buffer operation always returns a polygonal result. The negative or + zero-distance buffer of lines and points is always an empty . + This is also the result for the buffers of degenerate (zero-area) polygons. + +
+ + The width of the buffer, interpreted according to the + PrecisionModel of the Geometry. + + This argument type has a number of properties that control the construction of the + buffer, including QuadrantSegments, EndCapStyle, JoinStyle, and MitreLimit + + a polygonal geometry representing the buffer region (which may be empty) + + If a robustness error occurs + + + + +
+ + + Returns the smallest convex Polygon that contains all the + points in the Geometry. This obviously applies only to Geometry + s which contain 3 or more points. + + the minimum-area convex polygon containing this Geometry's points. + + + + Computes a new geometry which has all component coordinate sequences + in reverse order (opposite orientation) to this one. + + A reversed geometry + Don't override this function, implement . + + + + The actual implementation of the function + + A reversed geometry + In JTS this function is abstract, but that would break binary compatibility of current version. + + + + Computes a Geometry representing the point-set which is + common to both this Geometry and the other Geometry. + + The intersection of two geometries of different dimension produces a result + geometry of dimension less than or equal to the minimum dimension of the input + geometries. + The result geometry may be a heterogeneous . + If the result is empty, it is an atomic geometry + with the dimension of the lowest input dimension. + + Intersection of s is supported + only for homogeneous collection types. + + Non-empty heterogeneous arguments are not supported. + + The Geometry with which to compute the intersection. + A geometry representing the point-set common to the two Geometrys. + if a robustness error occurs. + if the argument is a non-empty heterogeneous GeometryCollection + if the argument has a factory with a different GeometryOverlay object assigned + + + + Computes a Geometry representing the point-set + which is contained in both this + Geometry and the other Geometry. + + + The method may be used on arguments of different dimension, but it does not + support arguments. + + The union of two geometries of different dimension produces a result + geometry of dimension equal to the maximum dimension of the input + geometries. + The result geometry may be a heterogeneous + . + If the result is empty, it is an atomic geometry + with the dimension of the highest input dimension. + + Unioning s has the effect of + noding and dissolving the input linework. In this context + "noding" means that there will be a node or endpoint in the result for + every endpoint or line segment crossing in the input. "Dissolving" means + that any duplicate (i.e. coincident) line segments or portions of line + segments will be reduced to a single line segment in the result. + If merged linework is required, the + class can be used. + + Non-empty arguments are not supported. + the Geometry with which to compute the union + A point-set combining the points of this Geometry and the + points of other + Thrown if a robustness error occurs + Thrown if either input is a non-empty GeometryCollection + if the argument has a factory with a different GeometryOverlay object assigned + + + + + Computes a Geometry representing the closure of the point-set + of the points contained in this Geometry that are not contained in + the other Geometry. + + If the result is empty, it is an atomic geometry + with the dimension of the left-hand input. + + Non-empty arguments are not supported. + + The Geometry with which to compute the difference. + A Geometry representing the point-set difference of this Geometry with other. + if the argument has a factory with a different GeometryOverlay object assigned + + + + Computes a Geometry representing the closure of the point-set + which is the union of the points in this Geometry which are not + contained in the other Geometry, + with the points in the other Geometry not contained in this + Geometry. + If the result is empty, it is an atomic geometry + with the dimension of the highest input dimension. + + Non-empty arguments are not supported. + + The Geometry with which to compute the symmetric difference. + a Geometry representing the point-set symmetric difference of this Geometry with other. + if the argument has a factory with a different GeometryOverlay object assigned + + + + Computes the union of all the elements of this geometry. + + + This method supports s (which the other overlay operations currently do not). + + The result obeys the following contract: + + Unioning a set of s has the effect of fully noding and dissolving the linework. + Unioning a set of s always returns a geometry + (unlike ), which may return geometries of lower dimension if a topology + collapse occurred). + + + Thrown if a robustness error occurs + + + + Returns true if the two Geometrys are exactly equal, + up to a specified tolerance. + Two Geometries are exactly within a tolerance equal if: + + they have the same class, + they have the same values of Coordinates, + within the given tolerance distance, in their internal + Coordinate lists, in exactly the same order. + + This method does not + test the values of the GeometryFactory, the SRID, + or the UserData fields. + + To properly test equality between different geometries, + it is usually necessary to them first. + + The Geometry with which to compare this Geometry + have identical structure and point values, up to the distance tolerance. + Distance at or below which two Coordinates will be considered equal. + + true if this and the other Geometry + are of the same class and have equal internal data. + + + + + + + + Returns true if the two Geometrys are exactly equal. + Two Geometries are exactly equal if: + + they have the same class, + they have the same values of Coordinates in their internal + Coordinate lists, in exactly the same order. + + This provides a stricter test of equality than + , which is more useful + in certain situations + (such as using geometries as keys in collections). + + This method does not + test the values of the GeometryFactory, the SRID, + or the UserData fields. + + To properly test equality between different geometries, + it is usually necessary to them first. + + The Geometry with which to compare this Geometry. + + true if this and the other Geometry have identical structure and point values. + + + + + Tests whether two geometries are exactly equal + in their normalized forms. + + This is a convenience method which creates normalized + versions of both geometries before computing + . + This method is relatively expensive to compute. + For maximum performance, the client + should instead perform normalization on the individual geometries + at an appropriate point during processing. + + + A geometry + true if the input geometries are exactly equal in their normalized form + + + + + Performs an operation with or on this Geometry's coordinates. + + + If this method modifies any coordinate values, + must be called to update the geometry state. + Note that you cannot use this method to + modify this Geometry if its underlying CoordinateSequence's #get method + returns a copy of the Coordinate, rather than the actual Coordinate stored + (if it even stores Coordinate objects at all). + + The filter to apply to this Geometry's coordinates + + + + Performs an operation on the coordinates in this Geometry's s. + + + If the filter reports that a coordinate value has been changed, + will be called automatically. + + The filter to apply + + + + Performs an operation on this Geometry's s. + + + If the filter reports that a coordinate value has been changed, + will be called automatically. + + The filter to apply + + + + Performs an operation with or on this Geometry and its + subelement Geometrys (if any). + Only GeometryCollections and subclasses + have subelement Geometry's. + + + The filter to apply to this Geometry (and + its children, if it is a GeometryCollection). + + + + + Performs an operation with or on this Geometry and its + component Geometry's. Only GeometryCollections and + Polygons have component Geometry's; for Polygons they are the LinearRings + of the shell and holes. + + The filter to apply to this Geometry. + + + + Creates a deep copy of this object. + Coordinate sequences contained in it are copied. + All instance fields are copied + (i.e. the SRID, EnvelopeInternal and UserData). + + + NOTE: The UserData object reference (if present) is copied, + but the value itself is not copied. + If a deep copy is required this must be performed by the caller. + + A deep copy of this geometry + + + + An internal method to copy subclass-specific geometry data. + + A copy of the target geometry object. + + + + Converts this Geometry to normal form (or canonical form ). + + + + Normal form is a unique representation for Geometrys. + It can be used to test whether two Geometrys are equal + in a way that is independent of the ordering of the coordinates within + them. Normal form equality is a stronger condition than topological + equality, but weaker than pointwise equality. + + The definitions for normal + form use the standard lexicographical ordering for coordinates. "Sorted in + order of coordinates" means the obvious extension of this ordering to + sequences of coordinates. + + + NOTE that this method mutates the value of this geometry in-place. + If this is not safe and/or wanted, the geometry should be + cloned prior to normalization. + + + + + + Creates a new Geometry which is a normalized copy of this Geometry. + + A normalized copy of this geometry. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry. + + If their classes are different, they are compared using the following + ordering: + + Point (lowest), + MultiPoint, + LineString, + LinearRing, + MultiLineString, + Polygon, + MultiPolygon, + GeometryCollection (highest). + + If the two Geometrys have the same class, their first + elements are compared. If those are the same, the second elements are + compared, etc. + + A Geometry with which to compare this Geometry + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry. + + If their classes are different, they are compared using the following + ordering: + + Point (lowest), + MultiPoint, + LineString, + LinearRing, + MultiLineString, + Polygon, + MultiPolygon, + GeometryCollection (highest). + /// + If the two Geometrys have the same class, their first + elements are compared. If those are the same, the second elements are + compared, etc. + + A Geometry with which to compare this Geometry + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry, using the given . + + If their classes are different, they are compared using the following + ordering: + + Point (lowest), + MultiPoint, + LineString, + LinearRing, + MultiLineString, + Polygon, + MultiPolygon, + GeometryCollection (highest). + + If the two Geometrys have the same class, their first + elements are compared. If those are the same, the second elements are + compared, etc. + + A Geometry with which to compare this Geometry + A IComparer<CoordinateSequence> + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether the two Geometrys are equal, from the point + of view of the EqualsExact method. Called by EqualsExact + . In general, two Geometry classes are considered to be + "equivalent" only if they are the same class. An exception is LineString + , which is considered to be equivalent to its subclasses. + + The Geometry with which to compare this Geometry for equality. + + true if the classes of the two Geometry + s are considered to be equal by the equalsExact method. + + + + + Throws an exception if g's type is a GeometryCollection. + (Its subclasses do not trigger an exception). + + The Geometry to check. + + if g is a GeometryCollection, but not one of its subclasses. + + + + + Tests whether this is an instance of a general {@link GeometryCollection}, + rather than a homogeneous subclass. + + true if this is a heterogeneous GeometryCollection + + + + Returns the minimum and maximum x and y values in this Geometry, + or a null Envelope if this Geometry is empty. + Unlike EnvelopeInternal, this method calculates the Envelope + each time it is called; EnvelopeInternal caches the result + of this method. + + + This Geometrys bounding box; if the Geometry + is empty, Envelope.IsNull will return true. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry having the same class. + + A Geometry having the same class as this Geometry. + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the NTS Technical + Specifications. + + + + + Returns whether this Geometry is greater than, equal to, + or less than another Geometry of the same class. + using the given . + + A Geometry having the same class as this Geometry + The comparer + + A positive number, 0, or a negative number, depending on whether + this object is greater than, equal to, or less than o, as + defined in "Normal Form For Geometry" in the JTS Technical + Specifications + + + + + Returns the first non-zero result of CompareTo encountered as + the two Collections are iterated over. If, by the time one of + the iterations is complete, no non-zero result has been encountered, + returns 0 if the other iteration is also complete. If b + completes before a, a positive number is returned; if a + before b, a negative number. + + A Collection of IComparables. + A Collection of IComparables. + The first non-zero compareTo result, if any; otherwise, zero. + + + + + + + + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + Tests whether this is a rectangular . + + true if the geometry is a rectangle. + Polygon overrides to check for actual rectangle. + + + + A predefined with == . + + + + + + + Basic implementation of GeometryCollection. + + + + + Represents an empty GeometryCollection. + + + + + Internal representation of this GeometryCollection. + + + + + + + + The Geometrys for this GeometryCollection, + or null or an empty array to create the empty + point. Elements may be empty Geometrys, + but not nulls. + + + For create this is used a standard + with == . + + + + + + + + The Geometrys for this GeometryCollection, + or null or an empty array to create the empty + point. Elements may be empty Geometrys, + but not nulls. + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + Collects all coordinates of all subgeometries into an Array. + Note that while changes to the coordinate objects themselves + may modify the Geometries in place, the returned Array as such + is only a temporary container which is not synchronized back. + + The collected coordinates. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the name of this object's interface. + + "GeometryCollection" + + + + Gets the OGC geometry type + + + + + + + + + + Returns the area of this GeometryCollection. + + + + + Returns the length of this GeometryCollection. + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + Return true if all features in collection are of the same type. + + + + + + + + Returns the iTh element in the collection. + + + + + + + Creates a with + every component reversed. + The order of the components in the collection are not reversed. + + A in the reverse order + + + + The actual implementation of the function for GeometryCollections. + + A reversed geometry + + + + Returns the number of geometries contained by this . + + + + + Iterates over all Geometry's in a GeometryCollection. + Implements a pre-order depth-first traversal of the GeometryCollection + (which may be nested). The original GeometryCollection is + returned as well (as the first object), as are all sub-collections. It is + simple to ignore the GeometryCollection objects if they are not + needed. + + + + + The GeometryCollection being iterated over. + + + + + Indicates whether or not the first element (the GeometryCollection) + has been returned. + + + + + The number of Geometrys in the the GeometryCollection. + + + + + The index of the Geometry that will be returned when next + is called. + + + + + The iterator over a nested GeometryCollection, or null + if this GeometryCollectionIterator is not currently iterating + over a nested GeometryCollection. + + + + + Constructs an iterator over the given GeometryCollection. + + + The collection over which to iterate; also, the first + element returned by the iterator. + + + + > + + + > + The parent GeometryCollection is the first object returned! + + + + + + + + + + + + + + + + + + + Delegate function declaration to handle filter operation + + The geometry to filter + + + + An implementation that applies filtering with the provided + + + + + Creates an instance of this class + + The filter method to be used + + + + Supplies a set of utility methods for building Geometry objects + from lists of Coordinates. + + + Note that the factory constructor methods do not change the input coordinates in any way. + In particular, they are not rounded to the supplied PrecisionModel. + It is assumed that input Coordinates meet the given precision. + + Instances of this class are thread-safe. + + + + + A predefined with c + == . + + + + + A predefined with + == . + + A shortcut for . + + + + A predefined with + == . + + + + + A predefined with + == . + + + + + Returns the PrecisionModel that Geometries created by this factory + will be associated with. + + + + + + + + + + The SRID value defined for this factory. + + + + + Gets a value indicating the geometry overlay function set to use + + A geometry overlay function set. + + + + Gets a value indicating the geometry overlay function set to use + + A geometry overlay function set. + + + + Gets a value indicating the object that created this factory. + + + + + + + + + + + + + Constructs a GeometryFactory that generates Geometries having the given + precision model, spatial-reference ID, + CoordinateSequence and + NtsGeometryServices. + + A precision model + A spatial reference id + A coordinate sequence factory + NtsGeometryServices object creating this factory + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. + + + + + Constructs a GeometryFactory that generates Geometries having the given + CoordinateSequence implementation, a double-precision floating PrecisionModel and a + spatial-reference ID of 0. + + + + + Constructs a GeometryFactory that generates Geometries having the given + {PrecisionModel} and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel and spatial-reference ID, and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + The SRID to use. + + + + Constructs a GeometryFactory that generates Geometries having a floating + PrecisionModel and a spatial-reference ID of 0. + + + + + Converts the IEnumerable to an array. + + The IEnumerable of Points to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of Geometry's to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of LineStrings to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of LinearRings to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of Polygons to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of MultiPoints to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of MultiLineStrings to convert. + The IEnumerable in array format. + + + + Converts the IEnumerable to an array. + + The IEnumerable of MultiPolygons to convert. + The IEnumerable in array format. + + + + Creates a with the same extent as the given envelope. + + + + The Geometry returned is guaranteed to be valid. + To provide this behavior, the following cases occur: + + + If the Envelope is: +
    +
  • null returns an empty
  • +
  • a point returns a non-empty
  • +
  • a line returns a two-point
  • +
  • a rectangle returns a whose points are (minx, maxy), (minx, maxy), (maxx, maxy), (maxx, miny).
  • +
+
+
+ The Envelope + + An empty Point (for null Envelopes), a Point (when min x = max x and min y = max y) or a Polygon (in all other cases) + +
+ + + Creates an empty Point + + + An empty Point + + + + + Creates a Point using the given Coordinate. + A null coordinate creates an empty Geometry. + + a Coordinate, or null + A object + + + + Creates a Point using the given CoordinateSequence; a null or empty + CoordinateSequence will create an empty Point. + + a CoordinateSequence (possibly empty), or null + A object + + + + Creates an empty LineString + + An empty LineString + + + + Creates a LineString using the given Coordinates. + A null or empty array creates an empty LineString. + + An array without null elements, or an empty array, or null. + A object + + + + Creates a LineString using the given CoordinateSequence. + A null or empty CoordinateSequence creates an empty LineString. + + A CoordinateSequence (possibly empty), or null. + A object + + + Creates an empty LinearRing + An empty LinearRing + + + + Creates a LinearRing using the given Coordinates; a null or empty array + creates an empty LinearRing. The points must form a closed and simple + linestring. Consecutive points must not be equal. + + An array without null elements, or an empty array, or null. + A object + If the ring is not closed, or has too few points + + + + Creates a LinearRing using the given CoordinateSequence; a null or empty CoordinateSequence + creates an empty LinearRing. The points must form a closed and simple + linestring. Consecutive points must not be equal. + + A CoordinateSequence (possibly empty), or null. + A object + If the ring is not closed, or has too few points + + + Creates an empty Polygon + An empty Polygon + + + + Constructs a Polygon with the given exterior boundary and + interior boundaries. + + + The outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty point is to be created. + + + The inner boundaries of the new Polygon, or + null or empty LinearRing s if + the empty point is to be created. + + A object + + + + Constructs a Polygon with the given exterior boundary. + + the outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty geometry is to be created. + A object + If the boundary ring is invalid + + + + Constructs a Polygon with the given exterior boundary. + + the outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty geometry is to be created. + A object + If the boundary ring is invalid + + + + Constructs a Polygon with the given exterior boundary. + + the outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty geometry is to be created. + the created Polygon + If the boundary ring is invalid + + + Creates an empty MultiPoint + An empty MultiPoint + + + + Creates a using the given Points. + A null or empty array will create an empty MultiPoint. + + An array (without null elements), or an empty array, or null. + A object + + + + Creates a using the given Coordinates. + A null or empty array will create an empty MultiPoint. + + An array (without null elements), or an empty array, or null + A object + + + + Creates a using the given CoordinateSequence. + A null or empty CoordinateSequence will create an empty MultiPoint. + + A CoordinateSequence (possibly empty), or null. + A object + + + Creates an empty MultiLineString + An empty MultiLineString + + + + Creates a MultiLineString using the given LineStrings; a null or empty + array will create an empty MultiLineString. + + LineStrings, each of which may be empty but not null- + A object + + + Creates an empty MultiPolygon + An empty MultiPolygon + + + + Creates a MultiPolygon using the given Polygons; a null or empty array + will create an empty Polygon. The polygons must conform to the + assertions specified in the OpenGIS Simple Features + Specification for SQL. + + Polygons, each of which may be empty but not null. + A object + + + Creates an empty GeometryCollection + An empty GeometryCollection + + + + Creates a GeometryCollection using the given Geometries; a null or empty + array will create an empty GeometryCollection. + + an array of Geometries, each of which may be empty but not null, or null + A object + + + + Build an appropriate Geometry, MultiGeometry, or + GeometryCollection to contain the Geometrys in + it. + + + If geomList contains a single Polygon, + the Polygon is returned.
+ If geomList contains several Polygons, a + MultiPolygon is returned.
+ If geomList contains some Polygons and + some LineStrings, a GeometryCollection is + returned.
+ If geomList is empty, an empty GeometryCollection + is returned. + Note that this method does not "flatten" Geometries in the input, and hence if + any MultiGeometries are contained in the input a GeometryCollection containing + them will be returned. +
+ The Geometry to combine. + + A of the "smallest", "most type-specific" + class that can contain the elements of geomList. + +
+ + + Creates an empty atomic geometry of the given dimension. + If passed a dimension of + will create an empty . + + The required dimension (, , or ) + An empty atomic geometry of given dimension + + + + Creates a deep copy of the input . + The defined for this factory + is used to copy the s + of the input geometry. + + This is a convenient way to change the CoordinateSequence + used to represent a geometry, or to change the + factory used for a geometry. + + can also be used to make a deep copy, + but it does not allow changing the CoordinateSequence type. + + The geometry + A deep copy of the input geometry, using the CoordinateSequence type of this factory + + + + + Returns a new whose is + the given value and whose other values and behavior are, as near as we possibly can make + it, the same as our own. + + + The for the result. + + + The cloned instance. + + + + + + + + An extended that is capable of enforcing a ring orientation for polygons. + + + + + Gets or sets the default polygon shell ring orientation that is used when nothing else has been set. + + + + + Gets or sets the default precision model to use with these geometry factories + + + + + Gets or sets the default coordinate sequence factory to use with these geometry factories + + + + + Gets or sets the default spatial reference id. + + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. + + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. + + + + + Constructs a GeometryFactory that generates Geometries having the given + CoordinateSequence implementation, a double-precision floating PrecisionModel and a + spatial-reference ID of 0. + + + + + Constructs a GeometryFactory that generates Geometries having the given + {PrecisionModel} and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + + + + Constructs a GeometryFactory that generates Geometries having the given + PrecisionModel and spatial-reference ID, and the default CoordinateSequence + implementation. + + The PrecisionModel to use. + The SRID to use. + + + + Constructs a GeometryFactory that generates Geometries having a floating + PrecisionModel and a spatial-reference ID of 0. + + + + + The polygon shell ring orientation enforced by this factory + + + + + Gets or sets a value indicating the ring orientation of the + Polygon's exterior rings. + If its value is , this + factory behaves just like the base . + + + + The setter of this property has to be used prior to any call + to CreatePolygon, CreateMultiPolygon, or + ReplaceSRID + + + + + + + + + Gets a value indicating the ring orientation for the interior rings + + + This value is always opposite of , + except when its value is . + + + + + Constructs a Polygon with the given exterior boundary and + interior boundaries. + + The is enforced on the constructed polygon. + + + The outer boundary of the new Polygon, or + null or an empty LinearRing if + the empty point is to be created. + + + The inner boundaries of the new Polygon, or + null or empty LinearRing s if + the empty point is to be created. + + A object + + + + Creates a MultiPolygon using the given Polygons; a null or empty array + will create an empty Polygon. The polygons must conform to the + assertions specified in the OpenGIS Simple Features + Specification for SQL. + The is enforced on each polygon. + + Polygons, each of which may be empty but not null. + A object + + + + + + + Utility function to enforce a specific ring orientation on a linear ring + + The ring + The required orientation + A ring + + + + A class that encapsulates geometry overlay functionality + + + + + Gets a value indicating a geometry overlay operation class that uses old NTS overlay operation set. + + + + + Gets a value indicating a geometry overlay operation class that uses next-generation NTS overlay operation set. + + + + + Computes a Geometry representing the overlay of geometries a and b + using the spatial function defined by opCode. + + The 1st geometry + The 2nd geometry + The spatial function for the overlay operation + The computed geometry + + + + Computes a Geometry representing the point-set which is + common to both a and b Geometry. + + The 1st Geometry + The 2nd Geometry + A geometry representing the point-set common to the two Geometrys. + + + + + Computes a Geometry representing the point-set + which is contained in both input Geometrys . + + The 1st Geometry + The 2nd Geometry + A point-set combining the points of + Geometry's a and b. + + + + + + Computes a Geometry representing the closure of the point-set + of the points contained in this Geometry that are not contained in + the other Geometry. + + The 1st Geometry + The 2nd Geometry + + A Geometry representing the point-set difference + of Geometry's a and b. + + + + + + Computes a Geometry representing the closure of the point-set + which is the union of the points in Geometry a which are not + contained in the Geometry b, + with the points in the b Geometry not contained in the Geometry a. + + The 1st Geometry + The 2nd Geometry + + A Geometry representing the point-set symmetric difference + of Geometry's a and b. + + + + + + Computes the union of all the elements in the Geometry a. + + The Geometry + The union of a + + + + + A spatial object in an AbstractSTRtree. + + + + + Returns a representation of space that encloses this Boundable, preferably + not much bigger than this Boundable's boundary yet fast to test for intersection + with the bounds of other Boundables. The class of object returned depends + on the subclass of AbstractSTRtree. + + + An Envelope (for STRtrees), an Interval (for SIRtrees), or other object + (for other subclasses of AbstractSTRtree). + + + + + Gets the item that is bounded + + + + + An interface for classes which use the values of the coordinates in a . + Coordinate filters can be used to implement centroid and + envelope computation, and many other functions. + + ICoordinateFilter is + an example of the Gang-of-Four Visitor pattern. + + Note: it is not recommended to use these filters to mutate the coordinates. + There is no guarantee that the coordinate is the actual object stored in the source geometry. + In particular, modified values may not be preserved if the source Geometry uses a non-default . + If in-place mutation is required, use . + + + + + + + Performs an operation with the provided coord. + Note that there is no guarantee that the input coordinate + is the actual object stored in the source geometry, + so changes to the coordinate object may not be persistent. + + A Coordinate to which the filter is applied. + + + + An interface for classes which process the coordinates in a . + A filter can either record information about each coordinate, + or change the value of the coordinate. + Filters can be + used to implement operations such as coordinate transformations, centroid and + envelope computation, and many other functions. + classes support the concept of applying a + CoordinateSequenceFilter to each + s they contain. + + For maximum efficiency, the execution of filters can be short-circuited by using the property. + + + + CoordinateSequenceFilter is an example of the Gang-of-Four Visitor pattern. + Note: In general, it is preferable to treat Geometrys as immutable. + Mutation should be performed by creating a new Geometry object (see + and for convenient ways to do this). + An exception to this rule is when a new Geometry has been created via . + In this case mutating the Geometry will not cause aliasing issues, + and a filter is a convenient way to implement coordinate transformation. + + + Martin Davis + + + + + + + Performs an operation on a coordinate in a . + + the CoordinateSequence to which the filter is applied + i the index of the coordinate to apply the filter to + + + + Reports whether the application of this filter can be terminated. + + + Once this method returns true, it must + continue to return true on every subsequent call. + + + + + Reports whether the execution of this filter has modified the coordinates of the geometry. + If so, will be executed + after this filter has finished being executed. + + Most filters can simply return a constant value reflecting whether they are able to change the coordinates. + + + + A variant of , except it receives each + just once, instead of once for each of its coordinates. + + + + + Reports whether the application of this filter can be terminated. + + + Once this method returns it must continue to return + on every subsequent call. + + + + + Reports whether the execution of this filter has modified the coordinates of the geometry. + If so, will be executed + after this filter has finished being executed. + + + Most filters can simply return a constant value reflecting whether they are able to + change the coordinates. + + + + + Performs an operation on a . + + + The . + + + + + Interface describing objects that can expand themselves by objects of type . + + The type of objects that can expand clients + + + + Method to expand this object by + + The object to expand with + + + + Function to expand compute a new object that is this object by expanded by . + + The object to expand with + The expanded object + + + + Geometry classes support the concept of applying + an IGeometryComponentFilter filter to the Geometry. + + + The filter is applied to every component of the Geometry + which is itself a Geometry + and which does not itself contain any components. + (For instance, all the LinearRings in Polygons are visited, + but in a MultiPolygon the Polygons themselves are not visited.) + Thus the only classes of Geometry which must be + handled as arguments to + are s, s and s. + An IGeometryComponentFilter filter can either + record information about the Geometry + or change the Geometry in some way. + IGeometryComponentFilter is an example of the Gang-of-Four Visitor pattern. + > + + + + Performs an operation with or on geom. + + A Geometry to which the filter is applied. + + + + GeometryCollection classes support the concept of + applying a IGeometryFilter to the Geometry. + The filter is applied to every element Geometry. + A IGeometryFilter can either record information about the Geometry + or change the Geometry in some way. + IGeometryFilter is an example of the Gang-of-Four Visitor pattern. + + + + + Performs an operation with or on geom. + + A Geometry to which the filter is applied. + + + + Interface describing objects that can perform an intersects predicate with objects. + + The type of the component that can intersect + + + + Predicate function to test if intersects with this object. + + The object to test + true if this objects intersects with + + + + Interface to identify all Geometry subclasses that have a Dimension of + and have components which are s. + + Martin Davis + + + + + + A backed by an array of s. + This is the implementation that s use by default. + + Coordinates returned by , and are live -- + modifications to them are actually changing the + CoordinateSequence's underlying data. + A dimension may be specified for the coordinates in the sequence, + which may be 2 or 3. + The actual coordinates will always have 3 ordinates, + but the dimension is useful as metadata in some situations. + + + + + Array of coordinates in sequence + + + + + Constructs a sequence based on the given array of s. + The coordinate dimension defaults to 2 + + + The array is not copied. + + The coordinate array that will be referenced. + + + + Constructs a sequence based on the given array + of s. + + The Array is not copied + The coordinate array that will be referenced. + The dimension of the coordinates + + + + Constructs a sequence based on the given array + of s. + + The Array is not copied + + It is your responsibility to ensure the array contains Coordinates of the + indicated dimension and measures (See ). + + The coordinate array that will be referenced. + The dimension of the coordinates + The number of measure ordinate values. + + + + Constructs a sequence of a given size, populated with new Coordinates. + + The size of the sequence to create. + + + + Constructs a sequence of a given , populated + with new s of the given . + + The size of the sequence to create. + the dimension of the coordinates + + + + Constructs a sequence of a given , populated + with new s of the given + with the given number of + + The size of the sequence to create. + the dimension of the coordinates + the number of measures of the coordinates + + + + Creates a new sequence based on a deep copy of the given . + + The coordinate sequence that will be copied + + + + Ensure array contents of the same type, making use of as needed. + + A new array will be created if needed to return a consistent result. + + + array containing consistent coordinate instances + + + + Get the Coordinate with index i. + + The index of the coordinate. + The requested Coordinate instance. + + + + Get a copy of the Coordinate with index i. + + The index of the coordinate. + A copy of the requested Coordinate. + + + + Copies the i'th coordinate in the sequence to the supplied Coordinate. + + The index of the coordinate to copy. + A Coordinate to receive the value. + + + + Returns ordinate X (0) of the specified coordinate. + + + + The value of the X ordinate in the index'th coordinate. + + + + + Returns ordinate Y (1) of the specified coordinate. + + + + The value of the Y ordinate in the index'th coordinate. + + + + + Returns ordinate Z of the specified coordinate if available. + + + + The value of the Z ordinate in the index'th coordinate, or Double.NaN if not defined. + + + + + Returns ordinate M of the specified coordinate if available. + + + + The value of the M ordinate in the index'th coordinate, or Double.NaN if not defined. + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure values). + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + + + + + Creates a deep copy of the CoordinateArraySequence. + + The deep copy. + + + + + + + + + + Sets the value for a given ordinate of a coordinate in this sequence. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + The new ordinate value. + + + + This method exposes the internal Array of Coordinate Objects. + + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + + + + Returns the string representation of the coordinate array. + + + + + + Creates CoordinateSequences represented as an array of Coordinates. + + + + + Returns the singleton instance of CoordinateArraySequenceFactory. + + + + + Returns a CoordinateArraySequence based on the given array (the array is not copied). + + the coordinates, which may not be null nor contain null elements. + + + + + + + + + + + A coordinate sequence that follows the dotspatial shape range + + + + + Creates an instance of this class + + The coordinates + + + + + Constructs a sequence of a given size, populated with new Coordinates. + + The size of the sequence to create. + The number of dimensions. + The number of measures. + + + + Constructs a sequence of a given size, populated with new Coordinates. + + The size of the sequence to create. + The kind of ordinates. + + + + Creates a sequence based on the given coordinate sequence. + + The coordinate sequence. + The ordinates to copy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Creates a reversed version of this coordinate sequence with cloned s + + A reversed version of this sequence + + + + Gets the vector with x- and y-ordinate values; + + If you modify the values of this vector externally, you need to call ! + + + + Gets the vector with z-ordinate values + + If you modify the values of this vector externally, you need to call ! + + + + Gets the vector with measure values + + If you modify the values of this vector externally, you need to call ! + + + + Releases the weak reference to the weak referenced coordinate array + + This is necessary if you modify the values of the , , arrays externally. + + + + A coordinate sequence factory class that creates DotSpatial's Shape/ShapeRange like coordinate sequences. + + + + + Returns the singleton instance of DotSpatialAffineCoordinateSequenceFactory. + + + + + + Returns a CoordinateArraySequence based on the given array (the array is not copied). + + the coordinates, which may not be null nor contain null elements. + + + + + Creates a which is a copy + of the given . + This method must handle null arguments by creating an empty sequence. + + + A coordinate sequence + + + + + + + Creates a of the specified size and ordinates. + For this to be useful, the implementation must be mutable. + + The number of coordinates. + + The ordinates each coordinate has. is fix, + and can be set. + + A coordinate sequence. + + + + Creates an instance of this class using the provided array for x- and y ordinates + + The x- and y-ordinates + A coordinate sequence + + + + Creates an instance of this class using the provided array for x- and y ordinates, + the array for either z-ordinates or measure values. This is indicated by . + + The x- and y-ordinates + An array of z- or measure values + A value indicating if contains z-ordinates or measure values. + A coordinate sequence + + + + Creates an instance of this class using the provided array for x- and y ordinates, + the array for z ordinates and for measure values. + + The x- and y-ordinates + An array of z- or measure values + An array of measure values. + A coordinate sequence + + + + A CoordinateSequence implementation based on a packed arrays. + + + + + A soft reference to the Coordinate[] representation of this sequence. + Makes repeated coordinate array accesses more efficient. + + + + + Creates an instance of this class + + The number of s in the sequence. + The total number of ordinates that make up a in this sequence. + the number of measure-ordinates each { in this sequence has. + + + + Returns (possibly a copy of) the ith Coordinate in this collection. + Whether or not the Coordinate returned is the actual underlying + Coordinate or merely a copy depends on the implementation. + Note that in the future the semantics of this method may change + to guarantee that the Coordinate returned is always a copy. Callers are + advised not to assume that they can modify a CoordinateSequence by + modifying the Coordinate returned by this method. + + + + + + + Returns (possibly copies of) the Coordinates in this collection. + Whether or not the Coordinates returned are the actual underlying + Coordinates or merely copies depends on the implementation. + Note that if this implementation does not store its data as an array of Coordinates, + this method will incur a performance penalty because the array needs to + be built from scratch. + + + + + + Releases the weak reference to the coordinate array. + + + This is necessary if you directly modify the array from GetRawCoordinates. + + + + + + + + Returns a Coordinate representation of the specified coordinate, by always + building a new Coordinate object. + + The coordinate index + The at the given index + + + + Packed coordinate sequence implementation based on doubles. + + + + + The packed coordinate array + + + + + Initializes a new instance of the class. + + An array of double values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of float values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of s. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + The number of coordinates in this sequence + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Gets the underlying array containing the coordinate values. + + The array of coordinate values + + + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure values). + + + Beware, for performance reasons the ordinate index is not checked, if + it's over dimensions you may not get an exception but a meaningless + value. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + + + + + Sets the ordinate of a coordinate in this sequence. + + The coordinate index. + The ordinate index in the coordinate, 0 based, + smaller than the number of dimensions. + The new ordinate value. + + Warning: for performance reasons the ordinate index is not checked. + If it is larger than the dimension a meaningless value may be returned. + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + Packed coordinate sequence implementation based on floats. + + + + + The packed coordinate array + + + + + Initializes a new instance of the class. + + An array of float values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of double values that contains the ordinate values of the sequence. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + An array of s. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + + + + Initializes a new instance of the class. + + An array of s. + The total number of ordinates that make up a in this sequence. + The number of measure-ordinates each in this sequence has. + + + + Initializes a new instance of the class. + + + + + + + + Gets the underlying array containing the coordinate values. + + The array of coordinate values + + + + + + + Returns the ordinate of a coordinate in this sequence. + Ordinate indices 0 and 1 are assumed to be X and Y. + Ordinate indices greater than 1 have user-defined semantics + (for instance, they may contain other dimensions or measure values). + + + Beware, for performance reasons the ordinate index is not checked, if + it's over dimensions you may not get an exception but a meaningless + value. + + The coordinate index in the sequence. + The ordinate index in the coordinate (in range [0, dimension-1]). + + + + + Sets the ordinate of a coordinate in this sequence. + + The coordinate index. + The ordinate index in the coordinate, 0 based, + smaller than the number of dimensions. + The new ordinate value. + + Warning: for performance reasons the ordinate index is not checked: + if it is over dimensions you may not get an exception but a meaningless value. + + + + + Expands the given Envelope to include the coordinates in the sequence. + Allows implementing classes to optimize access to coordinate values. + + The envelope to expand. + A reference to the expanded envelope. + + + + Builds packed array coordinate sequences. + The array data type can be either + double or float, + and defaults to double. + + + + + An enumeration of valid type codes + + + + + Type code for arrays of type double. + + + + + Type code for arrays of type float. + + + + + A factory creating coordinate sequences + + + + + A factory creating coordinate sequences + + + + + Initializes a new instance of the class, + using double values. + + + + + Initializes a new instance of the class. + + The type. + + + + Gets the type of packed coordinate sequence this factory builds, either + or + + The type of packed array built. + + + + Returns a CoordinateSequence based on the given array; whether or not the + array is copied is implementation-dependent. + + Coordinates array, which may not be null nor contain null elements + + + + + Returns a CoordinateSequence based on the given coordinate sequence; whether or not the + array is copied is implementation-dependent. + + + + + + + Creates a packed coordinate sequence of type from the provided double array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + A packed coordinate sequence of + + + + Creates a packed coordinate sequence of type from the provided double array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + The coordinate measure count + A packed coordinate sequence of + + + + Creates a packed coordinate sequence of type from the provided float array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + A packed coordinate sequence of + + + + Creates a packed coordinate sequence of type from the provided float array + using the provided dimension and a measure of 0. + + The array containing coordinate values + The coordinate dimension + The coordinate measure count + A packed coordinate sequence of + + + + + + + An implementation of that packs its contents in a way that + can be customized by the creator. + + + + + Initializes a new instance of the class. + + + Contains the raw data for this sequence. + + + Contains a pair of indexes to tell us, for each dimension, where to find its data in + . + + + The value for . + + + + + Gets the underlying for the ordinates at the given index, along + with a "stride" value that represents how many slots there are between elements. + + + The index of the ordinate whose values to get, from + . + + + The underlying and stride. + + + Assuming is nonzero, the first element of the + returned array holds the first coordinate's value for the requested ordinate, and the + last element of the returned array holds the last coordinate's value for the requested + ordinate. + + + + + + + + + + + + + + + + + + + + + + + Factory for creating instances. + + + + + Initializes a new instance of the class. + + + A sequence of zero or more flags representing ordinate values + that should be allocated together. + + + Thrown when is . + + + Thrown when a given flag appears in more than one element of + . + + + Any flags not represented in , and any spatial or + measure dimensions beyond the 16th, will be allocated together, SoA-style. + + Elements without any bits set will be silently ignored. + + + + + Creates a new that uses the given arrays for reading + and writing X and Y data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X and Y data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2. + + + + + Creates a new that uses the given arrays for reading + and writing X, Y, and Z data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and Z data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2, or when the + input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and Z data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X, Y, and Z values, laid out as + [x0, y0, z0, x1, y1, z1, x2, y2, z2, ..., xn, yn, zn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 3. + + + + + Creates a new that uses the given arrays for reading + and writing X, Y, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2, or when the + input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X, Y, and M values, laid out as + [x0, y0, m0, x1, y1, m1, x2, y2, m2, ..., xn, yn, mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 3. + + + + + Creates a new that uses the given arrays for reading + and writing X, Y, Z, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X values, laid out as + [x0, x1, x2, ..., xn]. + + + An array of Y values, laid out as + [y0, y1, y2, ..., yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given arrays. + + + Thrown when the input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, Z, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X and Y values, laid out as + [x0, y0, x1, y1, x2, y2, ..., xn, yn]. + + + An array of Z values, laid out as + [z0, z1, z2, ..., zn]. + + + An array of M values, laid out as + [m0, m1, m2, ..., mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 2, or when the + input arrays do not contain data for the same number of coordinates. + + + + + Creates a new that uses the given array for reading + and writing X, Y, Z, and M data ignoring the flags that were passed + into the constructor for this factory instance. + + + An array of X, Y, Z, and M values, laid out as + [x0, y0, z0, m0, x1, y1, z1, m1, x2, y2, z2, m2, ..., xn, yn, zn, mn]. + + + A instance that's backed by the given array. + + + The resulting instance is essentially a + with slightly more overhead, so the main reason to prefer this over that one would be if + you really need to avoid copying the data to fit it into that format. + + + Thrown when the length of is not a multiple of 4. + + + + + + + + Models a Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix. + + + DE-9IM matrix values (such as "212FF1FF2") + specify the topological relationship between two s. + This class can also represent matrix patterns (such as "T*T******") + which are used for matching instances of DE-9IM matrices. + + DE-9IM matrices are 3x3 matrices with integer entries. + The matrix indices {0,1,2} + represent the topological locations + that occur in a geometry(Interior, Boundary, Exterior). + These are provided by the constants + , , and . + + When used to specify the topological relationship between two geometries, + the matrix entries represent the possible dimensions of each intersection: + = 2, = 1, = 0 and = -1.
+ When used to represent a matrix pattern entries can have the additional values + ("T") and ("*"). + + For a description of the DE-9IM and the spatial predicates derived from it, see the following references: + + OGC 99-049 OpenGIS Simple Features Specification for SQL. + + OGC 06-103r4 OpenGIS Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture, + Section 6.1.15 (which provides some further details on certain predicate specifications). + Wikipedia article on DE-9IM + + + Methods are provided to: + + set and query the elements of the matrix in a convenient fashion + convert to and from the standard string representation(specified in SFS Section 2.1.13.2). + test if a matrix matches a given pattern string. + test if a matrix(possibly with geometry dimensions) matches a standard named spatial predicate + +
+
+ + + Internal representation of this . + + + + + Creates an with null location values. + + + + + Creates an with the given dimension + symbols. + + A string of nine dimension symbols in row major order. + + + + Creates an with the same elements as + other. + + An to copy. + + + + Adds one matrix to another. + Addition is defined by taking the maximum dimension value of each position + in the summand matrices. + + The matrix to add. + + + + Tests if the dimension value matches TRUE + (i.e. has value 0, 1, 2 or TRUE). + + A number that can be stored in the IntersectionMatrix. + Possible values are {, , , , , } + true if the dimension value matches + + + + Tests if the dimension value satisfies the dimension symbol. + + + a number that can be stored in the IntersectionMatrix. + Possible values are {True, False, Dontcare, 0, 1, 2}. + + + A character used in the string + representation of an . + Possible values are T, F, * , 0, 1, 2. + + + true if the dimension symbol encompasses the dimension value. + + + + + Tests if each of the actual dimension symbols in a matrix string satisfies the + corresponding required dimension symbol in a pattern string. + + + Nine dimension symbols to validate. + Possible values are T, F, * , 0, 1, 2. + + + Nine dimension symbols to validate + against. Possible values are T, F, * , 0, 1, 2. + + + true if each of the required dimension + symbols encompass the corresponding actual dimension symbol. + + + + + Changes the value of one of this elements. + + + The row of this , + indicating the interior, boundary or exterior of the first + + + The column of this , + indicating the interior, boundary or exterior of the second + + The new value of the element + + + + Changes the elements of this to the + dimension symbols in dimensionSymbols. + + + Nine dimension symbols to which to set this + s elements. Possible values are {T, F, * , 0, 1, 2} + + + + + Changes the specified element to minimumDimensionValue if the element is less. + + + The row of this , + indicating the interior, boundary or exterior of the first . + + + The column of this , + indicating the interior, boundary or exterior of the second . + + + The dimension value with which to compare the + element. The order of dimension values from least to greatest is + True, False, Dontcare, 0, 1, 2. + + + + + If row >= 0 and column >= 0, changes the specified element to minimumDimensionValue + if the element is less. Does nothing if row is smaller to 0 or column is smaller to 0. + + + + + + + + For each element in this , changes the + element to the corresponding minimum dimension symbol if the element is + less. + + + Nine dimension symbols with which to + compare the elements of this . The + order of dimension values from least to greatest is Dontcare, True, False, 0, 1, 2. + + + + + Changes the elements of this to dimensionValue. + + + The dimension value to which to set this + s elements. Possible values True, False, Dontcare, 0, 1, 2}. + + + + + Returns the value of one of this s + elements. + + + The row of this , indicating + the interior, boundary or exterior of the first . + + + The column of this , + indicating the interior, boundary or exterior of the second . + + The dimension value at the given matrix position. + + + + See methods Get(int, int) and Set(int, int, int value) + + + + + Tests if this matrix matches [FF*FF****]. + + + true if the two 's related by + this matrix are disjoint. + + + + + Tests if isDisjoint returns . + + + true if the two 's related by + this matrix intersect. + + + + + Tests if this matrix matches + [FT*******], [F**T*****] or [F***T****]. + + The dimension of the first . + The dimension of the second . + + true if the two + s related by this matrix touch; Returns false + if both s are points. + + + + + Tests whether this geometry crosses the + specified geometry. + + + The crosses predicate has the following equivalent definitions: + + The geometries have some but not all interior points in common. + The DE-9IM Intersection Matrix for the two geometries matches + + [T*T******] (for P/L, P/A, and L/A situations) + [T*****T**] (for L/P, L/A, and A/L situations) + [0********] (for L/L situations) + + + For any other combination of dimensions this predicate returns false. + + The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. + JTS extends the definition to apply to L/P, A/P and A/L situations as well. + This makes the relation symmetric. + + The dimension of the first . + The dimension of the second . + + true if the two + s related by this matrix cross. + + + + + Tests whether this matrix matches [T*F**F***]. + + true if the first is within the second. + + + + Tests whether this matrix matches [T*****FF*] + + true if the first contains the second. + + + + Tests if this matrix matches + [T*****FF*] + or [*T****FF*] + or [***T**FF*] + or [****T*FF*]. + + true if the first covers the second + + + + Tests if this matrix matches + [T*F**F***] + or [*TF**F***] + or [**FT*F***] + or [**F*TF***]. + + true if the first is covered by the second + + + + Tests whether the argument dimensions are equal and + this matrix matches the pattern [T*F**FFF*]. + + Note: This pattern differs from the one stated in + Simple feature access - Part 1: Common architecture. + That document states the pattern as [TFFFTFFFT]. This would + specify that + two identical POINTs are not equal, which is not desirable behaviour. + The pattern used here has been corrected to compute equality in this situation. + + The dimension of the first . + The dimension of the second . + + true if the two s + related by this matrix are equal; the + s must have the same dimension to be equal. + + + + + Tests if this matrix matches + + [T*T***T**] (for two points or two surfaces) + [1*T***T**] (for two curves) + + + The dimension of the first . + The dimension of the second . + + true if the two + s related by this matrix overlap. For this + function to return true, the s must + be two points, two curves or two surfaces. + + + + + Tests whether this matrix matches the given matrix pattern + + + A pattern containing nine dimension symbols with which to + compare the entries of this matrix.Possible + symbol values are { T, F, * , 0, 1, 2}. + + + true if this + matches the required dimension symbols. + + + + + Transposes this IntersectionMatrix. + + This as a convenience, + + + + Returns a nine-character String representation of this . + + + The nine dimension symbols of this + in row-major order. + + + + + Interface to identify all Geometry subclasses that have a Dimension of + and have components that are s. + + Martin Davis + + + + + + Interface to identify all Geometry subclasses that have a Dimension of + and have components that ar s. + + Martin Davis + + + + + + Models an OGC SFS LinearRing. + + + A LinearRing is a which is both closed and simple. + In other words, + the first and last coordinate in the ring must be equal, + and the ring must not self-intersect. + Either orientation of the ring is allowed. + + A ring must have either 0 or 3 or more points. + The first and last points must be equal (in 2D). + If these conditions are not met, the constructors throw + an
+ A ring with 3 points is invalid, because it is collapsed + and thus has a self-intersection. It is allowed to be constructed + so that it can be represented, and repaired if needed. +
+
+ + + The minimum number of vertices allowed in a valid non-empty ring. + Empty rings with 0 vertices are also valid. + + + + + Constructs a LinearRing with the vertices specified + by the given . + + A sequence points forming a closed and simple linestring, + or null to create the empty geometry. + The factory that creates this LinearRing + If the ring is not closed, or has too few points + + + + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + Returns Dimensions.False, since by definition LinearRings do not have a boundary. + + + + + + + + + + Returns the name of this object's interface. + + "LinearRing" + + + > + + + + + + + The actual implementation of the function for LINEARRINGs. + + A reversed geometry + + + + Gets a value indicating if this LINEARRING is oriented + + + + + Initializes a new instance of the class. + + The points used for create this instance. + + For create this is used a standard + with == . + + If the ring is not closed, or has too few points + + + + An enumeration of ring orientation values + + + + + The orientation of the ring's coordinates is counter-clockwise. + + + + + The orientation of the ring's coordinates follows the left-hand-rule, + saying that if you follow the ring in the direction of its coordinates + your left hand will be inside the ring. + + + + + + The orientation of the ring's coordinates is counter-clockwise. + + + + + The orientation of the rings coordinates does not matter. + + + + + The default orientation of the rings coordinates. + Set to + + + + + The orientation of the ring's coordinates is clockwise. + + + + + The orientation of the ring's coordinates follows the right-hand-rule, + saying that if you follow the ring in the direction of its coordinates + your right hand will be inside the ring. + + + + + + The orientation of the ring's coordinates is clockwise. + + + + + Represents a line segment defined by two Coordinates. + Provides methods to compute various geometric properties + and relationships of line segments. + This class is designed to be easily mutable (to the extent of + having its contained points public). + This supports a common pattern of reusing a single LineSegment + object as a way of computing segment properties on the + segments defined by arrays or lists of Coordinates. + + + + + The end-point + + + + + The start-point + + + + + Creates an instance of this class using two coordinates + + The start-point + The end-point + + + + Creates an instance of this class using another instance + + + + + + + + + + + Creates an instance of this class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the minimum X ordinate + + + + + Gets the maximum X ordinate + + + + + Gets the minimum Y ordinate + + + + + Gets the maximum Y ordinate + + + + + Computes the length of the line segment. + + The length of the line segment. + + + + Tests whether the segment is horizontal. + + true if the segment is horizontal. + + + + Tests whether the segment is vertical. + + true if the segment is vertical. + + + + Determines the orientation of a LineSegment relative to this segment. + The concept of orientation is specified as follows: + Given two line segments A and L, + A is to the left of a segment L if A lies wholly in the + closed half-plane lying to the left of L + A is to the right of a segment L if A lies wholly in the + closed half-plane lying to the right of L + otherwise, A has indeterminate orientation relative to L. This + happens if A is collinear with L or if A crosses the line determined by L. + + The LineSegment to compare. + + 1 if seg is to the left of this segment, + -1 if seg is to the right of this segment, + 0 if seg is collinear to or crosses this segment. + + + + + Determines the orientation index of a relative to this segment. + The orientation index is as defined in . + + + + + 1if p is to the left of this segment + -1if p is to the right of this segment + 0if p is collinear with this segment + " + + + + + + Reverses the direction of the line segment. + + + + + Puts the line segment into a normalized form. + This is useful for using line segments in maps and indexes when + topological equality rather than exact equality is desired. + + + + + The angle this segment makes with the x-axis (in radians). + + + + The midpoint of the segment + + + + Computes the distance between this line segment and another one. + + + + + + + Computes the distance between this line segment and a point. + + + + + Computes the perpendicular distance between the (infinite) line defined + by this line segment and a point. + + + + + + + Computes the that lies a given + fraction along the line defined by this segment. + + + A fraction of 0.0 returns the start point of the segment; + A fraction of 1.0 returns the end point of the segment. + If the fraction is < 0.0 or > 1.0 the point returned + will lie before the start or beyond the end of the segment. + + the fraction of the segment length along the line + the point at that distance + + + + Computes the that lies a given + + + A fraction along the line defined by this segment and offset from + the segment by a given distance. + A fraction of 0.0 offsets from the start point of the segment; + A fraction of 1.0 offsets from the end point of the segment. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + + the fraction of the segment length along the line + the distance the point is offset from the segment + (positive is to the left, negative is to the right) + the point at that distance and offset + if the segment has zero length + + + Computes the Projection Factor for the projection of the point p + onto this LineSegment. The Projection Factor is the constant r + by which the vector for this segment must be multiplied to + equal the vector for the projection of p on the line + defined by this segment. + + The projection factor will lie in the range (-inf, +inf), + or be NaN if the line segment has zero length. + + The point to compute the factor for + The projection factor for the point + + + + Computes the fraction of distance (in [0.0, 1.0]) + that the projection of a point occurs along this line segment. + If the point is beyond either ends of the line segment, + the closest fractional value (0.0 or 1.0) is returned. + + + Essentially, this is the clamped to + the range [0.0, 1.0]. + + the point + the fraction along the line segment the projection of the point occurs + + + + Compute the projection of a point onto the line determined + by this line segment. + Note that the projected point may lie outside the line segment. + If this is the case, the projection factor will lie outside the range [0.0, 1.0]. + + + + + + + Project a line segment onto this line segment and return the resulting + line segment. The returned line segment will be a subset of + the target line line segment. This subset may be null, if + the segments are oriented in such a way that there is no projection. + Note that the returned line may have zero length (i.e. the same endpoints). + This can happen for instance if the lines are perpendicular to one another. + + The line segment to project. + The projected line segment, or null if there is no overlap. + + + + Computes the that is offset from + the segment by a given distance. + The computed segment is offset to the left of the line if the offset distance is + positive, to the right if negative. + + The distance the point is offset from the segment + (positive is to the left, negative is to the right) + A line segment offset by the specified distance + Thrown if the segment has zero length + + + + Computes the closest point on this line segment to another point. + + The point to find the closest point to. + + A Coordinate which is the closest point on the line segment to the point p. + + + + + Computes the closest points on a line segment. + + + + A pair of Coordinates which are the closest points on the line segments. + + + + + Computes the reflection of a point in the line defined + by this line segment. + + The point to reflect + The reflected point + + + + Computes an intersection point between two segments, if there is one. + There may be 0, 1 or many intersection points between two segments. + If there are 0, null is returned. If there is 1 or more, a single one + is returned (chosen at the discretion of the algorithm). If + more information is required about the details of the intersection, + the class should be used. + + A line segment + An intersection point, or null if there is none. + + + + + Computes the intersection point of the lines defined by two segments, if there is one. + + + There may be 0, 1 or an infinite number of intersection points between two lines. + If there is a unique intersection point, it is returned. + Otherwise, null is returned. + If more information is required about the details of the intersection, + the class should be used. + + A line segment defining a straight line + An intersection point, or null if there is none or an infinite number + + + + + Creates a LineString with the same coordinates as this segment + + the geometry factory to use + A LineString with the same geometry as this segment + + + + Returns true if o has the same values for its points. + + A LineSegment with which to do the comparison. + + true if o is a LineSegment + with the same values for the x and y ordinates. + + + + + + + + + + + + + + + + + + + + + Compares this object with the specified object for order. + Uses the standard lexicographic ordering for the points in the LineSegment. + + + The LineSegment with which this LineSegment + is being compared. + + + A negative integer, zero, or a positive integer as this LineSegment + is less than, equal to, or greater than the specified LineSegment. + + + + + Returns true if other is + topologically equal to this LineSegment (e.g. irrespective + of orientation). + + + A LineSegment with which to do the comparison. + + + true if other is a LineSegment + with the same values for the x and y ordinates. + + + + + + + + + + + + Return HashCode. + + + + + Models an OGC-style LineString + + + A LineString consists of a sequence of two or more vertices, + along with all points along the linearly-interpolated curves + (line segments) between each + pair of consecutive vertices. + Consecutive vertices may be equal. + The line segments in the line may intersect each other (in other words, + the LineString may "curl back" in itself and self-intersect. + LineStrings with exactly two identical points are invalid. + A LineString must have either 0 or 2 or more points. + If these conditions are not met, the constructors throw an . + + + + + + Represents an empty LineString. + + + + + The points of this LineString. + + + + + Initializes a new instance of the class. + + + For create this is used a standard + with == . + + The coordinates used for create this . + If too few points are provided + + + + Initializes a new instance of the class. + + + The points of the LineString, or null + to create the empty point. Consecutive points may not be equal. + + + If too few points are provided + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + Returns an array containing the values of all the vertices for + this geometry. + + + If the geometry is a composite, the array will contain all the vertices + for the components, in the order in which the components occur in the geometry. + + In general, the array cannot be assumed to be the actual internal + storage for the vertices. Thus modifying the array + may not modify the geometry itself. + Use the method + (possibly on the components) to modify the underlying data. + If the coordinates are modified, + must be called afterwards. + + + The vertices of this Geometry. + + + + + + + Gets an array of ordinate values + + The ordinate index + An array of ordinate values + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets + + + + + + + Gets a value indicating the start point of this LINESTRING + + + + + Gets a value indicating the end point of this LINESTRING + + + + + Gets a value indicating if this LINESTRING is closed. + + + + + Gets a value indicating if this LINESTRING forms a ring. + + + + + Returns the name of this object's interface. + + "LineString" + + + + Gets the OGC geometry type + + + + + Returns the length of this LineString + + The length of the polygon. + + + + Returns the boundary, or an empty geometry of appropriate dimension + if this Geometry is empty. + For a discussion of this function, see the OpenGIS Simple + Features Specification. As stated in SFS Section 2.1.13.1, "the boundary + of a Geometry is a set of Geometries of the next lower dimension." + + The closure of the combinatorial boundary of this Geometry. + + + + Creates a whose coordinates are in the reverse order of this objects. + + A with coordinates in the reverse order. + + + + The actual implementation of the function for LINESTRINGs. + + A reversed geometry + + + + Returns true if the given point is a vertex of this LineString. + + The Coordinate to check. + true if pt is one of this LineString's vertices. + + + + + + + + + + + + + + + + + + + + + + + + Performs an operation on the coordinates in this Geometry's s. + + + If the filter reports that a coordinate value has been changed, + will be called automatically. + + The filter to apply + + + + + + + Performs an operation with or on this Geometry and its + subelement Geometrys (if any). + Only GeometryCollections and subclasses + have subelement Geometry's. + + + The filter to apply to this Geometry (and + its children, if it is a GeometryCollection). + + + + + Performs an operation with or on this Geometry and its + component Geometry's. Only GeometryCollections and + Polygons have component Geometry's; for Polygons they are the LinearRings + of the shell and holes. + + The filter to apply to this Geometry. + + + > + + + + Normalizes a LineString. A normalized LineString + has the first point which is not equal to it's reflected point + less than the reflected point. + + + + + + + + + + + + + + + + + + + + + + + + + + + The location of a relative to a + + + + + DE-9IM row index of the interior of the first point and column index of + the interior of the second point. Location value for the interior of a + point. + + int value = 0; + + + + DE-9IM row index of the boundary of the first point and column index of + the boundary of the second point. Location value for the boundary of a + point. + + int value = 1; + + + + DE-9IM row index of the exterior of the first point and column index of + the exterior of the second point. Location value for the exterior of a + point. + + int value = 2; + + + + Used for uninitialized location values. + + int value = 1; + + + + Utility class for enumeration + + + + + Converts the location value to a location symbol, for example, EXTERIOR => 'e'. + + + Either 'e', 'b', 'i' or '-'. + + + + Models a collection of s. + + Any collection of LineStrings is a valid MultiLineString. + + + + + Represents an empty MultiLineString. + + + + + Constructs a MultiLineString. + + + The LineStrings for this MultiLineString, + or null or an empty array to create the empty + point. Elements may be empty LineStrings, + but not nulls. + + + + + + Constructs a MultiLineString. + + + The LineStrings for this MultiLineString, + or null or an empty array to create the empty + point. Elements may be empty LineStrings, + but not nulls. + + + For create this is used a standard + with == . + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + + + + + Returns the name of this object's interface. + + "MultiLineString" + + + + Gets the OGC geometry type + + + + + Gets a value indicating whether this instance is closed. + + true if this instance is closed; otherwise, false. + + + + Creates a in the reverse order to this object. + Both the order of the component LineStrings + and the order of their coordinate sequences are reversed. + + a in the reverse order. + + + + + + > + + + + + + + + + + + + Models a collection of Points. + + + + + Represents an empty MultiPoint. + + + + + Constructs a MultiPoint. + + + The Points for this MultiPoint + , or null or an empty array to create the empty point. + Elements may be empty Points, but not nulls. + + + + + + Constructs a MultiPoint. + + + The Points for this MultiPoint + , or null or an empty array to create the empty point. + Elements may be empty Points, but not nulls. + + + For create this is used a standard + with == . + + + + > + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + + + Returns the name of this object's interface. + + "MultiPoint" + + + + Gets the boundary of this geometry. + Zero-dimensional geometries have no boundary by definition, + so an empty GeometryCollection is returned. + + + + + + + + + + + + + + + + + + + Returns the Coordinate at the given position. + + The index of the Coordinate to retrieve, beginning at 0. + + The nth Coordinate. + + + + Basic implementation of MultiPolygon. + + + + + Represents an empty MultiPolygon. + + + + + Constructs a MultiPolygon. + + + The Polygons for this MultiPolygon + , or null or an empty array to create the empty point. + Elements may be empty Polygons, but not null + s. The polygons must conform to the assertions specified in the + OpenGIS Simple Features + Specification for SQL. + + + For create this is used a standard + with == . + + + + + Constructs a MultiPolygon. + + + The Polygons for this MultiPolygon + , or null or an empty array to create the empty point. + Elements may be empty Polygons, but not null + s. The polygons must conform to the assertions specified in the + OpenGIS Simple Features + Specification for SQL. + + + + + > + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + + + + + + Returns the name of this object's interface. + + "MultiPolygon" + + + > + + + + + + + + + + + + + + + + + Creates a with every component reversed. + + The order of the components in the collection are not reversed. + An in the reverse order + + + + + + + A bounding container for a which is in the shape of a general octagon. + + + The OctagonalEnvelope of a geometric object + is a geometry which is tight bound along the (up to) four extremal rectilinear parallels + and along the (up to) four extremal diagonal parallels. + Depending on the shape of the contained + geometry, the octagon may be degenerate to any extreme + (e.g. it may be a rectangle, a line, or a point). + + + + + Gets the octagonal envelope of a geometry + + The geometry + The octagonal envelope of the geometry + + + + Creates a new null bounding octagon + + + + + Creates a new null bounding octagon bounding a + + The coordinate to bound + + + + Creates a new null bounding octagon bounding a pair of s + + A coordinate to bound + A coordinate to bound + + + + Creates a new null bounding octagon bounding an + + + + + Creates a new null bounding octagon bounding an + (the copy constructor). + + + + + Creates a new null bounding octagon bounding a + + + + + Gets a value indicating the minimal x-ordinate value + + + + + Gets a value indicating the maximal x-ordinate value + + + + + Gets a value indicating the minimal y-ordinate value + + + + + Gets a value indicating the maximal y-ordinate value + + + + + Gets a value indicating the minimal a value + + + + + Gets a value indicating the maximal a value + + + + + Gets a value indicating the minimal b value + + + + + Gets a value indicating the maximal b value + + + + + Gets a value indicating that this object is null + + + + + Method to expand this to include the provided geometry. + + The geometry + + + + Method to expand this to include the provided coordinate sequence. + + The coordinate sequence + A reference to this octagonal envelope, expanded by + + + + Method to expand this to include the provided OctogonalEnvelope. + + The OctogonalEnvelope + A reference to this octagonal envelope, expanded by + + + + Function to expand this to include the provided coordinate. + + The coordinate + A reference to this octagonal envelope, expanded by + + + + Function to expand this to include the provided envelope. + + The envelope + A reference to this octagonal envelope, expanded by + + + + Function to expand this to include the provided - and ordinates. + + A x-ordinate value + A y-ordinate value + A reference to this octagonal envelope, expanded by and + + + + Gets a value indicating if the extremal values for this octagon are valid. + + true if this object has valid values + + + + Function to test if this octagonal envelope intersects octagonal envelope . + + An octagonal envelope + true if this octagonal envelope intersects octagonal envelope . + + + + Function to test if this octagonal envelope contains coordinate. + + A coordinate + true if this octagonal envelope contains coordinate. + + + + Function to test if this octagonal envelope contains octagonal envelope. + + An octagonal envelope + true if this octagonal envelope contains octagonal envelope. + + + + Function to convert this octagonal envelope into a geometry + + The factory to create the geometry + A geometry + + + + OGC compliant geometry factory + + + + + Creates an instance of this class using the default + values for , + and + . + + + + + Creates an instance of this class using the default + values for , + , + but the specified . + + + + Creates an instance of this class using the default + values for , + but the + specified . + + + + + + + + The is guaranteed to be orientated counter-clockwise. + + + + + + The is guaranteed to be orientated counter-clockwise. + + + + + + The is guaranteed to be orientated counter-clockwise. + + + + + + The is guaranteed to be orientated counter-clockwise. +
The are guaranteed to be orientated clockwise. +
+
+ + + Enumeration of OGC Geometry Types + + + + + Point. + + + + + LineString. + + + + + Polygon. + + + + + MultiPoint. + + + + + MultiLineString. + + + + + MultiPolygon. + + + + + GeometryCollection. + + + + + CircularString + + + + + CompoundCurve + + + + + CurvePolygon + + + + + MultiCurve + + + + + MultiSurface + + + + + Curve + + + + + Surface + + + + + PolyhedralSurface + + + + + TIN + + + + + Identifies the different well-supported components of coordinate values. + + All supported coordinates define values for at least the X and the Y components. + + + The first 16 spatial and 16 measure dimensions may also be accessed this way. + + + + + + The 1st spatial dimension. + + + + + The "X" ordinate. + + + + + The 2nd spatial dimension. + + + + + The "Y" ordinate. + + + + + The 3rd spatial dimension. + + + + + The "Z" ordinate. + + + + + The 4th spatial dimension. + + + + + The 5th spatial dimension. + + + + + The 6th spatial dimension. + + + + + The 7th spatial dimension. + + + + + The 8th spatial dimension. + + + + + The 9th spatial dimension. + + + + + The 10th spatial dimension. + + + + + The 11th spatial dimension. + + + + + The 12th spatial dimension. + + + + + The 13th spatial dimension. + + + + + The 14th spatial dimension. + + + + + The 15th spatial dimension. + + + + + The 16th spatial dimension. + + + + + The 1st measure dimension. + + + + + The "M" ordinate. + + + + + The 2nd measure dimension. + + + + + The 3rd measure dimension. + + + + + The 4th measure dimension. + + + + + The 5th measure dimension. + + + + + The 6th measure dimension. + + + + + The 7th measure dimension. + + + + + The 8th measure dimension. + + + + + The 9th measure dimension. + + + + + The 10th measure dimension. + + + + + The 11th measure dimension. + + + + + The 12th measure dimension. + + + + + The 13th measure dimension. + + + + + The 14th measure dimension. + + + + + The 15th measure dimension. + + + + + The 16th measure dimension. + + + + + Flags for Ordinate values + + + + + No ordinates + + + + + Flag for the x-ordinate + + + + + Flag for the y-ordinate + + + + + Flag for the z-ordinate + + + + + Flag for the m-ordinate + + + + + Flag for both x- and y-ordinate + + + + + Flag for x-, y- and z-ordinate + + + + + Flag for x-, y- and m-ordinate + + + + + Flag for x-, y-, z- and m-ordinate + + + + + Flag for the 1st spatial dimension. + + + + + Flag for the 2nd spatial dimension. + + + + + Flag for the 3rd spatial dimension. + + + + + Flag for the 4th spatial dimension. + + + + + Flag for the 5th spatial dimension. + + + + + Flag for the 6th spatial dimension. + + + + + Flag for the 7th spatial dimension. + + + + + Flag for the 8th spatial dimension. + + + + + Flag for the 9th spatial dimension. + + + + + Flag for the 10th spatial dimension. + + + + + Flag for the 11th spatial dimension. + + + + + Flag for the 12th spatial dimension. + + + + + Flag for the 13th spatial dimension. + + + + + Flag for the 14th spatial dimension. + + + + + Flag for the 15th spatial dimension. + + + + + Flag for the 16th spatial dimension. + + + + + Flags for all spatial ordinates. + + + + + Flag for the 1st measure dimension. + + + + + Flag for the 2nd measure dimension. + + + + + Flag for the 3rd measure dimension. + + + + + Flag for the 4th measure dimension. + + + + + Flag for the 5th measure dimension. + + + + + Flag for the 6th measure dimension. + + + + + Flag for the 7th measure dimension. + + + + + Flag for the 8th measure dimension. + + + + + Flag for the 9th measure dimension. + + + + + Flag for the 10th measure dimension. + + + + + Flag for the 11th measure dimension. + + + + + Flag for the 12th measure dimension. + + + + + Flag for the 13th measure dimension. + + + + + Flag for the 14th measure dimension. + + + + + Flag for the 15th measure dimension. + + + + + Flag for the 16th measure dimension. + + + + + Flags for all non-spatial ordinates. + + + + + Flags for all recognized ordinates. + + + + + Static utility functions for dealing with and dimension + + + + + Translates the -flag to a number of dimensions. + + The ordinates flag + The number of dimensions + + + + Translates the -flag to a number of measures. + + The ordinates flag + The number of measures + + + + Represents a single point. + + A Point is topologically valid if and only if: + + The coordinate which defines it if any) is a valid coordinate + (i.e. does not have an NaN X- or Y-ordinate + + + + + + + Represents an empty Point. + + + + + The Coordinate wrapped by this Point. + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + + + + + + Initializes a new instance of the class. + + The coordinate used for create this . + + For create this is used a standard + with == . + + + + + Constructs a Point with the given coordinate. + + + Contains the single coordinate on which to base this Point, + or null to create the empty point. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the name of this object's interface. + + "Point" + + + + Gets the OGC geometry type + + + + + Gets the boundary of this geometry. + Zero-dimensional geometries have no boundary by definition, + so an empty GeometryCollection is returned. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + The actual implementation of the function for POINTs. + + A reversed geometry + + + + + + + + + + + + + + + + + + + + + + Initializes a new instance of the class. + + The x coordinate. + The y coordinate. + The z coordinate. + /// + For create this is used a standard + with set to . + + + + + Initializes a new instance of the class. + + The x coordinate. + The y coordinate. + /// + For create this is used a standard + with set to . + + + + + + + + + + Represents a polygon with linear edges, which may include holes. + The outer boundary (shell) + and inner boundaries (holes) of the polygon are represented by {@link LinearRing}s. + The boundary rings of the polygon may have any orientation. + Polygons are closed, simple geometries by definition. + + The polygon model conforms to the assertions specified in the + OpenGIS Simple Features + Specification for SQL. + + A Polygon is topologically valid if and only if: + + the coordinates which define it are valid coordinates + the linear rings for the shell and holes are valid + (i.e. are closed and do not self-intersect) + holes touch the shell or another hole at at most one point + (which implies that the rings of the shell and holes must not cross) + the interior of the polygon is connected, + or equivalently no sequence of touching holes + makes the interior of the polygon disconnected + (i.e. effectively split the polygon into two pieces). + + + + + + Represents an empty Polygon. + + + + + The exterior boundary, or null if this Polygon + is the empty point. + + + + + The interior boundaries, if any. + + + + + Initializes a new instance of the class. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + point is to be created. + + + The inner boundaries of the new Polygon + , or null or empty LinearRings if the empty + point is to be created. + + + For create this is used a standard + with == . + + + + + Constructs a Polygon with the given exterior boundary and + interior boundaries. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + point is to be created. + + + The inner boundaries of the new Polygon + , or null or empty LinearRings if the empty + point is to be created. + + + + + + Gets a value to sort the geometry + + + NOTE:
+ For JTS v1.17 this property's getter has been renamed to getTypeCode(). + In order not to break binary compatibility we did not follow. +
+
+ + + Returns a vertex of this Geometry + (usually, but not necessarily, the first one). + + + The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation. + + a Coordinate which is a vertex of this Geometry. + null if this Geometry is empty. + + + + + Returns an array containing the values of all the vertices for + this geometry. + + + If the geometry is a composite, the array will contain all the vertices + for the components, in the order in which the components occur in the geometry. + + In general, the array cannot be assumed to be the actual internal + storage for the vertices. Thus modifying the array + may not modify the geometry itself. + Use the method + (possibly on the components) to modify the underlying data. + If the coordinates are modified, + must be called afterwards. + + + The vertices of this Geometry. + + + + + + + Gets an array of ordinate values + + The ordinate index + An array of ordinate values + + + + Returns the count of this Geometrys vertices. The Geometry + s contained by composite Geometrys must be + Geometry's; that is, they must implement NumPoints. + + The number of vertices in this Geometry. + + + + Returns the dimension of this geometry. + + + The dimension of a geometry is is the topological + dimension of its embedding in the 2-D Euclidean plane. + In the NTS spatial model, dimension values are in the set {0,1,2}. + + Note that this is a different concept to the dimension of + the vertex s. + The geometry dimension can never be greater than the coordinate dimension. + For example, a 0-dimensional geometry (e.g. a Point) + may have a coordinate dimension of 3 (X,Y,Z). + + + + The topological dimensions of this geometry + + + + + Returns the dimension of this Geometrys inherent boundary. + + + The dimension of the boundary of the class implementing this + interface, whether or not this object is the empty point. Returns + Dimension.False if the boundary is the empty point. + + NOTE: make abstract and remove setter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the name of this object's interface. + + "Polygon" + + + + + + + Returns the area of this Polygon + + + + + + Returns the perimeter of this Polygon. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests whether this is a rectangular . + + true if the geometry is a rectangle. + + + + + + + The actual implementation of the function for POLYGONs + + A reversed geometry + + + + Constructs a Polygon with the given exterior boundary. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + polygon is to be created. + + + + + + Constructs a Polygon with the given exterior boundary. + + + The outer boundary of the new Polygon, + or null or an empty LinearRing if the empty + polygon is to be created. + + + + + + + + + + + + + + + Indicates the position of a location relative to a + node or edge component of a planar topological structure. + + + + + Specifies that a location is on a component + + 0 + + + + Specifies that a location is to the left of a component + + 1 + + + + Specifies that a location is to the right of a component + + 2 + + + + Specifies that a location is is parallel to x-axis of a component + + -1 + + + + Creates a new position index + + A position index + + + + Gets a value indicating the position index + + + + + Returns if the position is , + if the position is , or the position + otherwise. + + + + + Equality comparer for indices + + The position index on the left-hand-side + The position index on the right-hand-side + true if both indices are equal. + + + + Inequality comparer for indices + + The position index on the left-hand-side + The position index on the right-hand-side + true if both indices are not equal. + + + + Implicit conversion operator for to conversion. + + The position index + + + + Specifies the precision model of the Coordinates in a Geometry. + In other words, specifies the grid of allowable points for a Geometry. + A precision model may befloating ( or ), + in which case normal floating-point value semantics apply. + + + For a precision model the + method allows rounding a + coordinate to a "precise" value; that is, one whose precision + is known exactly. + + Coordinates are assumed to be precise in geometries. + That is, the coordinates are assumed to be rounded to the + precision model given for the geometry. + + All internal operations + assume that coordinates are rounded to the precision model. + Constructive methods (such as bool operations) always round computed + coordinates to the appropriate precision model.
+ Three types of precision model are supported: + + FloatingRepresents full double precision floating point. + This is the default precision model used in NTS + FloatingSingleRepresents single precision floating point + FixedRepresents a model with a fixed number of decimal places. + A Fixed Precision Model is specified by a scale factor. + The scale factor specifies the size of the grid which numbers are rounded to. + + Input coordinates are mapped to fixed coordinates according to the following + equations: + + jtsPt.X = Math.Round( inputPt.X * scale, MidPointRounding.AwayFromZero ) / scale ) + jtsPt.Y = Math.Round( inputPt.Y * scale, MidPointRounding.AwayFromZero ) / scale ) + + + For example, to specify 3 decimal places of precision, use a scale factor + of 1000. To specify -3 decimal places of precision (i.e. rounding to + the nearest 1000), use a scale factor of 0.001. + + It is also supported to specify a precise grid size + by providing it as a negative scale factor. + This allows setting a precise grid size rather than using a fractional scale, + which provides more accurate and robust rounding. + For example, to specify rounding to the nearest 1000 use a scale factor of -1000. + + Coordinates are represented internally as Java double-precision values. + .NET uses the IEEE-394 floating point standard, which + provides 53 bits of precision. (Thus the maximum precisely representable + integer is 9,007,199,254,740,992 - or almost 16 decimal digits of precision). +
+
+ + + Determines which of two s is the most precise + + A precision model + A precision model + The PrecisionModel which is most precise + + + + The maximum precise value representable in a double. Since IEE754 + double-precision numbers allow 53 bits of mantissa, the value is equal to + 2^53 - 1. This provides almost 16 decimal digits of precision. + + + + + The type of PrecisionModel this represents. + + + + + The scale factor which determines the number of decimal places in fixed precision. + + + + + If non-zero, the precise grid size specified. + In this case, the scale is also valid and is computed from the grid size. + If zero, the scale is used to compute the grid size where needed. + + + + + Gets a value indicating a precision model with double precision. + + A double precision model + + + + Gets a value indicating a precision model with single precision. + + A single precision model + + + + Gets a value indicating a precision model with a scale of 1. + + A fixed precision model + + + + Creates a PrecisionModel with a default precision + of Floating. + + + + + Creates a PrecisionModel that specifies + an explicit precision model type. + If the model type is Fixed the scale factor will default to 1. + + + The type of the precision model. + + + + + Creates a PrecisionModel that specifies Fixed precision. + Fixed-precision coordinates are represented as precise internal coordinates, + which are rounded to the grid defined by the scale factor. + + The provided scale may be negative, to specify an exact grid size. + The scale is then computed as the reciprocal. + + + Amount by which to multiply a coordinate, to obtain a precise coordinate. + Must be non-zero + + + + + Copy constructor to create a new PrecisionModel + from an existing one. + + + + + + Tests whether the precision model supports floating point. + + true if the precision model supports floating point. + + + + Returns the maximum number of significant digits provided by this + precision model. + Intended for use by routines which need to print out precise values. + + + The maximum number of decimal places provided by this precision model. + + + + + Returns the scale factor used to specify a fixed precision model. + + + The number of decimal places of precision is + equal to the base-10 logarithm of the scale factor. + Non-integral and negative scale factors are supported. + Negative scale factors indicate that the places + of precision is to the left of the decimal point. + + + The scale factor for the fixed precision model + + + + + Computes the grid size for a fixed precision model. + This is equal to the reciprocal of the scale factor. + If the grid size has been set explicity (via a negative scale factor) + it will be returned. + + The grid size at a fixed precision scale. + + + + Gets the type of this PrecisionModel. + + + + + + Rounds a numeric value to the PrecisionModel grid. + Symmetric Arithmetic Rounding is used, to provide + uniform rounding behaviour no matter where the number is + on the number line. + + + This method has no effect on NaN values + + + + + + Rounds a Coordinate to the PrecisionModel grid. + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + Compares this PrecisionModel object with the specified object for order. + A PrecisionModel is greater than another if it provides greater precision. + The comparison is based on the value returned by the + {getMaximumSignificantDigits) method. + This comparison is not strictly accurate when comparing floating precision models + to fixed models; however, it is correct when both models are either floating or fixed. + + + The PrecisionModel with which this PrecisionModel + is being compared. + + + A negative integer, zero, or a positive integer as this PrecisionModel + is less than, equal to, or greater than the specified PrecisionModel. + + + + + + + + + + + + + + + + + Floating precision corresponds to the standard + double-precision floating-point representation, which is + based on the IEEE-754 standard + + + + + Floating single precision corresponds to the standard + single-precision floating-point representation, which is + based on the IEEE-754 standard + + + + + Fixed Precision indicates that coordinates have a fixed number of decimal places. + The number of decimal places is determined by the log10 of the scale factor. + + + + + A base class containing the logic for computes the contains + and covers spatial relationship predicates + for a relative to all other classes. + Uses short-circuit tests and indexing to improve performance. + + + + Contains and covers are very similar, and differ only in how certain + cases along the boundary are handled. These cases require + full topological evaluation to handle, so all the code in + this class is common to both predicates. + + + It is not possible to short-circuit in all cases, in particular + in the case where line segments of the test geometry touches the polygon linework. + In this case full topology must be computed. + (However, if the test geometry consists of only points, this + can be evaluated in an optimized fashion. + + + Martin Davis + + + + This flag controls a difference between contains and covers. + For contains the value is true. + For covers the value is false. + + + + + Creates an instance of this operation. + + The PreparedPolygon to evaluate + + + + Evaluate the contains or covers relationship + for the given geometry. + + the test geometry + true if the test geometry is contained + + + + Evaluation optimized for Point geometries. + This provides about a 2x performance increase, and less memory usage. + + A Point or MultiPoint geometry + The value of the predicate being evaluated + + + + Tests whether a geometry consists of a single polygon with no holes. + + True if the geometry is a single polygon with no holes + + + + Computes the full topological predicate. + Used when short-circuit tests are not conclusive. + + The test geometry + true if this prepared polygon has the relationship with the test geometry + + + + A base class for subclasses. + + + Contains default implementations for methods, which simply delegate to the equivalent methods. + This class may be used as a "no-op" class for Geometry types which do not have a corresponding implementation. + + Martin Davis + + + + Gets the list of representative points for this geometry. + One vertex is included for every component of the geometry + (i.e. including one for every ring of polygonal geometries). + + Do not modify the returned list! + + + + + Tests whether any representative of the target geometry intersects the test geometry. + This is useful in A/A, A/L, A/P, L/P, and P/P cases. + + The test geometry + true if any component intersects the areal test geometry + + + + Determines whether a Geometry g interacts with this geometry by testing the geometry envelopes. + + A geometry + true if the envelopes intersect + + + + Determines whether the envelope of this geometry covers the Geometry g. + + A geometry + true if g is contained in this envelope + + + + Tests whether the base contains a given geometry. + + The Geometry to test + true if this Geometry contains the given Geometry + + Default implementation. + + + + Tests whether the base properly contains a given geometry. + + The ContainsProperly predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry's interior. + The DE-9IM Intersection Matrix for the two geometries matches >[T**FF*FF*] + + In other words, if the test geometry has any interaction with the boundary of the target + geometry the result of ContainsProperly is false. + This is different semantics to the predicate, + in which test geometries can intersect the target's boundary and still be contained. + + The advantage of using this predicate is that it can be computed + efficiently, since it avoids the need to compute the full topological relationship + of the input boundaries in cases where they intersect. + + An example use case is computing the intersections + of a set of geometries with a large polygonal geometry. + Since intersection is a fairly slow operation, it can be more efficient + to use to filter out test geometries which lie + wholly inside the area. In these cases the intersection is + known a priori to be simply the original test geometry. + + The geometry to test + true if this geometry properly contains the given geometry + + Default implementation. + + + + + Tests whether the base is covered by a given geometry. + + The geometry to test + true if this geometry is covered by the given geometry + + Default implementation. + + + + Tests whether the base covers a given geometry. + + The geometry to test + true if this geometry covers the given geometry + + Default implementation. + + + + Tests whether the base crosses a given geometry. + + The geometry to test + true if this geometry crosses the given geometry + + Default implementation. + + + + Tests whether the base is disjoint from given geometry. + + The geometry to test + true if this geometry is disjoint from the given geometry + + Standard implementation for all geometries. + + + + Tests whether the base intersects a given geometry. + + The geometry to test + true if this geometry intersects the given geometry + + Default implementation. + + + + Tests whether the base overlaps a given geometry. + + The geometry to test + true if this geometry overlaps the given geometry + + Default implementation. + + + + Tests whether the base touches a given geometry. + + The geometry to test + true if this geometry touches the given geometry + + Default implementation. + + + + Tests whether the base is within a given geometry. + + The geometry to test + true if this geometry is within the given geometry + + Default implementation. + + + + + + + An interface for classes which prepare s + in order to optimize the performance of repeated calls to specific geometric operations. + + + + A given implementation may provide optimized implementations + for only some of the specified methods, and delegate the remaining + methods to the original operations. + + + An implementation may also only optimize certain situations, and delegate others. + See the implementing classes for documentation about which methods and situations + they optimize. + + Subclasses are intended to be thread-safe, to allow IPreparedGeometry + to be used in a multi-threaded context + (which allows extracting maximum benefit from the prepared state). + + + Martin Davis + + + + Gets the original which has been prepared. + + + + + Tests whether the base contains a given geometry. + + The Geometry to test + true if this Geometry contains the given Geometry + + + + + Tests whether the base contains a given geometry. + + + + The ContainsProperly predicate has the following equivalent definitions: + + Every point of the other geometry is a point of this geometry's interior. + The DE-9IM Intersection Matrix for the two geometries matches >[T**FF*FF*] + + The advantage to using this predicate is that it can be computed + efficiently, with no need to compute topology at individual points. + + + An example use case for this predicate is computing the intersections + of a set of geometries with a large polygonal geometry. + Since intersection is a fairly slow operation, it can be more efficient + to use containsProperly to filter out test geometries which lie + wholly inside the area. In these cases the intersection + known a priori to be simply the original test geometry. + + + The geometry to test + true if this geometry properly contains the given geometry + + + + Tests whether the base is covered by a given geometry. + + The geometry to test + true if this geometry is covered by the given geometry + + + + + Tests whether the base covers a given geometry. + + The geometry to test + true if this geometry covers the given geometry + + + + + Tests whether the base crosses a given geometry. + + The geometry to test + true if this geometry crosses the given geometry + + + + + Tests whether the base is disjoint from given geometry. + + + This method supports s as input + + The geometry to test + true if this geometry is disjoint from the given geometry + + + + + Tests whether the base intersects a given geometry. + + + This method supports s as input + + The geometry to test + true if this geometry intersects the given geometry + + + + + Tests whether the base overlaps a given geometry. + + The geometry to test + true if this geometry overlaps the given geometry + + + + + Tests whether the base touches a given geometry. + + The geometry to test + true if this geometry touches the given geometry + + + + + Tests whether the base is within a given geometry. + + The geometry to test + true if this geometry is within the given geometry + + + + + A factory for creating s. It chooses an appropriate implementation of PreparedGeometry + based on the geometric type of the input geometry. + + In the future, the factory may accept hints that indicate + special optimizations which can be performed. + + Instances of this class are thread-safe. + + Martin Davis + + + + Creates a new appropriate for the argument . + + The geometry to prepare + + the prepared geometry + + + + + Creates a new appropriate for the argument . + + The geometry to prepare + + the prepared geometry + + + + + A prepared version for geometries. + Instances of this class are thread-safe. + + mbdavis + + + + Computes the intersects spatial relationship predicate + for a target relative to other classes. + + + Uses short-circuit tests and indexing to improve performance. + + Martin Davis + + + + Computes the intersects predicate between a + and a . + + The prepared linestring + A test geometry + true if the linestring intersects the geometry + + + + Creates an instance of this operation. + + The target PreparedLineString + + + + Tests whether this geometry intersects a given geometry. + + The test geometry + true if the test geometry intersects + + + + Tests whether any representative point of the test Geometry intersects + the target geometry. + + + Only handles test geometries which are Puntal (dimension 0) + + A Puntal geometry to test + true if any point of the argument intersects the prepared geometry + + + + A prepared version for geometries. + Instances of this class are thread-safe. + + Martin Davis + + + + Tests whether this point intersects a . + + + The optimization here is that computing topology for the test geometry + is avoided. This can be significant for large geometries. + + + + + A prepared version for geometries. + This class supports both s and s. + This class does not support MultiPolygons which are non-valid + (e.g. with overlapping elements). + + + Instances of this class are thread-safe and immutable. + + mbdavis + + + + Computes the contains spatial relationship predicate for a relative to all other classes. + Uses short-circuit tests and indexing to improve performance. + + + + It is not possible to short-circuit in all cases, in particular + in the case where the test geometry touches the polygon linework. + In this case full topology must be computed. + + + Martin Davis + + + + Computes the contains spatial relationship predicate between a and a . + + The prepared polygon + A test geometry + true if the polygon contains the geometry + + + + Creates an instance of this operation. + + the PreparedPolygon to evaluate + + + + Tests whether this PreparedPolygon contains a given geometry. + + The test geometry + true if the test geometry is contained + + + + Computes the full topological contains predicate.
+ Used when short-circuit tests are not conclusive. +
+ The test geometry + true if this prepared polygon contains the test geometry +
+ + + Computes the containsProperly spatial relationship predicate for s relative to all other {@link Geometry} classes.
+ Uses short-circuit tests and indexing to improve performance. +
+ + + A Geometry A containsProperly another Geometry B if + all points of B are contained in the Interior of A. + Equivalently, B is contained in A AND B does not intersect + the Boundary of A. + + + The advantage to using this predicate is that it can be computed + efficiently, with no need to compute topology at individual points. + In a situation with many geometries intersecting the boundary + of the target geometry, this can make a performance difference. + + + Martin Davis +
+ + Computes the containsProperly predicate between a and a . + + The prepared polygon + A test geometry + true if the polygon properly contains the geometry + + + + Creates an instance of this operation. + + The PreparedPolygon to evaluate + + + + Tests whether this PreparedPolygon containsProperly a given geometry. + + The test geometry + true if the polygon properly contains the geometry + + + + Computes the Covers spatial relationship predicate for a relative to all other classes. + + + Uses short-circuit tests and indexing to improve performance. + + It is not possible to short-circuit in all cases, in particular in the case where the test geometry touches the polygon linework. + In this case full topology must be computed. + + Martin Davis + + + + Computes the Covers spatial relationship predicate for a relative to all other classes. + + The prepared polygon + A test geometry + true if the polygon covers the geometry + + + + Creates an instance of this operation. + + The PreparedPolygon to evaluate + + + + Tests whether this PreparedPolygon covers a given geometry. + + The test geometry + true if the test geometry is covered + + + + Computes the full topological covers predicate. Used when short-circuit tests are not conclusive. + + The test geometry + true if this prepared polygon covers the test geometry + + + + Computes the intersects spatial relationship predicate + for s relative to all other classes. + + Uses short-circuit tests and indexing to improve performance. + Martin Davis + + + + Computes the intersects predicate between a + and a . + + The prepared polygon + A test geometry + true if the polygon intersects the geometry + + + + Creates an instance of this operation. + + The prepared polygon + + + + Tests whether this PreparedPolygon intersects a given geometry. + + The test geometry + true if the test geometry intersects + + + + A base class for predicate operations on s. + + mbdavis + + + + Creates an instance of this operation. + + the PreparedPolygon to evaluate + + + + Tests whether all components of the test Geometry are contained in the target geometry. + + Handles both linear and point components. + A geometry to test + + true if all components of the argument are contained in the target geometry + + + + + Tests whether all components of the test Geometry are contained in the interior of the target geometry. + + Handles both linear and point components. + A geometry to test + true if all components of the argument are contained in the target geometry interior + + + + Tests whether any component of the test Geometry intersects + the area of the target geometry. + Handles test geometries with both linear and point components. + + A geometry to test + true if any component of the argument intersects the prepared area geometry + + + + Tests whether any point of the test Geometry intersects the interior of the target geometry. + + Handles test geometries with both linear and point components. + A geometry to test + true if any point of the argument intersects the prepared area geometry + + + + Tests whether any point of the test Geometry intersects the interior of the target geometry. + + A geometry to test + true if any point of the argument intersects the prepared area geometry interior + + + + Tests whether any component of the test Geometry intersects the interior of the target geometry. + + Handles test geometries with both linear and point components. + A geometry to test + true if any component of the argument intersects the prepared area geometry interior + + + + Tests whether all points of the test Pointal geometry + are contained in the target geometry. + + A geometry to test + true if all points of the argument are contained in the target geometry + + + + Tests whether any component of the target geometry intersects the test geometry (which must be an areal geometry) + + The test geometry + The representative points of the target geometry + true if any component intersects the areal test geometry + + + + Quadrant values + + + The quadants are numbered as follows: + + + 1 - NW | 0 - NE
+ -------+-------
+ 2 - SW | 3 - SE +
+
+
+
+ + + Undefined + + + + + North-East + + + + + North-West + + + + + South-West + + + + + South-East + + + + + Creates a quadrant with t + + + + + + Creates a quadrant of a directed line segment (specified as x and y + displacements, which cannot both be 0). + + + + If the displacements are both 0 + + + + Returns the quadrant of a directed line segment from p0 to p1. + + + + if the points are equal + + + + + + + + + + + + + Returns true if the quadrants are 1 and 3, or 2 and 4. + + A quadrant + + + + Returns the right-hand quadrant of the halfplane defined by the two quadrants, + or -1 if the quadrants are opposite, or the quadrant if they are identical. + + + + + + + Returns whether this quadrant lies within the given halfplane (specified + by its right-hand quadrant). + + + + + + Returns true if the given quadrant is 0 or 1. + + + + + Equality operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are equal. + + + + Inequality operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are not equal. + + + + Greater than (>) operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are not equal. + + + + Less than (<) operator for quadrants + + Quadrant value on the left-hand-side + Quadrant value on the right-hand-side + true if quadrant value of and are not equal. + + + + Indicates an invalid or inconsistent topological situation encountered during processing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a planar triangle, and provides methods for calculating various + properties of triangles. + + + + + A corner point of the triangle + + + + + A corner point of the triangle + + + + + A corner point of the triangle + + + + + Tests whether a triangle is acute. A triangle is acute if all interior + angles are acute. This is a strict test - right triangles will return + false A triangle which is not acute is either right or obtuse. + + Note: this implementation is not robust for angles very close to 90 degrees. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + True if the triangle is acute. + + + + Tests whether a triangle is oriented counter-clockwise. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + true if the triangle orientation is counter-clockwise + + + + Tests whether a triangle intersects a point. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if the triangle intersects the point + + + + Computes the line which is the perpendicular bisector of the + + A point + Another point + The perpendicular bisector, as an HCoordinate line segment a-b. + + + Computes the circumcentre of a triangle. + + The circumcentre is the centre of the circumcircle, + the smallest circle which encloses the triangle. + It is also the common intersection point of the + perpendicular bisectors of the sides of the triangle, + and is the only point which has equal distance to all three + vertices of the triangle. + + The circumcentre does not necessarily lie within the triangle. For example, + the circumcentre of an obtuse isosceles triangle lies outside the triangle. + + This method uses an algorithm due to J.R.Shewchuk which uses normalization + to the origin to improve the accuracy of computation. (See Lecture Notes + on Geometric Robustness, Jonathan Richard Shewchuk, 1999). + + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The circumcentre of the triangle + + + + Computes the circumcentre of a triangle. The circumcentre is the centre of + the circumcircle, the smallest circle which encloses the triangle.It is + also the common intersection point of the perpendicular bisectors of the + sides of the triangle, and is the only point which has equal distance to + all three vertices of the triangle. + + The circumcentre does not necessarily lie within the triangle. For example, + the circumcentre of an obtuse isosceles triangle lies outside the triangle. + + This method uses extended-precision arithmetic to + provide more accurate results than + + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The circumcentre of the triangle + + + + Computes the determinant of a 2x2 matrix. Uses standard double-precision + arithmetic, so is susceptible to round-off error. + + the [0,0] entry of the matrix + the [0,1] entry of the matrix + the [1,0] entry of the matrix + the [1,1] entry of the matrix + The determinant + + + + Computes the incentre of a triangle. + + + The InCentre of a triangle is the point which is equidistant + from the sides of the triangle. + It is also the point at which the bisectors of the triangle's angles meet. + It is the centre of the triangle's InCircle, which is the unique circle + that is tangent to each of the triangle's three sides. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point which is the incentre of the triangle + + + Computes the centroid (centre of mass) of a triangle. + + This is also the point at which the triangle's three + medians intersect (a triangle median is the segment from a vertex of the triangle to the + midpoint of the opposite side). + The centroid divides each median in a ratio of 2:1. + The centroid always lies within the triangle. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The centroid of the triangle + + + + Compute the length of the perimeter of a triangle + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The length of the perimeter of the triangle + + + Computes the length of the longest side of a triangle + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The length of the longest side of the triangle + + + Computes the point at which the bisector of the angle ABC cuts the segment AC. + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The angle bisector cut point + + + + Computes the 2D area of a triangle. + The area value is always non-negative. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The area of the triangle + + + + + Computes the signed 2D area of a triangle. + + + + The area value is positive if the triangle is oriented CW, + and negative if it is oriented CCW. + + + The signed area value can be used to determine point orientation, but + the implementation in this method is susceptible to round-off errors. + Use for robust orientation + calculation. + + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The area of the triangle + + + + + + Computes the 3D area of a triangle. + The value computed is always non-negative. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The 3D area of the triangle + + + + Computes the Z-value (elevation) of an XY point + on a three-dimensional plane defined by a triangle + whose vertices have Z-values. + The defining triangle must not be degenerate + (in other words, the triangle must enclose a + non-zero area), + and must not be parallel to the Z-axis. + + This method can be used to interpolate + the Z-value of a point inside a triangle + (for example, of a TIN facet with elevations on the vertices). + + The point to compute the Z-value of + A vertex of a triangle, with a Z ordinate + A vertex of a triangle, with a Z ordinate + A vertex of a triangle, with a Z ordinate + The computed Z-value (elevation) of the point + + + + Creates a new triangle with the given vertices. + + A vertex + A vertex + A vertex + + + + Computes the InCentre of this triangle + + The InCentre of a triangle is the point which is equidistant + from the sides of the triangle. + This is also the point at which the bisectors of the angles meet. + It is the centre of the triangle's InCircle, + which is the unique circle that is tangent to each of the triangle's three sides. + + + The point which is the InCentre of the triangle. + + + + + Tests whether this triangle is acute. A triangle is acute if all interior + angles are acute. This is a strict test - right triangles will return + false A triangle which is not acute is either right or obtuse. + + Note: this implementation is not robust for angles very close to 90 + degrees. + + true if this triangle is acute + + + + Tests whether this triangle is oriented counter-clockwise. + + true if the triangle orientation is counter-clockwise + + + + Computes the circumcentre of this triangle. The circumcentre is the centre + of the circumcircle, the smallest circle which encloses the triangle. It is + also the common intersection point of the perpendicular bisectors of the + sides of the triangle, and is the only point which has equal distance to + all three vertices of the triangle. + + The circumcentre does not necessarily lie within the triangle. + + This method uses an algorithm due to J.R.Shewchuk which uses normalization + to the origin to improve the accuracy of computation. (See Lecture Notes + on Geometric Robustness, Jonathan Richard Shewchuk, 1999). + + The circumcentre of this triangle + + + + Computes the centroid (centre of mass) of this triangle. This is also the + point at which the triangle's three medians intersect (a triangle median is + the segment from a vertex of the triangle to the midpoint of the opposite + side). The centroid divides each median in a ratio of 2:1. + + The centroid always lies within the triangle. + + The centroid of this triangle + + + + Computes the length of the perimeter of this triangle. + + The length of the perimeter + + + + Computes the length of the longest side of this triangle + + The length of the longest side of this triangle + + + + Computes the 2D area of this triangle. The area value is always + non-negative. + + The area of this triangle + + + + + Computes the signed 2D area of this triangle. The area value is positive if + the triangle is oriented CW, and negative if it is oriented CCW. + + The signed area value can be used to determine point orientation, but the + implementation in this method is susceptible to round-off errors. Use + + for robust orientation calculation. + + The signed 2D area of this triangle + + + + + Computes the 3D area of this triangle. The value computed is always + non-negative. + + The 3D area of this triangle + + + + Computes the Z-value (elevation) of an XY point on a three-dimensional + plane defined by this triangle (whose vertices must have Z-values). This + triangle must not be degenerate (in other words, the triangle must enclose + a non-zero area), and must not be parallel to the Z-axis. + + This method can be used to interpolate the Z-value of a point inside this + triangle (for example, of a TIN facet with elevations on the vertices). + + The point to compute the Z-value of + The computed Z-value (elevation) of the point + + + + Represents an affine transformation on the 2D Cartesian plane. + + + + It can be used to transform a or . + An affine transformation is a mapping of the 2D plane into itself + via a series of transformations of the following basic types: +
    +
  • reflection (through a line)
  • +
  • rotation (around the origin)
  • +
  • scaling (relative to the origin)
  • +
  • shearing (in both the X and Y directions)
  • +
  • translation
  • +
+
+ + In general, affine transformations preserve straightness and parallel lines, + but do not preserve distance or shape. + + + An affine transformation can be represented by a 3x3 + matrix in the following form: +
+ T = | m00 m01 m02 |
+ | m10 m11 m12 |
+ | 0 0 1 | +
+ A coordinate P = (x, y) can be transformed to a new coordinate P' = (x', y') + by representing it as a 3x1 matrix and using matrix multiplication to compute: +
+ | x' | = T x | x |
+ | y' | | y |
+ | 1 | | 1 | +
+
+

Transformation Composition

+ + Affine transformations can be composed using the method. + Composition is computed via multiplication of the + transformation matrices, and is defined as: +
+            A.compose(B) = TB x TA
+            
+
+ + This produces a transformation whose effect is that of A followed by B. + The methods , , + , , and + have the effect of composing a transformation of that type with + the transformation they are invoked on. + The composition of transformations is in general not commutative. + +

Transformation Inversion

+ + Affine transformations may be invertible or non-invertible. + If a transformation is invertible, then there exists + an inverse transformation which when composed produces + the identity transformation. + The method + computes the inverse of a transformation, if one exists. + + + @author Martin Davis + +
+
+ + + Creates a transformation for a reflection about the + line (x0,y0) - (x1,y1). + + the x-ordinate of a point on the reflection line + the y-ordinate of a point on the reflection line + the x-ordinate of a another point on the reflection line + the y-ordinate of a another point on the reflection line + a transformation for the reflection + + + + Creates a transformation for a reflection about the + line (0,0) - (x,y). + + the x-ordinate of a point on the reflection line + the y-ordinate of a point on the reflection line + a transformation for the reflection + + + + Creates a transformation for a rotation + about the origin + by an angle theta. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the rotation angle, in radians + a transformation for the rotation + + + + Creates a transformation for a rotation + by an angle theta, + specified by the sine and cosine of the angle. + + + This allows providing exact values for sin(theta) and cos(theta) + for the common case of rotations of multiples of quarter-circles. + + the sine of the rotation angle + the cosine of the rotation angle + a transformation for the rotation + + + + Creates a transformation for a rotation + about the point (x,y) by an angle theta. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the rotation angle, in radians + the x-ordinate of the rotation point + the y-ordinate of the rotation point + a transformation for the rotation + + + + Creates a transformation for a rotation + about the point (x,y) by an angle theta, + specified by the sine and cosine of the angle. + + + This allows providing exact values for sin(theta) and cos(theta) + for the common case of rotations of multiples of quarter-circles. + + the sine of the rotation angle + the cosine of the rotation angle + the x-ordinate of the rotation point + the y-ordinate of the rotation point + a transformation for the rotation + + + + Creates a transformation for a scaling relative to the origin. + + the value to scale by in the x direction + the value to scale by in the y direction + a transformation for the scaling + + + + Creates a transformation for a scaling relative to the point (x,y). + + The value to scale by in the x direction + The value to scale by in the y direction + The x-ordinate of the point to scale around + The y-ordinate of the point to scale around + A transformation for the scaling + + + + Creates a transformation for a shear. + + the value to shear by in the x direction + the value to shear by in the y direction + a transformation for the shear + + + + Creates a transformation for a translation. + + the value to translate by in the x direction + the value to translate by in the y direction + a transformation for the translation + + + + Constructs a new identity transformation + + + + + Constructs a new transformation whose + matrix has the specified values. + + an array containing the 6 values { m00, m01, m02, m10, m11, m12 } + if matrix is null + if matrix is too small + + + + Constructs a new transformation whose + matrix has the specified values. + + the entry for the [0, 0] element in the transformation matrix + the entry for the [0, 1] element in the transformation matrix + the entry for the [0, 2] element in the transformation matrix + the entry for the [1, 0] element in the transformation matrix + the entry for the [1, 1] element in the transformation matrix + the entry for the [1, 2] element in the transformation matrix + + + + Constructs a transformation which is + a copy of the given one. + + the transformation to copy + + + + Constructs a transformation + which maps the given source + points into the given destination points. + + source point 0 + source point 1 + source point 2 + the mapped point for source point 0 + the mapped point for source point 1 + the mapped point for source point 2 + + + + Sets this transformation to be the identity transformation. + + + The identity transformation has the matrix: +
+ | 1 0 0 |
+ | 0 1 0 |
+ | 0 0 1 | +
+
+ this transformation, with an updated matrix +
+ + + Sets this transformation's matrix to have the given values. + + the entry for the [0, 0] element in the transformation matrix + the entry for the [0, 1] element in the transformation matrix + the entry for the [0, 2] element in the transformation matrix + the entry for the [1, 0] element in the transformation matrix + the entry for the [1, 1] element in the transformation matrix + the entry for the [1, 2] element in the transformation matrix + this transformation, with an updated matrix + + + + Sets this transformation to be a copy of the given one + + a transformation to copy + this transformation, with an updated matrix + + + + Gets an array containing the entries + of the transformation matrix. + + + Only the 6 non-trivial entries are returned, + in the sequence: +
+            m00, m01, m02, m10, m11, m12
+            
+
+ an array of length 6 +
+ + + Computes the determinant of the transformation matrix. + + + + The determinant is computed as: +
+ | m00 m01 m02 |
+ | m10 m11 m12 | = m00 * m11 - m01 * m10
+ | 0 0 1 | +
+
+ + If the determinant is zero, + the transform is singular (not invertible), + and operations which attempt to compute + an inverse will throw a . + +
+ the determinant of the transformation + + + The determinant of the transformation + +
+ + + Computes the inverse of this transformation, if one + exists. + + + + The inverse is the transformation which when + composed with this one produces the identity + transformation. + A transformation has an inverse if and only if it + is not singular (i.e. its + determinant is non-zero). + Geometrically, an transformation is non-invertible + if it maps the plane to a line or a point. + If no inverse exists this method + will throw a . + + + The matrix of the inverse is equal to the + inverse of the matrix for the transformation. + It is computed as follows: +
+ 1 + inverse(A) = --- x adjoint(A) + det + + + = 1 | m11 -m01 m01*m12-m02*m11 | + --- x | -m10 m00 -m00*m12+m10*m02 | + det | 0 0 m00*m11-m10*m01 | + + + + = | m11/det -m01/det m01*m12-m02*m11/det | + | -m10/det m00/det -m00*m12+m10*m02/det | + | 0 0 1 | +
+
+
+ A new inverse transformation + + +
+ + + Explicitly computes the math for a reflection. May not work. + + The x-ordinate of one point on the reflection line + The y-ordinate of one point on the reflection line + The x-ordinate of another point on the reflection line + The y-ordinate of another point on the reflection line + This transformation with an updated matrix + + + + Sets this transformation to be a reflection about the line defined by a line (x0,y0) - (x1,y1). + + The x-ordinate of one point on the reflection line + The y-ordinate of one point on the reflection line + The x-ordinate of another point on the reflection line + The y-ordinate of another point on the reflection line + This transformation with an updated matrix + + + + Sets this transformation to be a reflection + about the line defined by vector (x,y). + + + The transformation for a reflection + is computed by: +
+ d = sqrt(x2 + y2) + sin = x / d; + cos = x / d; + Tref = Trot(sin, cos) x Tscale(1, -1) x Trot(-sin, cos) +
+
+ the x-component of the reflection line vector + the y-component of the reflection line vector + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation around the orign. + + + A positive rotation angle corresponds + to a counter-clockwise rotation. + The transformation matrix for a rotation + by an angle theta + has the value: +
+            |  cos(theta)  -sin(theta)   0 |
+            |  sin(theta)   cos(theta)   0 |
+            |           0            0   1 |
+            
+
+ the rotation angle, in radians + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation around the origin + by specifying the sin and cos of the rotation angle directly. + + + The transformation matrix for the rotation + has the value: +
+            |  cosTheta  -sinTheta   0 |
+            |  sinTheta   cosTheta   0 |
+            |         0          0   1 |
+            
+
+ the sine of the rotation angle + the cosine of the rotation angle + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation + around a given point (x,y). + + + A positive rotation angle corresponds + to a counter-clockwise rotation. + The transformation matrix for a rotation + by an angle + has the value: +
+            |  cosTheta  -sinTheta   x-x*cos+y*sin |
+            |  sinTheta   cosTheta   y-x*sin-y*cos |
+            |           0            0   1 |
+            
+
+ the rotation angle, in radians + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix +
+ + + Sets this transformation to be a rotation + around a given point (x,y) + by specifying the sin and cos of the rotation angle directly. + + + The transformation matrix for the rotation + has the value: +
+            |  cosTheta  -sinTheta   x-x*cos+y*sin |
+            |  sinTheta   cosTheta   y-x*sin-y*cos |
+            |         0          0         1       |
+            
+
+ the sine of the rotation angle + the cosine of the rotation angle + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix +
+ + + Sets this transformation to be a scaling. + + + The transformation matrix for a scale + has the value: +
+            |  xScale      0  dx |
+            |  0      yScale  dy |
+            |  0           0   1 |
+            
+
+ the amount to scale x-ordinates by + the amount to scale y-ordinates by + this transformation, with an updated matrix +
+ + + Sets this transformation to be a shear. + + + The transformation matrix for a shear + has the value: +
+            |  1      xShear  0 |
+            |  yShear      1  0 |
+            |  0           0  1 |
+            
+ Note that a shear of (1, 1) is not + equal to shear(1, 0) composed with shear(0, 1). + Instead, shear(1, 1) corresponds to a mapping onto the + line x = y. +
+ the x component to shear by + the y component to shear by + this transformation, with an updated matrix +
+ + + Sets this transformation to be a translation. + + + For a translation by the vector (x, y) + the transformation matrix has the value: +
+            |  1  0  dx |
+            |  1  0  dy |
+            |  0  0   1 |
+            
+
+ the x component to translate by + the y component to translate by + this transformation, with an updated matrix +
+ + + Updates the value of this transformation + to that of a reflection transformation composed + with the current value. + + the x-ordinate of a point on the line to reflect around + the y-ordinate of a point on the line to reflect around + the x-ordinate of a point on the line to reflect around + the y-ordinate of a point on the line to reflect around + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a reflection transformation composed + with the current value. + + the x-ordinate of the line to reflect around + the y-ordinate of the line to reflect around + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation transformation composed + with the current value. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the angle to rotate by in radians + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation around the origin composed + with the current value, + with the sin and cos of the rotation angle specified directly. + + the sine of the angle to rotate by + the cosine of the angle to rotate by + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation around a given point composed + with the current value. + + + Positive angles correspond to a rotation + in the counter-clockwise direction. + + the angle to rotate by, in radians + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a rotation around a given point composed + with the current value, + with the sin and cos of the rotation angle specified directly. + + the sine of the angle to rotate by + the cosine of the angle to rotate by + the x-ordinate of the rotation point + the y-ordinate of the rotation point + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a scale transformation composed + with the current value. + + the value to scale by in the x direction + the value to scale by in the y direction + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a shear transformation composed + with the current value. + + the value to shear by in the x direction + the value to shear by in the y direction + this transformation, with an updated matrix + + + + Updates the value of this transformation + to that of a translation transformation composed + with the current value. + + the value to translate by in the x direction + the value to translate by in the y direction + this transformation, with an updated matrix + + + + Updates this transformation to be + the composition of this transformation with the given . + + + This produces a transformation whose effect + is equal to applying this transformation + followed by the argument transformation. + Mathematically, +
+            A.compose(B) = TB x TA
+            
+
+ an affine transformation + this transformation, with an updated matrix +
+ + + Updates this transformation to be the composition + of a given with this transformation. + + + This produces a transformation whose effect + is equal to applying the argument transformation + followed by this transformation. + Mathematically, +
+            A.composeBefore(B) = TA x TB
+            
+
+ an affine transformation + this transformation, with an updated matrix +
+ + + Applies this transformation to the coordinate + and places the results in the coordinate + (which may be the same as the source). + + the coordinate to transform + the coordinate to accept the results + the dest coordinate + + + + + Creates a new which is the result of this transformation applied to the input Geometry. + + A Geometry + The transformed Geometry + + + + Applies this transformation to the i'th coordinate + in the given CoordinateSequence. + + a CoordinateSequence + the index of the coordinate to transform + + + + Transforms the i'th coordinate in the input sequence + + A CoordinateSequence + The index of the coordinate to transform + + + + Reports that this filter should continue to be executed until + all coordinates have been transformed. + + false + + + Tests if this transformation is the identity transformation. + + + + Tests if an object is an AffineTransformation and has the same matrix as this transformation. + + An object to test + true if the given object is equal to this object + + + + + + + Gets a text representation of this transformation. + The string is of the form: + + AffineTransformation[[m00, m01, m02], [m10, m11, m12]] + + + A string representing this transformation + + + + Clones this transformation + + A copy of this transformation + + + + Builds an defined by a set of control vectors. + + + + A control vector consists of a source point and a destination point, + which is the image of the source point under the desired transformation. + + + A transformation is well-defined + by a set of three control vectors + if and only if the source points are not collinear. + (In particular, the degenerate situation + where two or more source points are identical will not produce a well-defined transformation). + A well-defined transformation exists and is unique. + If the control vectors are not well-defined, the system of equations + defining the transformation matrix entries is not solvable, + and no transformation can be determined. + + No such restriction applies to the destination points. + However, if the destination points are collinear or non-unique, + a non-invertible transformations will be generated. + + + This technique of recovering a transformation + from its effect on known points is used in the Bilinear Interpolated Triangulation + algorithm for warping planar surfaces. + + + Martin Davis + + + + Constructs a new builder for the transformation defined by the given set of control point mappings. + + A control point + A control point + A control point + The image of under the required transformation + The image of under the required transformation + The image of under the required transformation + + + + Computes the + determined by the control point mappings, + or null if the control vectors do not determine a well-defined transformation. + + + An affine transformation, or if the control vectors do not + determine a well-defined transformation. + + + + + Computes the transformation matrix by + solving the two systems of linear equations + defined by the control point mappings, + if this is possible. + + True if the transformation matrix is solvable + + + + Solves the transformation matrix system of linear equations + for the given right-hand side vector. + + The vector for the right-hand side of the system + The solution vector, or if no solution could be determined. + + + + Supports creating s defined by various kinds of inputs and transformation mapping rules. + + Martin Davis + + + + Creates a transformation from a set of three control vectors. A control + vector consists of a source point and a destination point, which is the + image of the source point under the desired transformation. Three control + vectors allows defining a fully general affine transformation. + + + + + + + + The computed transformation + + + + Creates an AffineTransformation defined by a pair of control vectors. A + control vector consists of a source point and a destination point, which is + the image of the source point under the desired transformation. The + computed transformation is a combination of one or more of a uniform scale, + a rotation, and a translation (i.e. there is no shear component and no + reflection) + + + + + + The computed transformation + null if the control vectors do not determine a well-defined transformation + + + + Creates an AffineTransformation defined by a single control vector. A + control vector consists of a source point and a destination point, which is + the image of the source point under the desired transformation. This + produces a translation. + + The start point of the control vector + The end point of the control vector + The computed transformation + + + + Creates an AffineTransformation defined by a set of control vectors. + Between one and three vectors must be supplied. + + The source points of the vectors + The destination points of the vectors + The computed transformation + if the control vector arrays are too short, long or of different lengths + + + + Creates an AffineTransformation defined by a mapping between two baselines. + The computed transformation consists of: + + a translation from the start point of the source baseline to the start point of the destination baseline, + a rotation through the angle between the baselines about the destination start point, + and a scaling equal to the ratio of the baseline lengths. + + If the source baseline has zero length, an identity transformation is returned. + + The start point of the source baseline + The end point of the source baseline + The start point of the destination baseline + The end point of the destination baseline + + + + + Extracts a representative + from each connected component of a . + + 1.9 + + + + Extracts a representative + from each connected component in a geometry. + + If more than one geometry is to be processed, it is more + efficient to create a single + instance and pass it to each geometry. + + The Geometry from which to extract + A list of representative Coordinates + + + + Constructs a LineExtracterFilter with a list in which to store LineStrings found. + + + + + Utility to combine just the s of a list of geometries. + + + + + Gets the smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + The list of input geometries. + + + The smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + + + Gets the smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + The list of input geometries. + + + The smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + + + Initializes a new instance of the class. + + + The instances to combine. + + + + + Initializes a new instance of the class. + + + The instances to combine. + + + + + Gets the smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + The smallest within which all input geometries fit, or a + null envelope if no non-empty geometries were found in + the input list. + + + + + Maps the members of a + into another GeometryCollection via a defined + mapping function. + + Martin Davis + + + + + + + + + + + + Creates an instance of this class + + + + + + + + + + + + + Combines s to produce a of the most appropriate type. + + + Input geometries which are already collections will have their elements extracted first. + No validation of the result geometry is performed. + (The only case where invalidity is possible is where geometries are combined and result in a self-intersection). + + mbdavis + + + + Combines a collection of geometries. + The geometries to combine + The combined geometry + + + + Combines two geometries. + + A geometry to combine + A geometry to combine + The combined geometry + + + + Combines three geometries. + + A geometry to combine + A geometry to combine + A geometry to combine + The combined geometry + + + + Creates a list from two items + + + + A list from two geometries + + + + Creates a list from three items + + + + + A list from three geometries + + + + Value indicating whether empty geometries should be skipped + + + + + Creates a new combiner for a collection of geometries + + The geometries to combine + + + + Extracts the GeometryFactory used by the geometries in a collection + + + a GeometryFactory + + + + Computes the combination of the input geometries to produce the most appropriate or + + A Geometry which is the combination of the inputs + + + + + A class which supports creating new s + which are modifications of existing ones, + maintaining the same type structure. + + + Geometry objects are intended to be treated as immutable. + This class allows you to "modifies" a Geometrys + by traversing them, applying a user-defined + , or + and creating a new Geometrys with the same structure but + (possibly) modified components. + + Examples of the kinds of modifications which can be made are: + + + The values of the coordinates may be changed. + The editor does not check whether changing coordinate values makes the result Geometry invalid + + + The coordinate lists may be changed (e.g. by adding, deleting or modifying coordinates). + The modified coordinate lists must be consistent with their original parent component + (e.g. a LinearRing must always have at least 4 coordinates, and the first and last + coordinate must be equal). + + + Components of the original point may be deleted + (e.g. holes may be removed from a Polygon, or LineStrings removed from a MultiLineString). + Deletions will be propagated up the component tree appropriately. + + + + All changes must be consistent with the original Geometry's structure + (e.g. a Polygon cannot be collapsed into a LineString). + If changing the structure is required, use a . + + + This class supports creating an edited Geometry + using a different via the + constructor. + Examples of situations where this is required is if the geometry is + transformed to a new SRID and/or a new PrecisionModel. + + Usage notes + + The resulting Geometry is not checked for validity. + If validity needs to be enforced, the new Geometry's + method should be called. + By default the UserData of the input geometry is not copied to the result. + + + + + + + + + The factory used to create the modified Geometry. + + + If null the GeometryFactory of the input is used. + + + + + Creates a new GeometryEditor object which will create + edited with the same as the input Geometry. + + + + + Creates a new GeometryEditor object which will create + edited s with the given . + + The GeometryFactory to create the edited Geometry with. + + + + Gets or sets a value indicating if the User Data is copied to the edit result. + If so, only the object reference is copied. + + + + + Edit the input Geometry with the given edit operation. + Clients can create subclasses of GeometryEditorOperation or + CoordinateOperation to perform required modifications. + + The Geometry to edit. + The edit operation to carry out. + A new Geometry which is the result of the editing (which may be empty). + + + + A interface which specifies an edit operation for Geometries. + + + + + Edits a Geometry by returning a new Geometry with a modification. + The returned Geometry may be the input geometry itself. + It may be null if the geometry is to be deleted. + + The Geometry to modify. + + The factory with which to construct the modified Geometry + (may be different to the factory of the input point). + + A new Geometry which is a modification of the input Geometry. + null if the Geometry is to be deleted completely + + + + A GeometryEditorOperation which does not modify + the input geometry. + This can be used for simple changes of + (including PrecisionModel and SRID). + + mbdavis + + + + A GeometryEditorOperation which edits the coordinate list of a Geometry. + Operates on Geometry subclasses which contains a single coordinate list. + + + + + + + + + + + + + Edits the array of Coordinates from a Geometry. + + The coordinate array to operate on. + The point containing the coordinate list. + An edited coordinate array (which may be the same as the input). + + + + A which edits the + of a . + + Operates on Geometry subclasses which contains a single coordinate list. + + + + An edited coordinate sequence (which may be the same as the input) + + + + Extracts the components of a given type from a . + + + + + Extracts the T components from an and adds them to the provided . + + the geometry from which to extract + the list to add the extracted elements to + The geometry type to extract + + + + Extracts the T elements from a single and returns them in a . + + the geometry from which to extract + + + + Extracts the components of geometryType from a + + The geometry from which to extract + Geometry type to extract (null or all white-space means all types) + + + + Extracts the components of geometryType from a + and adds them to the provided + + The geometry from which to extract + Geometry type to extract (null or all white-space means all types) + The list to add the extracted elements to + + + + Extracts the components of type T from a . + + + + + Constructs a filter with a list in which to store the elements found. + + Geometry type to extract (null means all types) + The list to extract into + + + + Y + + + + + + + + + + + Extracts the components of type T from a . + + + + + Constructs a filter with a list in which to store the elements found. + + The list to extract into + + + + Fixes a geometry to be a valid geometry, while preserving as much as + possible of the shape and location of the input. + Validity is determined according to . + + Input geometries are always processed, so even valid inputs may + have some minor alterations.The output is always a new geometry object. +

Semantic Rules

+ + Vertices with non-finite X or Y ordinates are removed (as per ) + Repeated points are reduced to a single point + Empty atomic geometries are valid and are returned unchanged + Empty elements are removed from collections + Point: keep valid coordinate, or EMPTY + LineString: coordinates are fixed + LinearRing: coordinates are feixed, keep valid ring or else convert into LineString + Polygon: transform into a valid polygon, + preserving as much of the extent and vertices as possible. + + Rings are fixed to ensure they are valid + Holes intersection the shell are subtracted from the shell + Holes outside the shell are converted into polygons + + MultiPolygon: each polygon is fixed, + then result made non - overlapping (via union) + GeometryCollection: each element is fixed + Collapsed lines and polygons are handled as follows, + depending on the keepCollapsed setting: + + false: (default) collapses are converted to empty geometries + (and removed if they are elements of collections) + true: collapses are converted to a valid geometry of lower dimension + + +
+ Martin Davis + +
+ + + Fixes a geometry to be valid. + + The geometry to be fixed + The valid fixed geometry + + + + Fixes a geometry to be valid, allowing to set a flag controlling how + single item results from fixed MULTI geometries should be + returned. + + The geometry to be fixed + A flag indicating if MULTI geometries should not + be converted to single instance types if they consist of only one item. + The valid fixed geometry + + + Creates a new instance to fix a given geometry + The geometry to be fixed + + + + Gets or sets a value indicating whether collapsed + geometries are converted to empty, + (which will be removed from collections), + or to a valid geometry of lower dimension. + The default is to convert collapses to empty geometries (false). + + + + + Gets or sets a value indicating whether collapsed + geometries are converted to empty, + (which will be removed from collections), + or to a valid geometry of lower dimension. + The default is to convert collapses to empty geometries (false). + + + + + Gets the fixed geometry. + + The fixed geometry + + + + Returns a clean copy of the input coordinate array. + + Coordinates to clean + An array of clean coordinates + + + Subtracts a list of polygonal geometries from a polygonal geometry. + polygonal geometry for shell + polygonal geometries for holes + The result geometry + + + + Unions a list of polygonal geometries. + Optimizes case of zero or one input geometries. + Requires that the inputs are net new objects. + + The polygonal geometries to union + The union of the inputs + + + + Methods to map various collections + of s + via defined mapping functions. + + Martin Davis + + + + Maps the members of a + (which may be atomic or composite) + into another Geometry of most specific type. + null results are skipped. + In the case of hierarchical s, + only the first level of members are mapped. + + The input atomic or composite geometry + The mapping operation delegate + A result collection or geometry of most specific type + + + + Maps the members of a + (which may be atomic or composite) + into another Geometry of most specific type. + null results are skipped. + In the case of hierarchical s, + only the first level of members are mapped. + + The input atomic or composite geometry + The mapping operation + A result collection or geometry of most specific type + + + + Maps the atomic elements of a + (which may be atomic or composite) + using a mapping operation + into an atomic Geometry or a flat collection + of the most specific type. + null and empty values returned from the mapping operation + are discarded. + + The geometry to map + The dimension of empy geometry to create + The mapping operation + The mapped result + + + + An interface for geometry functions used for mapping. + + Martin Davis + + + + Computes a new geometry value. + + The input geometry + A result geometry + + + + Standard implementation of a geometry mapping + + + + + Creates an instance of this class using the provided mapping operation function + + A mapping operation function + + + + Computes a new geometry value. + + The input geometry + A result geometry + + + + A framework for processes which transform an input Geometry into + an output , possibly changing its structure and type(s). + + + + This class is a framework for implementing subclasses + which perform transformations on + various different Geometry subclasses. + + + It provides an easy way of applying specific transformations + to given point types, while allowing unhandled types to be simply copied. + Also, the framework handles ensuring that if subcomponents change type + the parent geometries types change appropriately to maintain valid structure. + Subclasses will override whichever TransformX methods + they need to to handle particular Geometry types. + + + A typically usage would be a transformation that may transform Polygons into + Polygons, LineStrings or Points, depending on the geometry of the input + (For instance, a simplification operation). + This class would likely need to override the + method to ensure that if input Polygons change type the result is a GeometryCollection, + not a MultiPolygon. + + The default behaviour of this class is simply to recursively transform + each Geometry component into an identical object by deep copying down + to the level of, but not including, coordinates. + + + Note that all TransformXXX methods may return null, + to avoid creating empty point objects. This will be handled correctly + by the transformer. TransformXXX methods should always return valid + geometry - if they cannot do this they should return null + (for instance, it may not be possible for a transformLineString implementation + to return at least two points - in this case, it should return null). + The method itself will always + return a non-null Geometry object (but this may be empty). + > + + + + The geometry factory + + + + + true if empty geometries should not be included in the result. + + + + + true if a homogenous collection result + from a GeometryCollection should still + be a general GeometryCollection. + + + + + true if the type of the input should be preserved. + + + + + Makes the input geometry available + + + + + + + + + + + + Convenience method which provides standard way of + creating a CoordinateSequence. + + The coordinate array to copy. + A coordinate sequence for the array. + + + + Convenience method which provides a standard way of copying s. + + The sequence to copy. + A deep copy of the sequence. + + + + Transforms a . + This method should always return a valid coordinate list for + the desired result type. (E.g. a coordinate list for a LineString + must have 0 or at least 2 points). + If this is not possible, return an empty sequence - + this will be pruned out. + + The coordinates to transform + The parent geometry + The transformed coordinates + + + + Transforms a geometry. + + The Point to transform + The parent geometry + A Point + + + + Transforms a geometry. + + The MultiPoint to transform + The parent geometry + A MultiPoint + + + + Transforms a . + + The transformation of a LinearRing may result in a coordinate sequence + which does not form a structurally valid ring (i.e. a degenerate ring of 3 or fewer points). + In this case a LineString is returned. + Subclasses may wish to override this method and check for this situation + (e.g.a subclass may choose to eliminate degenerate linear rings) + + The LinearRing to transform + The parent geometry + + A LinearRing if the transformation resulted in a structurally valid ring, otherwise, + if the transformation caused the LinearRing to collapse to 3 or fewer points, a LineString + + + + + Transforms a geometry. + + The LineString to transform + The parent geometry + A LineString + + + + Transforms a geometry. + + The MultiLineString to transform + The parent geometry + A MultiLineString + + + + Transforms a geometry. + + The Polygon to transform + The parent geometry + A Polygon + + + + Transforms a geometry. + + The MultiPolygon to transform + The parent geometry + A MultiPolygon + + + + Transforms a geometry. + + The GeometryCollection to transform + The parent geometry + A GeometryCollection + + + + Extracts all the 1-dimensional () components from a . + For polygonal geometries, this will extract all the component s. + If desired, s can be forced to be returned as s. + + + + + Extracts the linear components from a + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a single + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a single + and adds them to the provided . + + The geometry from which to extract linear components + The Collection to add the extracted linear components to + + The Collection of linear components (LineStrings or LinearRings) + + + + Extracts the linear components from a single point. + If more than one point is to be processed, it is more + efficient to create a single LineExtracterFilter instance + and pass it to multiple geometries. + + The point from which to extract linear components. + The list of linear components. + + + + Extracts the linear components from a single geometry. + If more than one geometry is to be processed, it is more + efficient to create a single instance + and pass it to multiple geometries. + + The geometry from which to extract linear components + true if s should be converted to s + The list of linear components + + + + Extracts the linear components from a single + and returns them as either a or . + + The geometry from which to extract + A linear geometry + + + + Extracts the linear components from a single + and returns them as either a or . + + The geometry from which to extract + true if s should be converted to s + A linear geometry + + + + Constructs a LineExtracterFilter with a list in which to store LineStrings found. + + + + + + Constructs a LineExtracterFilter with a list in which to store LineStrings found. + + + + + + + + + + + + + + + + + + Extracts all the elements from a . + + + + + + Extracts the elements from a single + and adds them to the. + + The geometry from which to extract + The list to add the extracted elements to + The list argument + + + + Extracts the elements from a single + and returns them in a . + + The geometry from which to extract + A list containing the linear elements + + + + Extracts the elements from a single + and returns them as either a or . + + The geometry from which to extract + A linear geometry + + + + Constructs a filter with a list in which to store the elements found. + + + + + Implements some 2D matrix operations (in particular, solving systems of linear equations). + + Martin Davis + + + + Solves a system of equations using Gaussian Elimination.
+ In order to avoid overhead the algorithm runs in-place + on A - if A should not be modified the client must supply a copy. +
+ A an nxn matrix in row/column order )modified by this method) + A vector of length n + if the matrix is the wrong size + + + A vector containing the solution (if any) + null if the system has no or no unique solution + + +
+ + + Indicates that an is non-invertible. + + Martin Davis + + + + Extracts all the 0-dimensional (Point) components from a Geometry. + + + + + + Extracts the elements from a single and adds them to the provided . + + The geometry from which to extract + The list to add the extracted elements to + + + + + Extracts the elements from a single and returns them in a . + + the geometry from which to extract + + + + Constructs a PointExtracterFilter with a list in which to store Points found. + + + + + + + + + + + + Extracts all the elements from a . + + + + + + Extracts the elements from a single and adds them to the provided . + + The geometry from which to extract + The list to add the extracted elements to + + + + + Extracts the elements from a single and returns them in a . + + The geometry from which to extract + + + + Constructs a PolygonExtracterFilter with a list in which to store Polygons found. + + + + + + + + + + + + A visitor to elements which components, which + allows short-circuiting when a defined condition holds. + + + + + + + + + + + + + + + + + Reports whether visiting components can be terminated. + Once this method returns , it must + continue to return on every subsequent call. + + + if visiting can be terminated. + + + + + Creates geometries which are shaped like multi-armed stars with each arm shaped like a sine wave. + These kinds of geometries are useful as a more complex geometry for testing algorithms. + + + Martin Davis + + + + + Creates a sine star with the given parameters. + + The origin point. + The size of the star. + The number of points in the star. + The number of arms to generate. + The arm length ratio. + A sine star shape. + + + + Creates a factory which will create sine stars using the default + + + + + Creates a factory which will create sine stars using the given + + The factory to use + + + Gets/Sets the number of arms in the star + + + + Gets or sets the ratio of the length of each arm to the radius of the star. + A smaller number makes the arms shorter. + + Value should be between 0.0 and 1.0 + + + + Generates the geometry for the sine star + + The geometry representing the sine star + + + + Builds an array of all visited items. + + + + + Builds an array of all visited items. + + + + + Visits an item. + + The item to visit. + + + + Gets the array of visited items. + + + + + An BinTree (or "Binary Interval Tree") + is a 1-dimensional version of a quadtree. + It indexes 1-dimensional intervals (which may + be the projection of 2-D objects on an axis). + It supports range searching + (where the range may be a single point). + + + + This structure is dynamic - + new items can be added at any time, + and it will support deletion of items + (although this is not currently implemented). + + + This implementation does not require specifying the extent of the inserted + items beforehand. It will automatically expand to accommodate any extent + of dataset. + This index is different to the Interval Tree of Edelsbrunner + or the Segment Tree of Bentley. + + + + + Ensure that the Interval for the inserted item has non-zero extents. + Use the current minExtent to pad it, if necessary. + + + + + + + + + + + + + + + + + + + + Compute the total number of nodes in the tree. + + The number of nodes in the tree. + + + + + + + + + + + Removes a single item from the tree. + + itemEnv the Envelope of the item to be removed + the item to remove + true if the item was found (and thus removed) + + + + + + + + + + + + + + + + + Queries the tree to find all candidate items which + may overlap the query interval. + If the query interval is null, all items in the tree are found. + min and max may be the same value. + + The interval to query for or null + + + + Adds items in the tree which potentially overlap the query interval + to the given collection. + If the query interval is null, add all items in the tree. + + A query interval, or null + The candidate items found + + + + + + + + + + Represents an (1-dimensional) closed interval on the Real number line. + + + + + Gets or sets a value indicating the minimum value of the closed interval. + + + + + Gets or sets a value indicating the maximum value of the closed interval. + + + + + Gets the width of the interval ( - ) + + + + + Gets the centre of the interval ( + * 0.5d) + + + + + Creates a new interval instance, setting ==0d; + + + + + Creates a new interval instance, setting = and =; + + The minimum value + The maximum value + + + + Creates a new interval instance, setting = and =. + + + + + + Method to initialize the interval with the given and values.
+ If < , their values are exchanged. +
+ The minimum value + The maximum value +
+ + + Method to expand this interval to contain . + + The interval to contain. + + + + Function to test if this overlaps . + + The interval to test + true if this interval overlaps + + + + Function to test if this overlaps the interval R[, ]. + + The mimimum value of the interval + The maximum value of the interval + true if this interval overlaps the interval R[, ] + + + + Function to test if this contains . + + This is more rigid than + The interval to test + true if this interval contains + + + + Function to test if this contains the interval R[, ]. + + This is more rigid than + The mimimum value of the interval + The maximum value of the interval + true if this interval contains the interval R[, ] + + + + Function to test if this contains the value . + + The value to test + true if this interval contains the value + + + + A Key is a unique identifier for a node in a tree. + It contains a lower-left point and a level number. The level number + is the power of two for the size of the node envelope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return a square envelope containing the argument envelope, + whose extent is a power of two and which is based at a power of 2. + + + + + + + + + + + + + A node of a Bintree. + + + + + Creates a node + + The interval of the node item + A new node + + + + Creates a larger node, that contains both and + If is null, a node for is created. + + The original node + The additional interval + A new node + + + + Creates a new node instance + + The node's interval + The node's level + + + + Gets the node's + + + + + + + + + + + + Returns the subnode containing the envelope. + Creates the node if + it does not already exist. + + + + + + Returns the smallest existing + node containing the envelope. + + + + + + + + + + + + Get the subnode for the index. + If it doesn't exist, create it. + + + + + + + + + + + + The base class for nodes in a Bintree. + + + + + Returns the index of the subnode that wholely contains the given interval. + If none does, returns -1. + + + + + + + + + + + + Subnodes are numbered as follows: + 0 | 1 + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adds items in the tree which potentially overlap the query interval + to the given collection. + If the query interval is null, add all items in the tree. + + A query interval, or null + The candidate items found + + + + Removes a single item from this subtree. + + The envelope containing the item + The item to remove + true if the item was found and removed + + + + Gets whether this node is prunable + + + + + Gets whether this node has any children + + + + + + + + + + Gets whether this node has any subnodes + + + + + + + + + + + + + + + The root node of a single Bintree. + It is centred at the origin, + and does not have a defined extent. + + + + + Insert an item into the tree this is the root of. + + + + + + + Insert an item which is known to be contained in the tree rooted at + the given Node. Lower levels of the tree will be created + if necessary to hold the item. + + + + + + + + The root node matches all searches. + + + + + + MonotoneChains are a way of partitioning the segments of a linestring to + allow for fast searching of intersections. + + + + They have the following properties: + + the segments within a monotone chain never intersect each other + the envelope of any contiguous subset of the segments in a monotone chain + is equal to the envelope of the endpoints of the subset. + + + + Property 1 means that there is no need to test pairs of segments from within + the same monotone chain for intersection. + Property 2 allows an efficient + binary search to be used to find the intersection points of two monotone chains. + For many types of real-world data, these properties eliminate a large number of + segment comparisons, producing substantial speed gains. + + One of the goals of this implementation of MonotoneChains is to be + as space and time efficient as possible. One design choice that aids this + is that a MonotoneChain is based on a subarray of a list of points. + This means that new arrays of points (potentially very large) do not + have to be allocated. + + MonotoneChains support the following kinds of queries: + + Envelope selectdetermine all the segments in the chain which + intersect a given envelope. + Overlapdetermine all the pairs of segments in two chains whose + envelopes overlap. + + + + This implementation of MonotoneChains uses the concept of internal iterators + ( and ) + to return the resultsets for the above queries. + This has time and space advantages, since it + is not necessary to build lists of instantiated objects to represent the segments + returned by the query. + Queries made in this manner are thread-safe. + + + MonotoneChains support being assigned an integer id value + to provide a total ordering for a set of chains. + This can be used during some kinds of processing to + avoid redundant comparisons + (i.e.by comparing only chains where the first id is less than the second). + + + MonotoneChains support using an tolerance distance for overlap tests. + This allows reporting overlap in situations where + intersection snapping is being used. + If this is used the chain envelope must be computed + providing an expansion distance using . + + + + + + Creates a new MonotoneChain based on the given array of points. + + The points containing the chain + The index of the first coordinate in the chain + The index of the last coordinate in the chain + A user-defined data object + + + + Gets or sets the Id of this chain + + + Useful for assigning an ordering to a set of + chains, which can be used to avoid redundant processing. + + + + + Gets or sets the overlap distance used in overlap tests + with other chains. + + + + + Gets the chain's user-defined context data value. + + + + + Gets the envelope of this chain + + + + + Gets the envelope for this chain, + expanded by a given distance. + + Distance to expand the envelope by + The expanded envelope of the chain + + + + Gets the index of the start of the monotone chain + in the underlying array of points. + + + + + Gets the index of the end of the monotone chain + in the underlying array of points. + + + + + Gets the line segment starting at + + The index of the segment + The line segment to extract to + + + + Return the subsequence of coordinates forming this chain. + Allocates a new array to hold the Coordinates. + + + + + Determine all the line segments in the chain whose envelopes overlap + the searchEnvelope, and process them. + + + The monotone chain search algorithm attempts to optimize + performance by not calling the select action on chain segments + which it can determine are not in the search envelope. + However, it *may* call the select action on segments + which do not intersect the search envelope. + This saves on the overhead of checking envelope intersection + each time, since clients may be able to do this more efficiently. + + The search envelope + The select action to execute on selected segments + + + + + + + + + + + + + Determines the line segments in two chains which may overlap, + and passes them to an overlap action. + + + The monotone chain search algorithm attempts to optimize + performance by not calling the overlap action on chain segments + which it can determine do not overlap. + However, it* may* call the overlap action on segments + which do not actually interact. + This saves on the overhead of checking intersection + each time, since clients may be able to do this more efficiently. + + The chain to compare to + The overlap action to execute on selected segments + + + + Determines the line segments in two chains which may overlap, + using an overlap distance tolerance, + and passes them to an overlap action. + + The chain to compare to + The overlap tolerance distance (may be 0) + The overlap action to execute on selected segments + + + + Uses an efficient mutual binary search strategy + to determine which pairs of chain segments + may overlap, and calls the given overlap action on them. + + The start index of this chain section + The end index of this chain section + The target monotone chain + The start index of the target chain section + The end index of the target chain section + The overlap tolerance distance (may be 0) + The overlap action to execute on selected segments + + + + Tests whether the envelope of a section of the chain + overlaps(intersects) the envelope of a section of another target chain. + This test is efficient due to the monotonicity property + of the sections(i.e.the envelopes can be are determined + from the section endpoints + rather than a full scan). + + The start index of this chain section + The end index of this chain section + The target monotone chain + The start index of the target chain section + The end index of the target chain section + The overlap tolerance distance (may be 0) + true if the section envelopes overlap + + + The 1st coordinate of the 1st segment + The 2nd coordinate of the 1st segment + The 1st coordinate of the 2nd segment + The 2nd coordinate of the 2nd segment + The overlap tolerance distance (may be 0) + + + + Constructs s + for sequences of s. + + + + + Only static methods! + + + + + Computes a list of the s + for a list of coordinates. + + The list of points to compute chains for + A list of the monotone chains for the points + + + + Return a list of the MonotoneChains + for the given list of coordinates. + + The list of points to compute chains for + A data object to attach to each chain + A list of the monotone chains for the points + + + + Return an array containing lists of start/end indexes of the monotone chains + for the given list of coordinates. + The last entry in the array points to the end point of the point array, + for use as a sentinel. + + + + + + Finds the index of the last point in a monotone chain + starting at a given point. + Any repeated points (0-length segments) will be included + in the monotone chain returned. + + The coordinates + The start index + + The index of the last point in the monotone chain starting at start. + + + + + The action for the internal iterator for performing + overlap queries on a MonotoneChain. + + + + + + + + + + + + + + + This function can be overridden if the original chains are needed. + + + The index of the start of the overlapping segment from mc1. + + The index of the start of the overlapping segment from mc2. + + + + This is a convenience function which can be overridden to obtain the actual + line segments which overlap. + + + + + + + The action for the internal iterator for performing + envelope select queries on a MonotoneChain. + + + + + + + + + + This method is overridden to process a segment + in the context of the parent chain. + + The parent chain + The index of the start vertex of the segment being processed + + + + This is a convenience method which can be overridden to obtain the actual + line segment which is selected. + + + + + + A Hilbert-Packed R-tree. This is a static R-tree + which is packed by using the Hilbert ordering + of the tree items. + + The tree is constructed by sorting the items + by the Hilbert code of the midpoint of their envelope. + Then, a set of internal layers is created recursively + as follows: + + The items/nodes of the previous are partitioned into blocks of size nodeCapacity + For each block a layer node is created with range equal to the envelope of the items/nodess in the block + + The internal layers are stored using an array to + store the node bounds. + The link between a node and its children is + stored implicitly in the indexes of the array. + For efficiency, the offsets to the layers + within the node array are pre-computed and stored. + + NOTE: Based on performance testing, + the HPRtree is somewhat faster than the STRtree. + It should also be more memory-efficent, + due to fewer object allocations. + + However, it is not clear whether this + will produce a significant improvement + for use in JTS operations. + + + Martin Davis + + + + Creates a new index with the default node capacity. + + + + + Creates a new index with the given node capacity. + + The node capacity to use + + + Gets the number of items in the index. + The number of items + + + + + + + + + + + + + Tests whether two envelopes intersect. + Avoids the null check in . + An envelope + An envelope + true if the envelopes intersect + + + + Not supported, will always return false + + + + Builds the index, if not already built. + + + + + Computes the number of blocks (nodes) required to + cover a given number of children. + + + + the number of nodes needed to cover the children + + + + Gets the extents of the internal index nodes + + A list of the internal node extents + + + + This property is named Item in JTS + + + + + + + + A visitor for nodes and items in an index. + + + + + + + + + + + A visitor for items in a . + + + + + Visits an item in the index. + + The index item to be visited. + + + + A visitor for items in a + Not used, commited by accident! + + The type of the items in the index + [Obsolete] + + + + Gets a value indicating if no more items need to be visited + + + + + + + + A static index on a set of 1-dimensional intervals, + using an R-Tree packed based on the order of the interval midpoints. + + + It supports range searching, + where the range is an interval of the real line (which may be a single point). + A common use is to index 1-dimensional intervals which + are the projection of 2-D objects onto an axis of the coordinate system. + + This index structure is static + - items cannot be added or removed once the first query has been made. + The advantage of this characteristic is that the index performance + can be optimized based on a fixed set of items. + + Martin Davis + + + + + If root is null that indicates + that the tree has not yet been built, + OR nothing has been added to the tree. + In both cases, the tree is still open for insertions. + + + + + Adds an item to the index which is associated with the given interval + + The lower bound of the item interval + The upper bound of the item interval + The item to insert + if the index has already been queried + + + + Search for intervals in the index which intersect the given closed interval + and apply the visitor to them. + + The lower bound of the query interval + The upper bound of the query interval + The visitor to pass any matched items to + + + + The basic insertion and query operations supported by classes + implementing spatial index algorithms. + A spatial index typically provides a primary filter for range rectangle queries. A + secondary filter is required to test for exact intersection. Of course, this + secondary filter may consist of other tests besides intersection, such as + testing other kinds of spatial relationships. + + + + + Adds a spatial item with an extent specified by the given Envelope to the index. + + + + + Queries the index for all items whose extents intersect the given search Envelope + Note that some kinds of indexes may also return objects which do not in fact + intersect the query envelope. + + The envelope to query for. + A list of the items found by the query. + + + + Queries the index for all items whose extents intersect the given search , + and applies an to them. + Note that some kinds of indexes may also return objects which do not in fact + intersect the query envelope. + + The envelope to query for. + A visitor object to apply to the items found. + + + + Removes a single item from the tree. + + The Envelope of the item to remove. + The item to remove. + true if the item was found. + + + + A visitor for s in a index. + + 1.7 + + + + Visits a node. + + The node to visit + + + + A node of a , which represents one or more points in the same location. + + The type of the object + dskea + + + + Creates a new KdNode. + + coordinate of point + coordinate of point + A data objects to associate with this node + + + + Creates a new KdNode. + + The point location of new node + A data objects to associate with this node + + + + Gets x-ordinate of this node + + The x-ordinate + + + + Gets y-ordinate of this node + + The y-ordinate + + + + Gets the split value at a node, depending on + whether the node splits on X or Y. + The X (or Y) ordinates of all points in the left subtree + are less than the split value, and those + in the right subtree are greater than or equal to the split value. + + A flag whether the node splits a X or Y + The splitting value + + + + Gets the location of this node + + The Coordinate + + + + Gets the user data object associated with this node. + + The user data + + + + Gets or sets the left node of the tree + + The left node + + + + Gets or sets the right node of the tree + + The right node + + + + Gets the number of inserted points that are coincident at this location. + + + + + Gets whether more than one point with this value have been inserted (up to the tolerance) + + + + + + Tests whether the node's left subtree may contain values + in a given range envelope. + + A flag whether the node splits on X or Y + The range envelope + true if the left subtree is in range + + + + Tests whether the node's right subtree may contain values + in a given range envelope. + + A flag whether the node splits on X or Y + The range envelope + trueif the right subtree is in range + + + + Tests whether a point is strictly to the left + of the splitting plane for this node. + If so it may be in the left subtree of this node, + Otherwise, the point may be in the right subtree. + The point is to the left if its X (or Y) ordinate + is less than the split value. + + A flag whether the node splits on X or Y + The query point + true if the point is strictly to the left. + + + + + An implementation of a + KD - Tree + over two dimensions(X and Y). + KD-trees provide fast range searching and fast lookup for point data. + The tree is built dynamically by inserting points. + The tree supports queries by range and for point equality. + For querying an internal stack is used instead of recursion to avoid overflow. + + + This implementation supports detecting and snapping points which are closer + than a given distance tolerance. + If the same point (up to tolerance) is inserted + more than once , it is snapped to the existing node. + In other words, if a point is inserted which lies + within the tolerance of a node already in the index, + it is snapped to that node. + When an inserted point is snapped to a node then a new node is not created + but the count of the existing node is incremented. + If more than one node in the tree is within tolerance of an inserted point, + the closest and then lowest node is snapped to. + + The structure of a KD-Tree depends on the order of insertion of the points. + A tree may become umbalanced if the inserted points are coherent + (e.g.monotonic in one or both dimensions). + A perfectly balanced tree has depth of only log2(N), + but an umbalanced tree may be much deeper. + This has a serious impact on query efficiency. + One solution to this is to randomize the order of points before insertion + (e.g. by using Fisher - Yates shuffling). + + The type of the user data object + David Skea + Martin Davis + + + + Converts a collection of s to an array of s. + + A collection of nodes + An array of the coordinates represented by the nodes + + + + Converts a collection of {@link KdNode}s + to an array of s, + specifying whether repeated nodes should be represented + by multiple coordinates. + + a collection of nodes + true if repeated nodes should + be included multiple times + An array of the coordinates represented by the nodes + + + + Creates a new instance of a KdTree with a snapping tolerance of 0.0. + (I.e. distinct points will not be snapped) + + + + + Creates a new instance of a KdTree with a snapping distance + tolerance. Points which lie closer than the tolerance to a point already + in the tree will be treated as identical to the existing point. + + The tolerance distance for considering two points equal + + + + Tests whether the index contains any items. + + + + + Gets a value indicating the root node of the tree + + The root node of the tree + + + + Inserts a new point in the kd-tree, with no data. + + The point to insert + The kdnode containing the point + + + + Inserts a new point into the kd-tree. + + The point to insert + A data item for the point + + A new KdNode if a new point is inserted, else an existing + node is returned with its counter incremented. This can be checked + by testing returnedNode.getCount() > 1. + + + + + Finds the node in the tree which is the best match for a point + being inserted. + The match is made deterministic by returning the lowest of any nodes which + lie the same distance from the point. + There may be no match if the point is not within the distance tolerance of any + existing node. + + The point being inserted + + + the best matching node + null if no match was found + + + + + + Inserts a point known to be beyond the distance tolerance of any existing node. + The point is inserted at the bottom of the exact splitting path, + so that tree shape is deterministic. + + The point to insert + The data associated with + + + The data for the point + The created node + + + + + + Performs a range search of the points in the index and visits all nodes found. + + The range rectangle to query + A visitor to visit all nodes found by the search + + + + Performs a range search of the points in the index. + + The range rectangle to query + A collection of the KdNodes found + + + + Performs a range search of the points in the index. + + The range rectangle to query + A collection to accumulate the result nodes into + + + + Searches for a given point in the index and returns its node if found. + + the point to query + the point node, if it is found in the index, or if not + + + + Gets a value indicating the depth of the tree + + The depth of the tree + + + + Gets a value indicating the number of items in the tree. + + The number of items in the tree. + + + + Extensions methods for the . + + + + + Performs a nearest neighbor search of the points in the index. + + The KdTree to look for the nearest neighbor + The point to search the nearset neighbor for + + + + DoubleBits manipulates Double numbers + by using bit manipulation and bit-field extraction. + For some operations (such as determining the exponent) + this is more accurate than using mathematical operations + (which suffer from round-off error). + The algorithms and constants in this class + apply only to IEEE-754 double-precision floating point format. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Determines the exponent for the number. + + + + + Determines the exponent for the number. + + + + + + + + + + + + + + + + + + This computes the number of common most-significant bits in the mantissa. + It does not count the hidden bit, which is always 1. + It does not determine whether the numbers have the same exponent - if they do + not, the value computed by this function is meaningless. + + + The number of common most-significant mantissa bits. + + + + A representation of the Double bits formatted for easy readability. + + + + + Provides a test for whether an interval is + so small it should be considered as zero for the purposes of + inserting it into a binary tree. + The reason this check is necessary is that round-off error can + cause the algorithm used to subdivide an interval to fail, by + computing a midpoint value which does not lie strictly between the + endpoints. + + + + + Only static methods! + + + + + This value is chosen to be a few powers of 2 less than the + number of bits available in the double representation (i.e. 53). + This should allow enough extra precision for simple computations to be correct, + at least for comparison purposes. + + + + + Computes whether the interval [min, max] is effectively zero width. + I.e. the width of the interval is so much less than the + location of the interval that the midpoint of the interval cannot be + represented precisely. + + + + + A Key is a unique identifier for a node in a quadtree. + It contains a lower-left point and a level number. The level number + is the power of two for the size of the node envelope. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return a square envelope containing the argument envelope, + whose extent is a power of two and which is based at a power of 2. + + + + + + + + + + + + + Represents a node of a Quadtree. Nodes contain + items which have a spatial extent corresponding to the node's position + in the quadtree. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the subquad containing the envelope . + Creates the subquad if + it does not already exist. + + The envelope to search for + The subquad containing the search envelope. + + + + Returns the smallest existing + node containing the envelope. + + + + + + + + + + + + Get the subquad for the index. + If it doesn't exist, create it. + + + + + + + + + + + + + Gets a value indicating the level of this node + + The level of this node + + + + The base class for nodes in a Quadtree. + + + + + Gets the index of the subquad that wholly contains the given envelope. + If none does, returns -1. + + The index of the subquad that wholly contains the given envelope
+ or -1 if no subquad wholly contains the envelope
+
+ + + + + + + + subquads are numbered as follows: + 2 | 3 + --+-- + 0 | 1 + + + + + + + + + + + + + + + + + + + + + Removes a single item from this subtree. + + The envelope containing the item. + The item to remove. + true if the item was found and removed. + + + + + + + + + + + + + + Gets a value indicating that this node is empty, i.e. it does not contain an items or sub-nodes. + + + + + Insert items in this into the parameter! + + IList for adding items. + Parameter IList with this items. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A Quadtree is a spatial index structure for efficient range querying + of items bounded by 2D rectangles.
+ s can be indexed by using their s.
+ Any type of object can also be indexed, as long as it has an extent that can be + represented by an . + + This Quadtree index provides a primary filter + for range rectangle queries. The various query methods return a list of + all items which may intersect the query rectangle. Note that + it may thus return items which do not in fact intersect the query rectangle. + A secondary filter is required to test for actual intersection + between the query rectangle and the envelope of each candidate item. + The secondary filter may be performed explicitly, + or it may be provided implicitly by subsequent operations executed on the items + (for instance, if the index query is followed by computing a spatial predicate + between the query geometry and tree items, + the envelope intersection check is performed automatically. + + This implementation does not require specifying the extent of the inserted + items beforehand. It will automatically expand to accommodate any extent + of dataset. + + This data structure is also known as an MX-CIF quadtree + following the terminology usage of Samet and others. +
+
+ + + Ensure that the envelope for the inserted item has non-zero extents. + Use the current minExtent to pad the envelope, if necessary. + + + + + + + minExtent is the minimum envelope extent of all items + inserted into the tree so far. It is used as a heuristic value + to construct non-zero envelopes for features with zero X and/or Y extent. + Start with a non-zero extent, in case the first feature inserted has + a zero extent in both directions. This value may be non-optimal, but + only one feature will be inserted with this value. + + + + + Constructs a Quadtree with zero items. + + + + + Returns the number of levels in the tree. + + + + + Tests whether the index contains any items. + + + + + Returns the number of items in the tree. + + + + + + + + + + + + Removes a single item from the tree. + + The Envelope of the item to be removed. + The item to remove. + true if the item was found (and thus removed). + + + + Queries the tree and returns items which may lie in the given search envelope. + + + Precisely, the items that are returned are all items in the tree + whose envelope may intersect the search Envelope. + Note that some items with non-intersecting envelopes may be returned as well; + the client is responsible for filtering these out. + In most situations there will be many items in the tree which do not + intersect the search envelope and which are not returned - thus + providing improved performance over a simple linear scan. + + The envelope of the desired query area. + A List of items which may intersect the search envelope + + + + Queries the tree and visits items which may lie in the given search envelope. + + + Precisely, the items that are visited are all items in the tree + whose envelope may intersect the search Envelope. + Note that some items with non-intersecting envelopes may be visited as well; + the client is responsible for filtering these out. + In most situations there will be many items in the tree which do not + intersect the search envelope and which are not visited - thus + providing improved performance over a simple linear scan. + + The envelope of the desired query area. + A visitor object which is passed the visited items + + + + Return a list of all items in the Quadtree. + + + + + + + + + + + Gets a value indicating the root node of this QuadTree + + The root node of this QuadTree + + + + Item visitor that specifically excludes a predefined area. + + The type of the items to visit + + + + Initialize with + + + + + > + + + + Get a value indicating the gathered items + + + + + QuadRoot is the root of a single Quadtree. + It is centred at the origin, + and does not have a defined extent. + + + + + Insert an item into the quadtree this is the root of. + + + + + Insert an item which is known to be contained in the tree rooted at + the given QuadNode root. Lower levels of the tree will be created + if necessary to hold the item. + + + + + + + + + + + + A node of an . A node is one of: + + empty + an interior node containing child s + a leaf node containing data items (s). + + A node stores the bounds of its children, and its level within the index tree. + + + + + Constructs an AbstractNode at the given level in the tree + + + 0 if this node is a leaf, 1 if a parent of a leaf, and so on; the + root node will have the highest level. + + + + + Returns either child s, or if this is a leaf node, real data (wrapped + in s). + + + + + Returns a representation of space that encloses this Boundable, + preferably not much bigger than this Boundable's boundary yet fast to + test for intersection with the bounds of other Boundables. The class of + object returned depends on the subclass of AbstractSTRtree. + + + An Envelope (for STRtrees), an Interval (for SIRtrees), or other + object (for other subclasses of AbstractSTRtree). + + + + + Gets the bounds of this node + + + + + Returns 0 if this node is a leaf, 1 if a parent of a leaf, and so on; the + root node will have the highest level. + + + + + Gets the count of the s at this node. + + + + + Tests whether there are any s at this node. + + + + + Adds either an AbstractNode, or if this is a leaf node, a data object + (wrapped in an ItemBoundable). + + The child to add. + + + + Base class for STRtree and SIRtree. STR-packed R-trees are described in: + P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With + Application To GIS. Morgan Kaufmann, San Francisco, 2002. + + This implementation is based on s rather than just s, + because the STR algorithm operates on both nodes and + data, both of which are treated as s. + + + + + + A test for intersection between two bounds, necessary because subclasses + of AbstractSTRtree have different implementations of bounds. + + + + + For STRtrees, the bounds will be Envelopes; + for SIRtrees, Intervals; + for other subclasses of AbstractSTRtree, some other class. + + The bounds of one spatial object. + The bounds of another spatial object. + Whether the two bounds intersect. + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have. + + + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and the root node + + The maximum number of child nodes in a node + The root node that links to all other nodes in the tree + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and all leaf nodes in the tree + + The maximum number of child nodes in a node + The list of leaf nodes in the tree + + + + Creates parent nodes, grandparent nodes, and so forth up to the root + node, for the data that has been inserted into the tree. Can only be + called once, and thus can be called only after all of the data has been + inserted into the tree. + + + + + + + + + + + + Sorts the childBoundables then divides them into groups of size M, where + M is the node capacity. + + + + + + + Creates the levels higher than the given level. + + The level to build on. + the level of the Boundables, or -1 if the boundables are item + boundables (that is, below level 0). + The root, which may be a ParentNode or a LeafNode. + + + + Gets the root node of the tree. + + + + + Gets the maximum number of child nodes that a node may have. + + + + + Tests whether the index contains any items. + This method does not build the index, + so items can still be inserted after it has been called. + + + + + Gets the number of elements in the tree + + + + + Also builds the tree, if necessary. + + + + + + Gets a tree structure (as a nested list) + corresponding to the structure of the items and nodes in this tree. + The returned Lists contain either Object items, + or Lists which correspond to subtrees of the tree + Subtrees which do not contain any items are not included. + Builds the tree if necessary. + + a List of items and/or Lists + + + + A test for intersection between two bounds, necessary because subclasses + of AbstractSTRtree have different implementations of bounds. + + + + + Removes an item from the tree. + (Builds the tree, if necessary.) + + + + + Gets a value indicating the boundable items that have to be included in the index + + A list of boundable items + + + + A pair of s, whose leaf items + support a distance metric between them. + Used to compute the distance between the members, + and to expand a member relative to the other + in order to produce new branches of the + Branch-and-Bound evaluation tree. + Provides an ordering based on the distance between the members, + which allows building a priority queue by minimum distance. + + Martin Davis + + + + Creates an instance of this class with the given s and the function. + + The first boundable + The second boundable + The item distance function + + + + Gets one of the member s in the pair + (indexed by [0, 1]). + + The index of the member to return (0 or 1) + The chosen member + + + + Computes the maximum distance between any + two items in the pair of nodes. + + the maximum distance between items in the pair + + + + Computes the distance between the s in this pair. + The boundables are either composites or leaves. + If either is composite, the distance is computed as the minimum distance + between the bounds. + If both are leaves, the distance is computed by . + + The distance between the s in this pair. + + + + Gets the minimum possible distance between the Boundables in + this pair. + If the members are both items, this will be the + exact distance between them. + Otherwise, this distance will be a lower bound on + the distances between the items in the members. + + The exact or lower bound distance for this pair + + + + Compares two pairs based on their minimum distances + + + + + Tests if both elements of the pair are leaf nodes + + + + + For a pair which is not a leaf + (i.e. has at least one composite boundable) + computes a list of new pairs + from the expansion of the larger boundable + with distance less than minDistance + and adds them to a priority queue. + + Note that expanded pairs may contain + the same item/node on both sides. + This must be allowed to support distance + functions which have non-zero distances + between the item and itself (non-zero reflexive distance). + + The priority queue to add the new pairs to. + The limit on the distance between added pairs. + + + + The Class BoundablePairDistanceComparator. It implements .Net and is used + as a parameter to sort the BoundablePair list. + + + + The normal order + + + + Instantiates a new boundable pair distance comparator. + + + A value of true puts the lowest record at the head of this queue. + This is the natural order. will get the least element. + + + + + + + + Utility functions for working with s. + + mdavis + + + + Computes the maximum distance between the points defining two envelopes. + This is the distance between the two corners which are farthest apart. + + Note that this is NOT the MinMax distance, which is a tighter bound on + the distance between the points in the envelopes. + + An envelope + An envelope + The maximum distance between the points defining the envelopes + + + + Computes the Min-Max Distance between two s. + It is equal to the minimum of the maximum distances between all pairs of + edge segments from the two envelopes. + This is the tight upper bound on the distance between + geometric items bounded by the envelopes. + + Theoretically this bound can be used in the R-tree nearest-neighbour branch-and-bound search + instead of . + However, little performance improvement is observed in practice. + + An envelope + An envelope + The min-max-distance between the envelopes + + + + Computes the maximum distance between two line segments. + + x-ordinate of first endpoint of segment 1 + y-ordinate of first endpoint of segment 1 + x-ordinate of second endpoint of segment 1 + y-ordinate of second endpoint of segment 1 + x-ordinate of first endpoint of segment 2 + y-ordinate of first endpoint of segment 2 + x-ordinate of second endpoint of segment 2 + y-ordinate of second endpoint of segment 2 + Maximum distance between the segments + + + + An function for + items which are using the method. + + To make this distance function suitable for + using to query a single index tree, + the distance metric is anti-reflexive. + That is, if the two arguments are the same Geometry object, + the distance returned is . + + Martin Davis + + + + Computes the distance between two items, + using the method. + + An item which is a geometry. + An item which is a geometry. + if either item is not a Geometry + The distance between the two items. + + + + A function method which computes the distance + between two s in an . + Used for Nearest Neighbour searches. + + To make a distance function suitable for + querying a single index tree + via , + the function should have a non-zero reflexive distance. + That is, if the two arguments are the same object, + the distance returned should be non-zero. + If it is required that only pairs of distinct items be returned, + the distance function must be anti-reflexive, + and must return for identical arguments. + + Martin Davis + + + + Computes the distance between two items. + + The first item. + The second item. + If the metric is not applicable to the arguments + The distance between and . + + + + A contiguous portion of 1D-space. Used internally by SIRtree. + + + + + + + + + + + + + + + + + + Gets the centre of the interval. + + + + + + + + this + + + + + + + this + + + + + + + + + + + + + + + + + + + + + Boundable wrapper for a non-Boundable spatial object. Used internally by + AbstractSTRtree. + + + + + + + + + + + + The bounds + + + + + The item + + + + + One-dimensional version of an STR-packed R-tree. SIR stands for + "Sort-Interval-Recursive". STR-packed R-trees are described in: + P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With + Application To GIS. Morgan Kaufmann, San Francisco, 2002. + + + + + + + + + + + + + + + + + Constructs an SIRtree with the default (10) node capacity. + + + + + Constructs an SIRtree with the given maximum number of child nodes that + a node may have. + + + + + + + + + + + + Inserts an item having the given bounds into the tree. + + + + + + + + Returns items whose bounds intersect the given value. + + + + + + Returns items whose bounds intersect the given bounds. + + Possibly equal to x2. + Possibly equal to x1. + + + + + + + + + + + + + + + A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. + For two-dimensional spatial data. + + The STR packed R-tree is simple to implement and maximizes space + utilization; that is, as many leaves as possible are filled to capacity. + Overlap between nodes is far less than in a basic R-tree. + However, the index is semi-static; once the tree has been built + (which happens automatically upon the first query), items may + not be added.
+ Items may be removed from the tree using . + + Described in: P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With + Application To GIS. Morgan Kaufmann, San Francisco, 2002. + + Note that inserting items into a tree is not thread-safe. + Inserting performed on more than one thread must be synchronized externally. + + Querying a tree is thread-safe. The building phase is done synchronously, + and querying is stateless. +
+
+ + + Constructs an STRtree with the default (10) node capacity. + + + + + Constructs an STRtree with the given maximum number of child nodes that + a node may have. + + The minimum recommended capacity setting is 4. + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and the root node + + The minimum recommended capacity setting is 4 + The maximum number of child nodes in a node + The root node that links to all other nodes in the tree + + + + Constructs an AbstractSTRtree with the specified maximum number of child + nodes that a node may have, and all leaf nodes in the tree + + The minimum recommended capacity setting is 4 + The maximum number of child nodes in a node + The list of leaf nodes in the tree + + + + + + + + + + + + + + + + + + + + + + + + + + Creates the parent level for the given child level. First, orders the items + by the x-values of the midpoints, and groups them into vertical slices. + For each slice, orders the items by the y-values of the midpoints, and + group them into runs of size M (the node capacity). For each run, creates + a new (parent) node. + + + + + + + + + + + + + + + + + + + + + + + + + Must be sorted by the x-value of the envelope midpoints. + + + + + + + + + + + + + + + + + Inserts an item having the given bounds into the tree. + + + + + + + Returns items whose bounds intersect the given envelope. + + + + + + Returns items whose bounds intersect the given envelope. + + + + + + + Removes a single item from the tree. + + The Envelope of the item to remove. + The item to remove. + true if the item was found. + + + + + + + + + + Finds the two nearest items in the tree, + using as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + + If the tree is empty, the return value is null. + If the tree contains only one item, the return value is a pair containing that item. + If it is required to find only pairs of distinct items, + the function must be anti-reflexive. + + A distance metric applicable to the items in this tree + The pair of the nearest items or null if the tree is empty + + + + Finds the item in this tree which is nearest to the given , + using as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + + The query does not have to be + contained in the tree, but it does + have to be compatible with the + distance metric. + + The envelope of the query item + The item to find the nearest neighbour of + A distance metric applicable to the items in this tree and the query item + The nearest item in this tree or null if the tree is empty + + + + Finds the two nearest items from this tree + and another tree, + using as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + The result value is a pair of items, + the first from this tree and the second + from the argument tree. + + Another tree + A distance metric applicable to the items in the trees + The pair of the nearest items, one from each tree or null if no pair of distinct items can be found. + + + + Tests whether some two items from this tree and another tree + lie within a given distance. + is used as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + + Another tree + A distance metric applicable to the items in the trees + The distance limit for the search + true if there are items within the distance + + + + Performs a withinDistance search on the tree node pairs. + This is a different search algorithm to nearest neighbour. + It can utilize the between + tree nodes to confirm if two internal nodes must + have items closer than the maxDistance, + and short-circuit the search. + + The initial pair containing the tree root nodes + The maximum distance to search for + true if two items lie within the given distance + + + + Finds k items in this tree which are the top k nearest neighbors to the given item, + using itemDist as the distance metric. + A Branch-and-Bound tree traversal algorithm is used + to provide an efficient search. + This method implements the KNN algorithm described in the following paper: + + Roussopoulos, Nick, Stephen Kelley, and Frédéric Vincent. "Nearest neighbor queries." + ACM sigmod record. Vol. 24. No. 2. ACM, 1995. + + The query item does not have to be + contained in the tree, but it does + have to be compatible with the itemDist + distance metric. + + The envelope of the query item + The item to find the nearest neighbour of + A distance metric applicable to the items in this tree and the query item + The K nearest items in kNearestNeighbour + K nearest items in this tree + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ProjectionEvents are ordered first by their x-value, and then by their eventType. + It is important that Insert events are sorted before Delete events, so that + items whose Insert and Delete events occur at the same x-value will be + correctly handled. + + + + + + A sweepline implements a sorted index on a set of intervals. + It is used to compute all overlaps between the interval in the index. + + + + + + + + + + + Because Delete Events have a link to their corresponding Insert event, + it is possible to compute exactly the range of events which must be + compared to a given Insert event object. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Extends the class to allow writing values in the BigEndian format. + + + While extends + adding methods for writing integer values () + and double values () in the BigEndian format, + this implementation overrides methods, such + and and more, + for writing values in the BigEndian format. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The supplied stream. + output is null. + + The stream does not support writing, or the stream is already closed. + + + + Initializes a new instance of the class. + + The supplied stream. + The character encoding. + output or encoding is null. + + The stream does not support writing, or the stream is already closed. + + + + Writes a two-byte signed integer to the current stream using BigEndian encoding + and advances the stream position by two bytes. + + The two-byte signed integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a two-byte unsigned integer to the current stream using BigEndian encoding + and advances the stream position by two bytes. + + The two-byte unsigned integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a four-byte signed integer to the current stream using BigEndian encoding + and advances the stream position by four bytes. + + The four-byte signed integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a four-byte unsigned integer to the current stream using BigEndian encoding + and advances the stream position by four bytes. + + The four-byte unsigned integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes an eight-byte signed integer to the current stream using BigEndian encoding + and advances the stream position by eight bytes. + + The eight-byte signed integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes an eight-byte unsigned integer to the current stream using BigEndian encoding + and advances the stream position by eight bytes. + + The eight-byte unsigned integer to write. + The stream is closed. + An I/O error occurs. + + + + Writes a four-byte floating-point value to the current stream using BigEndian encoding + and advances the stream position by four bytes. + + The four-byte floating-point value to write. + The stream is closed. + An I/O error occurs. + + + + Writes an eight-byte floating-point value to the current stream using BigEndian encoding + and advances the stream position by eight bytes. + + The eight-byte floating-point value to write. + The stream is closed. + An I/O error occurs. + + + + Extends the class to allow reading values in the specified format. + + + While extends + adding methods for reading integer values () + and double values () in the specified format, + this implementation overrides methods, such + and and more, + for reading values in the specified by format. + + + + + Initializes a new instance of the class. + + The stream. + + + + Initializes a new instance of the class. + + The supplied stream. + The byte order. + The stream does not support reading, the stream is null, or the stream is already closed. + + + + Encoding type + + + + + Reads a 2-byte signed integer from the current stream using the specified encoding + and advances the current position of the stream by two bytes. + + + A 2-byte signed integer read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 2-byte unsigned integer from the current stream using the specified encoding + and advances the position of the stream by two bytes. + + + A 2-byte unsigned integer read from this stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 4-byte signed integer from the current stream using the specified encoding + and advances the current position of the stream by four bytes. + + + A 4-byte signed integer read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 4-byte unsigned integer from the current stream using the specified encoding + and advances the position of the stream by four bytes. + + + A 4-byte unsigned integer read from this stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads an 8-byte signed integer from the current stream using the specified encoding + and advances the current position of the stream by eight bytes. + + + An 8-byte signed integer read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads an 8-byte unsigned integer from the current stream using the specified encoding + and advances the position of the stream by eight bytes. + + + An 8-byte unsigned integer read from this stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a 4-byte floating point value from the current stream using the specified encoding + and advances the current position of the stream by four bytes. + + + A 4-byte floating point value read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads an 8-byte floating point value from the current stream using the specified encoding + and advances the current position of the stream by eight bytes. + + + An 8-byte floating point value read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a string from the current stream. + The string is prefixed with the length, encoded as an integer seven bits at a time. + + The string being read. + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Reads a decimal value from the current stream + and advances the current position of the stream by sixteen bytes. + + + A decimal value read from the current stream. + + The stream is closed. + An I/O error occurs. + The end of the stream is reached. + + + + Byte order + + + + + BigEndian + + + + + LittleEndian + + + + + Lightweight class that handles OGC Geometry type declaration + + + + + Initializes this instance + + The value describing the + + + + Inititalizes this instance based on a geometry and an Ordinates flag. + + The geometry. + The ordinates flag. + + + + Inititalizes this instance based on an + + The OGC geometry type + + + + Inititalizes this instance based on an and an SRID indicator + + The OGC geometry type + Indicator if a SRID is supplied. + + + + Inititalizes this instance based on an and an SRID indicator + + The OGC geometry type + The ordinates flag. + Indicator if a SRID is supplied. + + + + Gets or sets the base geometry type + + + + + Gets the OGC Well-Known-Binary type code + + + + + Gets the PostGIS Enhanced Well-Known-Binary type code + + + + + Gets or sets whether z-ordinate values are stored along with the geometry. + + + + + Gets or sets whether m-ordinate values are stored along with the geometry. + + + + + Gets whether SRID value is stored along with the geometry. + + + + + Gets or sets whether z-ordinate values are stored along with the geometry. + + + + + Gets or sets whether m-ordinate values are stored along with the geometry. + + + + + Gets or sets whether z-ordinates are stored along with the geometry. + PostGis EWKB format. + + + + + Gets or sets whether z-ordinates are stored along with the geometry. + PostGis EWKB format. + + + + + Gets or sets whether z-ordinates are stored along with the geometry. + PostGis EWKB format. + + + + + Reads a GML document and creates a representation of the features based on NetTopologySuite model. + Uses GML 2.1.1 Geometry.xsd schema for base for features. + + + + + builder. + + + + + Initialize reader with a standard . + + + + + Initialize reader with the given . + + + + + Read a GML document and returns relative . + + + + + + + Read a GML document and returns relative . + + + + + + + Reads the coordinate. + + The reader. + + + + + Extract a from a x,y string value. + + + + + + + Extract a from a pos entity string value. + + + + + + + Extract a from a x,y string value. + + + + + Identifies a version of the GML specification. + + + + + Version 2.1.1 (OGC 02-009). + + + + + Version 3.2.2 (OGC 07-036r1 / ISO 19136:2007). + + + + + Writes the GML representation of the features of NetTopologySuite model. + Uses GML 2.1.1 Geometry.xsd schema for base for features. + + Thanks to rstuven for improvements :) + + + + + + Formatter for double values of coordinates + + + + + Initializes a new instance of the class. + + + + + Returns an XmlReader with feature informations. + Use XmlDocument.Load(XmlReader) for obtain a XmlDocument to work. + + + + + + + Writes a GML feature into a generic Stream, such a FileStream or other streams. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sets corrent length for Byte Stream. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the EPSG code exposing the SRID of the geometry + + The SRID of the geometry + + + + + Writes the GML representation of the features of NetTopologySuite model. + Uses GML 3.2.2 gml.xsd schema for base for features. + + + + + Initializes a new instance of the class. + + + + + Constructs objects from the OGC KML representation. + Works only with KML geometry elements and may also parse attributes within these elements + + + + + Creates a reader that creates objects using the default . + + + + + Creates a reader that creates objects using the given . + + The factory used to create Geometrys. + + + + Creates a reader that creates objects using the default . + + Names of attributes that should be parsed (i.e. extrude, altitudeMode, tesselate, etc). + + + + Creates a reader that creates objects using the given . + + The factory used to create Geometrys. + Names of attributes that should be parsed (i.e. extrude, altitudeMode, tesselate, etc). + + + + Reads a KML representation of a from a . + + If any attribute names were specified during {@link KMLReader} construction, + they will be stored as in . + + The string that specifies kml representation of geometry. + A Geometry + Thrown if a parsing problem occurs. + + + + Reads a KML representation of a from a . + + If any attribute names were specified during {@link KMLReader} construction, + they will be stored as in . + + The text stream reader. + A Geometry + Thrown if a parsing problem occurs. + + + + Writes a formatted string containing the KML representation + of a JTS . + The output is KML fragments which can be substituted + wherever the KML abstract + element can be used. + + + Output elements are indented to provide a + nicely-formatted representation. + An output line prefix and maximum + number of coordinates per line can be specified. + + + The Z ordinate value output can be forced to be a specific value. + The and modes can be set. + If set, the corresponding sub-elements will be output. + + + + + The KML standard value clampToGround for use in . + + + + + The KML standard value relativeToGround for use in . + + + + + The KML standard value absolute for use in . + + + + + Writes a Geometry as KML to a string, using + a specified Z value. + + the geometry to write + the Z value to use + a string containing the KML geometry representation + + + + Writes a Geometry as KML to a string, using + a specified Z value, precision, extrude flag, + and altitude mode code. + + the geometry to write + the Z value to use + the maximum number of decimal places to write + the extrude flag to write + the altitude model code to write + a string containing the KML geometry representation + + + + A tag string which is prefixed to every emitted text line. + This can be used to indent the geometry text in a containing document. + + + + + The maximum number of coordinates to output per line. + + + + + The Z value to be output for all coordinates. + This overrides any Z value present in the Geometry coordinates. + + + + + The flag to be output in the extrude element. + + + + + The flag to be output in the tesselate element. + + + + + The value output in the altitudeMode element. + + + + + The maximum number of decimal places to output in ordinate values. + Useful for limiting output size. + + + negative values set the precision to , + like standard behavior. + + + + + Writes a in KML format as a string. + + the geometry to write + a string containing the KML geometry representation + + + + Writes the KML representation of a to a . + + the geometry to write + the writer to write to + + + + Appends the KML representation of a to a . + + the geometry to write + the buffer to write into + + + + Takes a list of coordinates and converts it to KML. + + + 2D and 3D aware. Terminates the coordinate output with a newline. + + + + + Formats numeric values for ordinates + in a consistent, accurate way. + + The format has the following characteristics: + + It is consistent in all locales (in particular, the decimal separator is always a period) + Scientific notation is never output, even for very large numbers. This means that it is possible that output can contain a large number of digits. + The maximum number of decimal places reflects the available precision + NaN values are represented as "NaN" + Inf values are represented as "Inf" or "-Inf" + + + mdavis + + + + The output representation of + + + + + The output representation of + + + + + The output representation of + + + + + The maximum number of fraction digits to support output of reasonable ordinate values. + + The default is chosen to allow representing the smallest possible IEEE-754 double-precision value, + although this is not expected to occur (and is not supported by other areas of the JTS/NTS code). + + + + + The default formatter using the maximum number of digits in the fraction portion of a number. + + + + + Creates an OrdinateFormat using the default maximum number of fraction digits. + + + + + Creates an OrdinateFormat using the given maximum number of fraction digits. + + The maximum number of fraction digits to output + + + + Returns a string representation of the given ordinate numeric value. + + The ordinate value + The formatted number string + + + + Thrown by a WKTReader when a parsing problem occurs. + + + + + Creates a ParseException with the given detail message. + + A description of this ParseException. + + + + Creates a ParseException with es detail message. + + An exception that occurred while a WKTReader was + parsing a Well-known Text string. + + + + Creates a ParseException with s detail message + + + The inner exception + + + + WKB Geometry Types + + + + + Point. + + + + + LineString. + + + + + Polygon. + + + + + MultiPoint. + + + + + MultiLineString. + + + + + MultiPolygon. + + + + + GeometryCollection. + + + + + Point with Z coordinate. + + + + + LineString with Z coordinate. + + + + + Polygon with Z coordinate. + + + + + MultiPoint with Z coordinate. + + + + + MultiLineString with Z coordinate. + + + + + MultiPolygon with Z coordinate. + + + + + GeometryCollection with Z coordinate. + + + + + Point with M ordinate value. + + + + + LineString with M ordinate value. + + + + + Polygon with M ordinate value. + + + + + MultiPoint with M ordinate value. + + + + + MultiLineString with M ordinate value. + + + + + MultiPolygon with M ordinate value. + + + + + GeometryCollection with M ordinate value. + + + + + Point with Z coordinate and M ordinate value. + + + + + LineString with Z coordinate and M ordinate value. + + + + + Polygon with Z coordinate and M ordinate value. + + + + + MultiPoint with Z coordinate and M ordinate value. + + + + + MultiLineString with Z coordinate and M ordinate value. + + + + + MultiPolygon with Z coordinate and M ordinate value. + + + + + GeometryCollection with Z coordinate and M ordinate value. + + + + + Reads a sequence of {@link Geometry}s in WKBHex format + from a text file. + Each WKBHex geometry must be on a single line + The geometries in the file may be separated by any amount + of whitespace and newlines. + + Martin Davis + + + + Creates a new given the + to use to parse the geometries. + + The geometry reader to use + + + + Gets or sets a value indicating the maximum number of geometries to read + + + + + Gets or sets the number of geometries to skip before storing. + + + + + Reads a sequence of geometries.
+ If an is specified, geometries read up to the offset count are skipped. + If a is specified, no more than geometries are read. +
+ The path to the file + Thrown if no filename was specified + Thrown if the filename specified does not exist + Thrown if an I/O exception was encountered + Thrown if an error occurred reading a geometry +
+ + + Reads a sequence of geometries.
+ If an is specified, geometries read up to the offset count are skipped. + If a is specified, no more than geometries are read. +
+ The path to the file + Thrown if no stream was passed + Thrown if passed stream is not readable or seekable + Thrown if an I/O exception was encountered + Thrown if an error occured reading a geometry +
+ + + Reads a sequence of geometries.
+ If an is specified, geometries read up to the offset count are skipped. + If a is specified, no more than geometries are read. +
+ The stream reader to use. + Thrown if an I/O exception was encountered + Thrown if an error occured reading a geometry +
+ + + Tests if reader has reached limit + + A collection of already read geometries + true if number of geometries has been read. + + + + Tests if reader is at EOF. + + + + + Converts a Well-Known Binary byte data to a Geometry. + + + This class reads the format describe in {@link WKBWriter}. + It partially handles theExtended WKB format used by PostGIS, + by parsing and storing optional SRID values. + If a SRID is not specified in an element geometry, it is inherited + from the parent's SRID. + The default SRID value depends on . + + Although not defined in the WKB spec, empty points + are handled if they are represented as a Point with NaN X and Y ordinates. + + The reader repairs structurally-invalid input + (specifically, LineStrings and LinearRings which contain + too few points have vertices added, + and non-closed rings are closed). + + The reader handles most errors caused by malformed or malicious WKB data. + It checks for obviously excessive values of the fields + numElems, numRings, and numCoords. + It also checks that the reader does not read beyond the end of the data supplied. + A is thrown if this situation is detected. + + + + + Converts a hexadecimal string to a byte array. + The hexadecimal digit symbols are case-insensitive. + + A string containing hex digits + An array of bytes with the value of the hex string + + + + Initialize reader with a standard . + + + + + Creates an instance of this class using the provided NtsGeometryServices + + + + + + Reads a in binary WKB format from an array of s. + + The byte array to read from + The geometry read + if the WKB data is ill-formed. + + + + Reads a in binary WKB format from an . + + The stream to read from + The geometry read + if the WKB data is ill-formed. + + + + WKB Coordinate Systems + + + + + 2D coordinate system + + + + + 3D coordinate system + + + + + 2D coordinate system with additional measure value + + + + + 3D coordinate system with additional measure value + + + + + + + + + + + + + + + + + + Function to read a coordinate sequence. + + The reader + The number of ordinates + The coordinate system + The read coordinate sequence. + + + + Function to read a coordinate sequence that is supposed to form a ring. + + The reader + The number of ordinates + The coordinate system + The read coordinate sequence. + + + + Function to read a coordinate sequence that is supposed to serve a line string. + + The reader + The number of ordinates + The coordinate system + The read coordinate sequence. + + + + Function to convert from to + + The coordinate system + The corresponding + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Reads a geometry. + + The reader + The coordinate system + The spatial reference id for the geometry. + A geometry + + + + Gets or sets a value indicating if a possibly encoded SRID value should be handled. + + + + + Gets a value indicating which ordinates can be handled. + + + + + Gets a value indicating which ordinates should be handled. + + + + + Gets or sets a value indicating if the reader should attempt to repair malformed input. + + + Malformed in this case means the ring has too few points (4), + or is not closed. + + + + + Gets or sets whether invalid linear rings should be fixed + + + + + Function to determine whether an ordinate should be handled or not. + + + + + + + Writes a Well-Known Binary byte data representation of a Geometry. + + + There are a few cases which are not specified in the standard. + The implementation uses a representation which is compatible with + other common spatial systems (notably, PostGIS). + + sare written as s. + Empty geometries are output as follows + + PointA WKBPoint with double.NaN ordinate values + LineStringA WKBLineString with zero points + Polygoncurrently output as a WKBPolygon with one LinearRing with zero points. + Note: This is different to other systems. It will change to a WKBPolygon with zero LinearRings. + Multi geometriesA WKBMulti with zero elements + GeometryCollectionA WKBGeometryCollection with zero elements + + + + This implementation supports the Extended WKB standard. + Extended WKB allows writing 3-dimensional coordinates + and the geometry SRID value. + The presence of 3D coordinates is indicated + by setting the high bit of the wkbType word. + The presence of a SRID is indicated + by setting the third bit of the wkbType word. + EWKB format is upward-compatible with the original SFS WKB format. + + SRID output is optimized, if specified. + The top-level geometry has the SRID included. Child geometries + have it included if their value differs from its parent. + + This class supports reuse of a single instance to read multiple + geometries. This class is not thread - safe; each thread should create its own + instance. + + + + Converts a byte array to a hexadecimal string. + A byte array + + + + Writes the WKB Header for the geometry + + The writer + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Gets or sets the binary encoding type + + + + + Standard byte size for each complex point. + Each complex point (LineString, Polygon, ...) contains: + 1 byte for ByteOrder and + 4 bytes for WKBType. + 4 bytes for SRID value + + + + + Calculates the number of bytes required to store (E)WKB Header information. + + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The size of the + + + + Initializes writer with LittleIndian byte order. + + + + + Initializes writer with the specified byte order. + + Encoding type + + + + Initializes writer with the specified byte order. + + Encoding type + SRID values, present or not, should be emitted. + + + + Initializes writer with the specified byte order. + + Encoding type + SRID values, present or not, should be emitted. + Z values, present or not, should be emitted + + + + Initializes writer with the specified byte order. + + Encoding type + SRID values, present or not, should be emitted. + Z values, present or not, should be emitted + M values, present or not, should be emitted + + + + Writes a WKB representation of a given point. + + + + + + + Writes a WKB representation of a given point. + + + + + + + + + + + + + + + + + + + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Writes the ByteOrder defined in . + + The writer to use + + + + Write a . + + The coordinate + The writer. + + + + Write a . + + The coordinate sequence to write + A flag indicating if the size of should be written, too. + The writer. + + + + Write a point in its WKB format + + The point + The writer + + + + Write a point in its WKB format + + The point + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a LineString in its WKB format + + The LineString + The writer + + + + Write a LineString in its WKB format + + The LineString + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write LinearRing information + + The linear ring + The writer + + + + Write a Polygon in its WKB format + + The Polygon + The writer + + + + Write a Polygon in its WKB format + + The Polygon + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a MultiPoint in its WKB format + + The MultiPoint + The writer + + + + Write a MultiPoint in its WKB format + + The MultiPoint + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a MultiLineString in its WKB format + + The MultiLineString + The writer + + + + Write a MultiLineString in its WKB format + + The MultiLineString + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a MultiPolygon in its WKB format + + The MultiPolygon + The writer + + + + Write a MultiPolygon in its WKB format + + The MultiPolygon + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Write a GeometryCollection in its WKB format + + The GeometryCollection + The writer + + + + Write a GeometryCollection in its WKB format + + The GeometryCollection + The writer + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + + + + Gets a buffer for the to write to. + + The geometry to write + A buffer + + + + Gets a buffer for the to write to. + + The geometry to write + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + A buffer + + + + Computes the length of a buffer to write in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + The number of bytes required to store in its WKB format. + + + + Computes the length of a buffer to write the in its WKB format. + + The geometry + + A flag indicting if SRID value is of possible interest. + The value is &&-combineed with HandleSRID. + + The number of bytes required to store in its WKB format. + + + + Gets a value whether or not EWKB featues may be used. + EWKB features are + + 0x80000000 flag if geometry's z-ordinate values are written + 0x40000000 flag if geometry's m-ordinate values are written + 0x20000000 flag if geometry's SRID value is written + + + + + Gets a value indicating if only original WKT elements should be handled + + + + + Gets or sets a value indicating if an encoded SRID value should be handled or ignored. + + + + + Gets the that this class can write. + + + + + Gets or sets the maximum to write out. + The default is equivalent to . + + + + The purpose of this property is to restrict what gets written out to ensure that, + e.g., Z values are never written out even if present on a geometry instance. Ordinates + that are not present on a geometry instance will be omitted regardless of this value. + + + Flags not present in are silently ignored. + + + and are always present. + + + + + + Constants used in the WKT (Well-Known Text) format. + + Martin Davis + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for geometries + + + + + Token text for empty geometries + + + + + Token text indicating that geometries have measure-ordinate values + + + + + Token text indicating that geometries have z-ordinate values + + + + + Token text indicating that geometries have both z- and measure-ordinate values + + + + + Reads a sequence of s in WKT format from a text file. + + The geometries in the file may be separated by any amount of whitespace and newlines. + + Martin Davis + + + + + Creates a new given the to read from and a to use to parse the geometries. + + the to read from + the geometry reader to use + + + + Creates a new , given the name of the file to read from. + + The name of the file to read from + The geometry reader to use + + + + Creates a new , given a to read from. + + The stream to read from + The geometry reader to use + + + + Creates a new , given a to read with. + + The stream reader of the file to read from + The geometry reader to use + + + + Gets/Sets the maximum number of geometries to read. + + + + + Gets/Sets allow ignoring WKT parse errors + after at least one geometry has been read, + to return a partial result. + + + + + Gets/Sets the number of geometries to skip before reading. + + + + + Reads a sequence of geometries. + + + + If an offset is specified, geometries read up to the offset count are skipped. + If a limit is specified, no more than geometries are read. + + Thrown if an I/O exception was encountered + Thrown if an error occurred reading a geometry + The list of geometries read + + + + Tests if reader is at EOF. + + + + + Converts a Well-Known Text string to a Geometry. + + The WKTReader allows + extracting Geometry objects from either input streams or + internal strings. This allows it to function as a parser to read Geometry + objects from text blocks embedded in other data formats (e.g. XML). + + The Well-known + Text format is defined in the + OpenGIS Simple Features Specification for SQL . + + As of version 2.0, NTS can read WKT syntax + which specifies coordinate dimension Z, M or ZM as modifiers(e.g.POINT Z) + or in the name of the geometry type(e.g.LINESTRINGZM). + If the coordinate dimension is specified it will be set in the created geometry. + If the coordinate dimension is not specified, the default behaviour is to + create XYZ geometry(this is backwards compatible with older JTS versions). + This can be altered to create XY geometry by + setting to false. + + NOTE: There is an inconsistency in the SFS. + The WKT grammar states that MultiPoints are represented by + MULTIPOINT ( ( x y), (x y) ), + but the examples show MultiPoints as MULTIPOINT ( x y, x y ). + Other implementations follow the latter syntax, so NTS will adopt it as well. + A WKTReader is parameterized by a GeometryFactory, + to allow it to create Geometry objects of the appropriate + implementation. In particular, the GeometryFactory will + determine the PrecisionModel and SRID that is used. + The WKTReader will convert the input numbers to the precise + internal representation. + + reads also non-standard tags. + + + + + + Creates a WKTReader that creates objects using a basic GeometryFactory. + + + + + Creates a WKTReader that creates objects using a basic GeometryFactory. + + + + + Creates a WKTReader that creates objects using the given + GeometryFactory. + + The factory used to create Geometrys. + + + + Gets or sets a value indicating whether or not coordinates may have 3 ordinate values + even though no Z or M ordinate indicator is present. The default value is + . + + + + + Gets or sets a value indicating whether or not point coordinates in a MultiPoint + geometry must not be enclosed in paren. The default value is . + + + + + Gets or sets the factory to create geometries + + + + + Gets or sets the default SRID + + + + + Gets or sets a value indicating if the reader should attempt to repair malformed input. + + + Malformed in this case means the ring has too few points (4), + or is not closed. + + + + + Converts a Well-known Text representation to a Geometry. + + + one or more Geometry Tagged Text strings (see the OpenGIS + Simple Features Specification) separated by whitespace. + + + A Geometry specified by wellKnownText + + + + + Converts a Well-known Text representation to a Geometry. + + + one or more Geometry Tagged Text strings (see the OpenGIS + Simple Features Specification) separated by whitespace. + + + A Geometry specified by wellKnownText + + + + + Converts a Well-known Text representation to a Geometry. + + + A Reader which will return a "Geometry Tagged Text" + string (see the OpenGIS Simple Features Specification). + + A Geometry read from reader. + + + + + Reads a Coordinate from a stream using the given . + + All ordinate values are read, but -depending on the + of the underlying - not necessarily all can be handled. + Those are silently dropped. + + + A geometry factory + the tokenizer to use. + a bit-mask defining the ordinates to read. + a value indicating if a starting "(" should be probed. + a of length 1 containing the read ordinate values. + if an I/O error occurs. + if an unexpected token was encountered. + + + + Reads a Coordinate from a stream using the given . + + All ordinate values are read, but -depending on the + of the underlying - not necessarily all can be handled. + Those are silently dropped. + + + A geometry factory + the tokenizer to use. + a bit-mask defining the ordinates to read. + a of length 1 containing the read ordinate values. + if an I/O error occurs. + if an unexpected token was encountered. + + + + Reads a CoordinateSequence from a stream using the given + for an old-style JTS MultiPoint (Point coordinates not enclosed in parentheses). + + All ordinate values are read, but -depending on the + of the underlying - not necessarily all can be handled. + Those are silently dropped. + + + A geometry factory + the tokenizer to use. + a bit-mask defining the ordinates to read. + a of length 1 containing the read ordinate values. + if an I/O error occurs. + if an unexpected token was encountered. + + + + Computes the required dimension based on the given ordinate bit-mask. + It is assumed that is set. + + the ordinate bit-mask. + the number of dimensions required to store ordinates for the given bit-mask. + + + + Merges an array of one-coordinate-s into one + . + + A geometry factory + an array of coordinate sequences. Each sequence contains exactly one coordinate. + a bit-mask of required ordinates. + a coordinate sequence containing all coordinate. + + + + + + + + + + + + + + + + + + Returns the next number in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be a number. + + The next number in the stream. + if the next token is not a valid number + + + + Returns the next WKTConstants.EMPTY or "(" in the stream as uppercase text. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be or "(". + + + The next WKTConstants.EMPTY or "(" in the stream as uppercase text. + + + + Returns the next ordinate flag information in the stream as uppercase text. + This can be Z, M or ZM. + + tokenizer over a stream of text in Well-known Text + the next ordinate flags. + if an I/O error occurs + if the next token is not EMPTY or L_PAREN + + + + Returns the next word in the stream. + + tokenizer over a stream of text in Well-known Text format. The next token must be a word. + the next word in the stream as uppercase text + if the next token is not a word + if an I/O error occurs + + + + Returns the next ")" or "," in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be ")" or ",". + + + The next ")" or "," in the stream. + + + + Returns the next ")" in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be ")". + + + The next ")" in the stream. + + + + Returns the next word in the stream as uppercase text. + + + Tokenizer over a stream of text in Well-known Text + format. The next token must be a word. + + + to advance the stream, to just peek. + + The next word in the stream as uppercase text. + + + + Creates a Geometry using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <Geometry Tagged Text. + + A Geometry specified by the next token + in the stream. + + + + Creates a Point using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <Point Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + A Point specified by the next token in + the stream. + + + + Creates a LineString using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <LineString Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A LineString specified by the next + token in the stream. + + + + Creates a LinearRing using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <LineString Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + A LinearRing specified by the next + token in the stream. + + + + Creates a MultiPoint using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <MultiPoint Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A MultiPoint specified by the next + token in the stream. + + + + Creates a Polygon using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a Polygon Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A Polygon specified by the next token + in the stream. + + + + + Creates a MultiLineString using the next token in the stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a MultiLineString Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A MultiLineString specified by the + next token in the stream. + + + + Creates a MultiPolygon using the next token in the stream. + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a MultiPolygon Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A MultiPolygon specified by the next + token in the stream, or if if the coordinates used to create the + Polygon shells and holes do not form closed linestrings. + + + + Creates a GeometryCollection using the next token in the + stream. + + + Tokenizer over a stream of text in Well-known Text + format. The next tokens must form a <GeometryCollection Text. + + The factory to create the geometry + A flag indicating the ordinates to expect. + + A GeometryCollection specified by the + next token in the stream. + + + + Outputs the textual representation of a . + The outputs coordinates rounded to the precision + model. No more than the maximum number of necessary decimal places will be + output. + The Well-known Text format is defined in the OpenGIS Simple Features + Specification for SQL. + A non-standard "LINEARRING" tag is used for LinearRings. The WKT spec does + not define a special tag for LinearRings. The standard tag to use is + "LINESTRING". + + + + + Generates the WKT for a Point specified by a . + + The point coordinate. + The WKT + + + + Generates the WKT for a N-point LineString specified by a . + + The sequence to write. + The WKT + + + + Generates the WKT for a LINESTRING specified by an array of s. + + An array of coordinates + The WKT + + + + Generates the WKT for a LineString specified by two s. + + The first coordinate. + The second coordinate. + The WKT + + + + Creates the NumberFormatInfo used to write doubles + with a sufficient number of decimal places. + + + The PrecisionModel used to determine + the number of decimal places to write. + + + A NumberFormatInfo that write doubles + without scientific notation. + + + + + A filter implementation to test if a coordinate sequence actually has meaningful values + for an ordinate bit-pattern + + + + + Initializes a new instance of the flag. + + + The index for the ordinates to test. + + + if implies + , otherwise. + + + + + + + + + + + + + + Gets the evaluated ordinate bit-pattern of ordinates with valid values masked by + . + + + + + Creates an instance of this class which is writing at most 2 dimensions. + + + + + Creates an instance of this class which is writing at most dimensions. + + + + + Gets/sets whether the output will be formatted + + + + + Gets/sets the maximum number of coordinates per line written in formatted output. + + If the provided coordinate number is < 0, coordinates will be written all on one line. + + + Gets/sets the tab size to use for indenting. + If the size is non-positive + + + + Gets or sets the to be written. Possible members are: + + + + + + + Values of and are always assumed and + not particularly checked for. + + + + + Gets or sets a that should be used on the ordinates written. + + If none/ is assigned, the precision model of the + is used. + + + Note: The precision model is applied to all ordinate values, not just x and y. + + + + + + Creates a new instance of the class suitable for MSSQL's non- + standard WKT format. + + + A new instance of the class suitable for MSSQL's non-standard + WKT format. + + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process. + A Geometry Tagged Text string (see the OpenGIS Simple Features Specification). + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process. + A Stream to write into + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process. + + A "Geometry Tagged Text" string (see the OpenGIS Simple Features Specification) + + + + Same as write, but with newlines and spaces to make the + well-known text more readable. + + A Geometry to process + + A "Geometry Tagged Text" string (see the OpenGIS Simple + Features Specification), with newlines and spaces. + + + + + Same as write, but with newlines and spaces to make the + well-known text more readable. + + A Geometry to process + + + A Geometry Tagged Text string (see the OpenGIS Simple + Features Specification), with newlines and spaces. + + + + + Converts a Geometry to its Well-known Text representation. + + A Geometry to process + A flag indicating that the output should be formatted. + the output writer to append to. + The precision model to use. + + A "Geometry Tagged Text" string (see the OpenGIS Simple + Features Specification). + + + + + Converts a to <Geometry Tagged Text> format, then appends + it to the writer. + + the to process. + A flag indicating that the output should be formatted. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a to <Geometry Tagged Text> format, then appends + it to the writer. + + the to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted. + The indentation level + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a Coordinate to Point Tagged Text format, + then appends it to the writer. + + The Point to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a LineString to <LineString Tagged Text + format, then appends it to the writer. + + The LineString to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a LinearRing to <LinearRing Tagged Text + format, then appends it to the writer. + + The LinearRing to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a Polygon to Polygon Tagged Text format, + then appends it to the writer. + + The Polygon to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPoint to <MultiPoint Tagged Text + format, then appends it to the writer. + + The MultiPoint to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiLineString to MultiLineString Tagged + Text format, then appends it to the writer. + + The MultiLineString to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPolygon to MultiPolygon Tagged Text + format, then appends it to the writer. + + The MultiPolygon to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Converts a GeometryCollection to GeometryCollection + Tagged Text format, then appends it to the writer. + + The GeometryCollection to process. + A bit-pattern of ordinates to write. + flag indicating that the output should be formatted + the indentation level + The output writer to append to. + The format to use for writing ordinate values. + + + + Appends the i'th coordinate from the sequence to the writer + + If the has coordinates that are NaN, + these are not written, even though suggests this. + + + the to process + A bit pattern of output ordinates + the index of the coordinate to write + writer the output writer to append to + The format to use for writing ordinate values + + + + + Converts a to a . + + The to convert. + A + + The as a . + + + + + Appends additional ordinate information. This function may + + + + append 'Z' if in the value is included. + + + + + append 'M' if in the value is included. + + + + + append 'ZM' if in the and + values are included. + + + + + A bit-pattern of ordinates to write. + the output writer to append to. + if an error occurs while using the writer. + + + + Appends all members of a to the stream. Each + is separated from another using a colon, the ordinates of a + are separated by a space. + + the to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + flag indicating that the first of the sequence should be indented for better visibility. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a Polygon to Polygon Text format, then + appends it to the writer. + + The Polygon to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + flag indicating that the first of the sequence should be indented for better visibility. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPoint to <MultiPoint Text format, then + appends it to the writer. + + The MultiPoint to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiLineString to <MultiLineString Text + format, then appends it to the writer. + + The MultiLineString to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a MultiPolygon to <MultiPolygon Text format, + then appends it to the writer. + + The MultiPolygon to process. + A bit-pattern of ordinates to write. + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Converts a GeometryCollection to GeometryCollectionText + format, then appends it to the writer. + + The GeometryCollection to process. + + flag indicating that. + the indentation level. + the output writer to append to. + The format to use for writing ordinate values. + + + + Extracts the subline of a linear between + two s on the line. + + + + + Computes the subline of a between + two s on the line. + If the start location is after the end location, + the computed linear geometry has reverse orientation to the input line. + + The line to use as the baseline. + The start location. + The end location. + The extracted subline. + + + + Initializes a new instance of the class. + + + + + + Extracts a subline of the input. + If is minor that , + the linear geometry computed will be reversed. + + The start location. + The end location. + A linear geometry. + + + + + + + + + + + Assumes input is valid + (e.g. minor or equals to ). + + + + + + + + Supports linear referencing along a linear + using the length along the line as the index. + Negative length values are taken as measured in the reverse direction + from the end of the geometry. + Out-of-range index values are handled by clamping + them to the valid range of values. + Non-simple lines (i.e. which loop back to cross or touch + themselves) are supported. + + + + + Constructs an object which allows a linear + to be linearly referenced using length as an index. + + The linear geometry to reference along. + + + + Computes the for the point + on the line at the given index. + If the index is out of range the first or last point on the + line will be returned. + + + The Z-ordinate of the computed point will be interpolated from + the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point. + The at the given index. + + + + Computes the for the point on the line at the given index, offset by the given distance. + + + If the index is out of range the first or last point on the line will be returned. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point + The distance the point is offset from the segment (positive is to the left, negative is to the right) + The Coordinate at the given index + + + + Computes the for the interval + on the line between the given indices. + If the lies before the , + the computed geometry is reversed. + + + + + + + + + + + + + + + Computes the minimum index for a point on the line. + If the line is not simple (i.e. loops back on itself) + a single point may have more than one possible index. + In this case, the smallest index is returned. + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + A point on the line. + The minimum index of the point. + + + + + Finds the index for a point on the line + which is greater than the given index. + If no such index exists, returns . + This method can be used to determine all indexes for + a point which occurs more than once on a non-simple line. + It can also be used to disambiguate cases where the given point lies + slightly off the line and is equidistant from two different + points on the line. + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + A point on the line. + The value the returned index must be greater than. + The index of the point greater than the given minimum index. + + + + + Computes the indices for a subline of the line. + (The subline must conform to the line; that is, + all vertices in the subline (except possibly the first and last) + must be vertices of the line and occur in the same order). + + A subLine of the line. + A pair of indices for the start and end of the subline.. + + + + Computes the index for the closest point on the line to the given point. + If more than one point has the closest distance the first one along the line is returned. + (The point does not necessarily have to lie precisely on the line.) + + + + + + + Returns the index of the start of the line. + + + + + Returns the index of the end of the line. + + + + + Tests whether an index is in the valid index range for the line. + + The index to test. + true if the index is in the valid range. + + + + Computes a valid index for this line + by clamping the given index to the valid range of index values + + A valid index value + + + + + + + + + Initializes a new instance of the class. + + A linear geometry. + + + + Find the nearest location along a linear to a given point. + + The coordinate to locate. + The location of the nearest point. + + + + Finds the nearest index along the linear + to a given after the specified minimum index. + If possible the location returned will be strictly + greater than the . + If this is not possible, the value returned + will equal . + (An example where this is not possible is when + = [end of line] ). + + The coordinate to locate. + The minimum location for the point location. + The location of the nearest point. + + + + + + + + + + + + + + + + + + + + + Computes the for a given length + along a linear + Negative lengths are measured in reverse from end of the linear geometry. + Out-of-range values are clamped. + + + + + Computes the for a + given length along a linear . + + The linear geometry to use. + The length index of the location. + The for the length. + + + + Computes the for a + given length along a linear , + with control over how the location + is resolved at component endpoints. + + The linear geometry to use + The length index of the location + If true lengths are resolved to the lowest possible index + + + + Computes the length for a given + on a linear . + + The linear geometry to use. + The index of the location. + The length for the . + + + + Initializes a new instance of the class. + + A linear geometry. + + + + Compute the corresponding to a length. + Negative lengths are measured in reverse from end of the linear geometry. + Out-of-range values are clamped. + Ambiguous indexes are resolved to the lowest possible location value. + + The length index. + The corresponding . + + + + Compute the corresponding to a length. + Negative lengths are measured in reverse from end of the linear geometry. + Out-of-range values are clamped. + Ambiguous indexes are resolved to the lowest or highest possible location value, + depending on the value of resolveLower + + The length index + + The corresponding . + + + + + + + + + + + + + + + + + + Builds a linear geometry ( or ) + incrementally (point-by-point). + + + + + Creates an instance of this class. + + The geometry factory to use. + + + + Allows invalid lines to be fixed rather than causing Exceptions. + An invalid line is one which has only one unique point. + + + + + Allows invalid lines to be ignored rather than causing Exceptions. + An invalid line is one which has only one unique point. + + + + + Adds a point to the current line. + + The to add. + + + + Adds a point to the current line. + + The to add. + If true, allows the insertions of repeated points. + + + + + + + + + Terminate the current . + + + + + + + + + + + + Builds and returns the . + + + + + + An iterator over the components and coordinates of a linear geometry + (s and s. + + + + + + + + + + + + Invariant: currentLine <> null if the iterator is pointing at a valid coordinate + + + + + Creates an iterator initialized to the start of a linear . + + The linear geometry to iterate over. + if is not + + + + Creates an iterator starting at a on a linear . + + The linear geometry to iterate over. + The location to start at. + if is not + + + + Creates an iterator starting at + a component and vertex in a linear . + + The linear geometry to iterate over. + The component to start at. + The vertex to start at. + if is not + + + + + + + + + Tests whether there are any vertices left to iterator over. + Specifically, HasNext() returns true if the + current state of the iterator represents a valid location + on the linear geometry. + + true if there are more vertices to scan. + + + + Jump to the next element of the iteration. + + + + + Checks whether the iterator cursor is pointing to the + endpoint of a component . + + + + + The component index of the vertex the iterator is currently at. + + + + + The vertex index of the vertex the iterator is currently at. + + + + + Gets the component the iterator is current at. + + + + + Gets the first of the current segment + (the coordinate of the current vertex). + + + + + Gets the second of the current segment + (the coordinate of the next vertex). + If the iterator is at the end of a line, null is returned. + + + + + Represents a location along a or .
+ The referenced geometry is not maintained within this location, + but must be provided for operations which require it. + Various methods are provided to manipulate the location value + and query the geometry it references. +
+
+ + + Gets a location which refers to the end of a linear . + + The linear geometry. + A new LinearLocation. + + + + Computes the of a point a given fraction + along the line segment (p0, p1). + + + + If the fraction is greater than 1.0 the last + point of the segment is returned. + If the fraction is less than or equal to 0.0 the first point + of the segment is returned. + + The Z ordinate is interpolated from the Z-ordinates of the given points, + if they are specified. + + The first point of the line segment. + The last point of the line segment. + The length to the desired point. + + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + Index of the segment. + The segment fraction. + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + Index of the component. + Index of the segment. + The segment fraction. + + + + Initializes a new instance of the class: + creates a location referring to the start of a linear geometry. + + Index of the component. + Index of the segment. + The segment fraction. + If true, ensures the individual values are locally valid. + + + + Creates a new location equal to a given one. + + A linear location + + + + Ensures the individual values are locally valid. + Does not ensure that the indexes are valid for + a particular linear geometry. + + + + + Ensures the indexes are valid for a given linear . + + A linear geometry. + + + + Snaps the value of this location to + the nearest vertex on the given linear , + if the vertex is closer than . + + A linear geometry. + The minimum allowable distance to a vertex. + + + + Gets the length of the segment in the given + Geometry containing this location. + + A linear geometry. + The length of the segment. + + + + Sets the value of this location to + refer to the end of a linear geometry. + + The linear geometry to use to set the end. + + + + Gets the component index for this location. + + + + + Gets the segment index for this location. + + + + + Gets the segment fraction for this location. + + + + + Tests whether this location refers to a vertex: + returns true if the location is a vertex. + + + + + Gets the along the + given linear which is + referenced by this location. + + A linear geometry. + The at the location. + + + + Gets a representing the segment of the given linear which contains this location. + + A linear geometry + the LineSegment containing the location + + + + Tests whether this location refers to a valid + location on the given linear . + + A linear geometry. + true if this location is valid. + + + + Compares the current instance with another object of the same type. + + + The LineStringLocation with which this + Coordinate is being compared. + + + A negative integer, zero, or a positive integer as this + LineStringLocation is less than, equal to, + or greater than the specified LineStringLocation. + + + is not the same type as this instance. + + + + + Compares the current instance with another object of the same type. + + + The LineStringLocation with which this + Coordinate is being compared. + + + A negative integer, zero, or a positive integer as this + LineStringLocation is less than, equal to, + or greater than the specified LineStringLocation. + + + + + Compares this object with the specified index values for order. + + The component index. + The segment index. + The segment fraction. + + A negative integer, zero, or a positive integer as this LineStringLocation + is less than, equal to, or greater than the specified locationValues. + + + + + Compares two sets of location values for order. + + The first component index. + The first segment index. + The first segment fraction. + The second component index. + The second segment index. + The second segment fraction. + + A negative integer, zero, or a positive integer + as the first set of location values is less than, equal to, + or greater than the second set of locationValues. + + + + + Tests whether two locations are on the same segment in the parent . + + A location on the same geometry + true if the locations are on the same segment of the parent geometry + + + + Tests whether this location is an endpoint of + the linear component it refers to. + + The linear geometry referenced by this location + True if the location is a component endpoint + + + + Converts a linear location to the lowest equivalent location index. + The lowest index has the lowest possible component and segment indices. + Specifically: + * if the location point is an endpoint, a location value is returned as (nseg-1, 1.0) + * if the location point is ambiguous (i.e. an endpoint and a startpoint), the lowest endpoint location is returned + If the location index is already the lowest possible value, the original location is returned. + + The linear geometry referenced by this location. + The lowest equivalent location. + + + + + + + Gets the count of the number of line segments + in a . + This is one less than the number of coordinates. + + A LineString + The number of segments + + + + Supports linear referencing along a linear + using s as the index. + + + + + Constructs an object which allows linear referencing along + a given linear . + + The linear geometry to reference alo + + + + Computes the for the point on the line at the given index. + If the is out of range, + the first or last point on the line will be returned. + + + The Z-ordinate of the computed point will be interpolated from + the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point. + The at the given index. + + + + Computes the for the point + on the line at the given index, offset by the given distance. + If the index is out of range the first or last point on the + line will be returned. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + The Z-ordinate of the computed point will be interpolated from + the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point + The distance the point is offset from the segment + (positive is to the left, negative is to the right) + The Coordinate at the given index + + + + Computes the for the point on the line at the given index, offset by the given distance. + + + If the index is out of range the first or last point on the line will be returned. + The computed point is offset to the left of the line if the offset distance is + positive, to the right if negative. + The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist. + + The index of the desired point + The distance the point is offset from the segment (positive is to the left, negative is to the right) + The Coordinate at the given index + + + + Computes the for the interval + on the line between the given indices. + If the start location is after the end location, + the computed linear geometry has reverse orientation to the input line. + + The index of the start of the interval. + The index of the end of the interval. + The linear interval between the indices. + + + + Computes the index for a given point on the line. + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + A point on the line. + The index of the point. + + + + + Computes the indices for a subline of the line. + (The subline must conform to the line; that is, + all vertices in the subline (except possibly the first and last) + must be vertices of the line and occur in the same order). + + A subLine of the line. + A pair of indices for the start and end of the subline. + + + + Finds the index for a point on the line which is greater than the given index. + If no such index exists, returns . + + + + This method can be used to determine all indexes for + a point which occurs more than once on a non-simple line. + It can also be used to disambiguate cases where the given point lies + slightly off the line and is equidistant from two different + points on the line. + + + The supplied point does not necessarily have to lie precisely + on the line, but if it is far from the line the accuracy and + performance of this function is not guaranteed. + Use to compute a guaranteed result for points + which may be far from the line. + + + A point on the line + The value the returned index must be greater than + The index of the point greater than the given minimum index + + + + + Computes the index for the closest point on the line to the given point. + If more than one point has the closest distance the first one along the line is returned. + (The point does not necessarily have to lie precisely on the line.) + + A point on the line. + The index of the point. + + + + Returns the index of the start of the line. + + + + + Returns the index of the end of the line. + + + + + Tests whether an index is in the valid index range for the line. + + The index to test. + true if the index is in the valid range. + + + + Computes a valid index for this line by clamping + the given index to the valid range of index values. + + + A valid index value. + + + + Determines the location of a subline along a linear . + The location is reported as a pair of s. + NOTE: Currently this algorithm is not guaranteed to + return the correct substring in some situations where + an endpoint of the test line occurs more than once in the input line. + (However, the common case of a ring is always handled correctly). + + + + + + + + + + + + + Initializes a new instance of the class. + + The linear geom. + + + + + + + + + + + Computes the of the point + on a linear nearest a given . + The nearest point is not necessarily unique; this class + always computes the nearest point closest + to the start of the geometry. + + + + + + + + + + + + + Initializes a new instance of the class. + + A linear geometry. + + + + Find the nearest location along a linear to a given point. + + The coordinate to locate. + The location of the nearest point. + + + + Find the nearest along the linear + to a given after the specified minimum . + If possible the location returned will be strictly greater than the . + If this is not possible, the value returned will equal . + (An example where this is not possible is when = [end of line] ). + + The coordinate to locate. + The minimum location for the point location. + The location of the nearest point. + + + + Implements extended-precision floating-point numbers + which maintain 106 bits (approximately 30 decimal digits) of precision. + + A DoubleDouble uses a representation containing two double-precision values. + A number x is represented as a pair of doubles, x.hi and x.lo, + such that the number represented by x is x.hi + x.lo, where +
+                |x.lo| <= 0.5*ulp(x.hi)
+            
+ and ulp(y) means "unit in the last place of y". + The basic arithmetic operations are implemented using + convenient properties of IEEE-754 floating-point arithmetic. + + The range of values which can be represented is the same as in IEEE-754. + The precision of the representable numbers + is twice as great as IEEE-754 double precision. + + The correctness of the arithmetic algorithms relies on operations + being performed with standard IEEE-754 double precision and rounding. + This is the Java standard arithmetic model, but for performance reasons + Java implementations are not + constrained to using this standard by default. + Some processors (notably the Intel Pentium architecture) perform + floating point operations in (non-IEEE-754-standard) extended-precision. + A JVM implementation may choose to use the non-standard extended-precision + as its default arithmetic mode. + To prevent this from happening, this code uses the + Java strictfp modifier, + which forces all operations to take place in the standard IEEE-754 rounding model. + + The API provides both a set of value-oriented operations + and a set of mutating operations. + Value-oriented operations treat DoubleDouble values as + immutable; operations on them return new objects carrying the result + of the operation. This provides a simple and safe semantics for + writing DoubleDouble expressions. However, there is a performance + penalty for the object allocations required. + The mutable interface updates object values in-place. + It provides optimum memory performance, but requires + care to ensure that aliasing errors are not created + and constant values are not changed. + + This implementation uses algorithms originally designed variously by + Knuth, Kahan, Dekker, and Linnainmaa. + Douglas Priest developed the first C implementation of these techniques. + Other more recent C++ implementation are due to Keith M. Briggs and David Bailey et al. +

References

+ + Priest, D., Algorithms for Arbitrary Precision Floating Point Arithmetic, + in P. Kornerup and D. Matula, Eds., Proc. 10th Symposium on Computer Arithmetic, + IEEE Computer Society Press, Los Alamitos, Calif., 1991. + Yozo Hida, Xiaoye S. Li and David H. Bailey, + Quad-Double Arithmetic: Algorithms, Implementation, and Application, + manuscript, Oct 2000; Lawrence Berkeley National Laboratory Report BNL-46996. + David Bailey, High Precision Software Directory; + http://crd.lbl.gov/~dhbailey/mpdist/index.html + +
+ Martin Davis +
+ + The value nearest to the constant Pi. + + + The value nearest to the constant 2 * Pi. + + + The value nearest to the constant Pi / 2. + + + + The value nearest to the constant e (the natural logarithm base). + + + + + A value representing the result of an operation which does not return a valid number. + + + + + The smallest representable relative difference between two values + + + + + Converts the string argument to a DoubleDouble number. + + A string containing a representation of a numeric value + The extended precision version of the value + Thrown if is not a valid representation of a number + + + + Operator to parse a DoubleDouble from a string + + The DoubleDouble string + + + + Converts the double argument to a DoubleDouble number. + + A numeric value + The extended precision version of the value + + + + Operator to convert the double value to a DoubleDouble value. + + The DoubleDouble string + + + + The value to split a double-precision value on during multiplication + + + + + The high-order component of the double-double precision value. + + + + + The low-order component of the double-double precision value. + + + + + Creates a new with value x. + + The initial value + + + + Creates a new with value (hi, lo). + + The high order component + The low order component + + + + Creates a with a value equal to the argument + + The initial value + + + + Creates a new with value equal to the argument. + + The value to initialize by + if is not a valid representation of a number + + + + Creates a new with the value of the argument. + + The value to copy + A copy of + + + + Creates and returns a copy of this value. + + A copy of this value + + + + Returns the sum of and . + + The left hand side + The right hand side + The sum of and + + + + Returns the sum of and . + + The left hand side + The right hand side + The sum of and + + + + Returns the difference of and . + + The left hand side + The right hand side + The difference of and + + + + Returns the difference of and . + + The left hand side + The right hand side + The difference of and + + + + Subtracts the argument from the value of this. + + The subtrahend + The result of this - y + + + + Multiplies by . + + A DoubleDouble value. + A double value. + The result of the multiplication. + + + + Multiplies by . + + A DoubleDouble value. + A DoubleDouble value. + The result of the multiplication. + + + + Divides by . + + A DoubleDouble numerator. + A double divisor. + The result of the division. + + + + Divides by . + + A DoubleDouble numerator. + A DoubleDouble divisor. + The result of the division. + + + + Returns a whose value is 1 / this. + + The reciprocal of this value + + + + Computes the determinant of the 2x2 matrix with the given entries. + + A matrix entry + A matrix entry + A matrix entry + A matrix entry + The determinant of the matrix of values + + + + Computes the determinant of the 2x2 matrix with the given entries. + + A matrix entry + A matrix entry + A matrix entry + A matrix entry + The determinant of the matrix of values + + + + Computes the minimum of this and another DD number. + + A DD number + The minimum of the two numbers + + + + Computes the maximum of this and another DD number. + + A DD number + The maximum of the two numbers + + + + Returns the largest (closest to positive infinity) + value that is not greater than the argument + and is equal to a mathematical integer. + Special cases: + + If this value is NaN, returns NaN. + + + The largest (closest to positive infinity) + value that is not greater than the argument + and is equal to a mathematical integer. + + + + + Returns the smallest (closest to negative infinity) value + that is not less than the argument and is equal to a mathematical integer. + Special cases: + + If this value is NaN, returns NaN. + + + + The smallest (closest to negative infinity) value + that is not less than the argument and is equal to a mathematical integer. + + + + + Returns an integer indicating the sign of this value. + + + if this value is > 0, returns 1 + if this value is < 0, returns -1 + if this value is = 0, returns 0 + if this value is NaN, returns 0 + + + + An integer indicating the sign of this value + + + + Rounds this value to the nearest integer. + The value is rounded to an integer by adding 1/2 and taking the floor of the result. + Special cases: + + If this value is NaN, returns NaN. + + + This value rounded to the nearest integer + + + + Returns the integer which is largest in absolute value and not further + from zero than this value. + + Special cases: + + If this value is NaN, returns NaN. + + + + The integer which is largest in absolute value and not further from zero than this value + + + + + Returns the absolute value of this value. + + Special cases: + + if this value is NaN, it is returned. + + + The absolute value of this value + + + + Computes the square of this value. + + The square of this value + + + + Computes the square of this value. + + The square of this value. + + + + Computes the positive square root of this value. + If the number is NaN or negative, NaN is returned. + + If this is NaN or less than zero, the result is NaN. + + + + Computes the positive square root of a DoubleDouble value. + If the number is NaN or negative, NaN is returned. + + A numeric value + the positive square root of this number. + If the argument is NaN or less than zero, the result is NaN. + + + + Computes the value of this number raised to an integral power. + Follows semantics of .Net Math.Pow as closely as possible. + + The integer exponent + x raised to the integral power exp + + + + Converts this value to the nearest number. + + The nearest value + + + + Converts this value to the nearest value. + + The nearest value + + + + Gets a value indicating whether this object is zero (0) or not + + + + + Gets a value indicating whether this object is negative or not + + + + + Gets a value indicating whether this object is positive or not + + + + + Gets a value indicating whether this object is positive or not + + + + + Checks if is infinity. + + A DoubleDouble value + true if value is infinity. + + + + Tests whether this value is equal to another DoubleDouble value. + + A DoubleDouble value + true if this value == . + + + + Equality operator for DoubleDouble values + + A DoubleDouble value + A DoubleDouble value + true if == . + + + + Inequality operator for DoubleDouble values + + A DoubleDouble value + A DoubleDouble value + true if != . + + + + Tests whether this value is greater than another DoubleDouble value. + + A DoubleDouble value + true if this value > . + + + + Tests whether this value is greater than or equals to another DoubleDouble value. + + A DoubleDouble value + true if this value >= . + + + + Tests whether this value is less than another DoubleDouble value. + + A DoubleDouble value + true if this value is < + + + + Tests whether this value is less than or equal to another DoubleDouble value. + + A DoubleDouble + true if this value is <= + + + + Compares two DoubleDouble objects numerically. + + An other DoubleDouble value + + -1,0 or 1 depending on whether this value is less than, equal to + or greater than the value of + + + + + + + Dumps the components of this number to a string. + + A string showing the components of the number + + + + Returns a string representation of this number, in either standard or scientific notation. + If the magnitude of the number is in the range [ 10-3, 108 ] + standard notation will be used. Otherwise, scientific notation will be used. + + A string representation of this number + + + + Returns the string representation of this value in standard notation. + + The string representation in standard notation + + + + Returns the string representation of this value in scientific notation. + + The string representation in scientific notation + + + + Extracts the significant digits in the decimal representation of the argument. + A decimal point may be optionally inserted in the string of digits + (as long as its position lies within the extracted digits + - if not, the caller must prepend or append the appropriate zeroes and decimal point). + + + + The string containing the significant digits and possibly a decimal point + + + + Returns the string for this value if it has a known representation (e.g. NaN or 0.0). + + The string for this special number
+ or null if the number is not a special number
+
+ + + Determines the decimal magnitude of a number. + The magnitude is the exponent of the greatest power of 10 which is less than + or equal to the number. + + The number to find the magnitude of + The decimal magnitude of + + + + Converts a string representation of a real number into a DoubleDouble value. + The format accepted is similar to the standard Java real number syntax. + It is defined by the following regular expression: +
+            [+|-] {digit} [ . {digit} ] [ ( e | E ) [+|-] {digit}+
+            
+
+ The string to parse + The value of the parsed number + Thrown if str is not a valid representation of a number +
+ + + + + + + + + Various utility functions for mathematical and numerical operations. + + + + + Clamps a double value to a given range. + + The value to clamp + The minimum value of the range + The maximum value of the range + The clamped value + + + + Clamps a int value to a given range. + + The value to clamp + The minimum value of the range + The maximum value of the range + The clamped value + + + + Clamps an integer to a given maximum limit. + + The value to clamp + The maximum value of the range + The clamped value + + + + Computes the ceiling function of the dividend of two integers. + + The numerator + The denominator + The ceiling of num / denom + + + + Computes the base-10 logarithm of a double value. + + + If the argument is NaN or less than zero, then the result is NaN. + If the argument is positive infinity, then the result is positive infinity. + If the argument is positive zero or negative zero, then the result is negative infinity. + + + + A positive number + The value log a, the base-10 logarithm of the input value + + + + Computes an index which wraps around a given maximum value. + For values >= 0, this is equals to val % max. + For values < 0, this is equal to max - (-val) % max + + The index to wrap + The maximum value (or modulus) + The wrapped index + + + + Computes the average of two numbers. + + A number + A number + The average of the inputs + + + + Computes the maximum fo three values + + A number + A number + A number + The maximum value of , and + + + + Computes the maximum of four values + + A number + A number + A number + A number + The maximum value of , , and + + + + Computes the minimum of four values + + A number + A number + A number + The minimum value of , and + + + + Computes the minimum of four values + + A number + A number + A number + A number + The minimum value of , , and + + + The inverse of the Golden Ratio phi. + + + + + + Implements some 2D matrix operations + (in particular, solving systems of linear equations). + + Martin Davis + + + + Solves a system of equations using Gaussian Elimination. + In order to avoid overhead the algorithm runs in-place + on - if should not be modified the client must supply a copy. + + An nxn matrix in row/column order )modified by this method) + A vector of length n + A vector containing the solution (if any)
or null if the system has no or no unique solution +
+ If the matrix has the wrong size +
+ + + Enumeration for the 3 coordinate planes + + + + + Models a plane in 3-dimensional Cartesian space. + + Martin Davis + + + + Computes the oriented distance from a point to the plane.
+ The distance is: + + positive if the point lies above the plane (relative to the plane normal) + zero if the point is on the plane + negative if the point lies below the plane (relative to the plane normal) + +
+ The point to compute the distance for + The oriented distance to the plane +
+ + + Computes the axis plane that this plane lies closest to. + + Geometries lying in this plane undergo least distortion + (and have maximum area) + when projected to the closest axis plane. + This provides optimal conditioning for + computing a Point-in-Polygon test. + + The index of the closest axis plane + + + + A 2-dimensional mathematical vector represented by double-precision X and Y components. + + mbdavis + + + + Creates a new vector with all components set to Zero + + + + + Creates a new vector with given X and Y components. + + The x component + The y component + A new vector + + + + Creates a new vector from an existing one. + + The vector to copy + A new vector + + + + Creates a vector from a . + + The coordinate to copy + A new vector + + + Creates a vector with the direction and magnitude + of the difference between the + and s. + + The origin coordinate + The destination coordinate + A new vector + + + The X component of this vector + + + The Y component of this vector. + + + + Creates an new vector instance + + + + + Creates a new vector instance using the provided and ordinates + + The x-ordinate value + The y-ordinate value + + + + Creates a new vector instance based on . + + The vector + + + Creates a new vector with the direction and magnitude + of the difference between the + and s. + + The origin coordinate + The destination coordinate + + + + Creates a vector from a . + + The coordinate + A new vector + + + + Gets the x-ordinate value + + + + + Gets the y-ordinate value + + + + + Gets the ordinate values by index + + The index + Thrown if index < 0 or > 1 + + + + Adds to this vector instance. + + The vector to add + The result vector + + + + Subtracts from this vector instance + + The vector to subtract + The result vector + + + + Multiplies the vector by a scalar value. + + The value to multiply by + A new vector with the value v * d + + + + Divides the vector by a scalar value. + + The value to divide by + A new vector with the value v / d + + + + Negates this vector + + A new vector with [-_x, -_y] + + + + + + + + + + + + + + + + Normalizes the vector + + A new normalized vector + + + + + + + + + + + Computes the weighted sum of this vector + with another vector, + with this vector contributing a fraction + of frac to the total. + + In other words, +
+            sum = frac * this + (1 - frac) * v
+            
+
+ The vector to sum + The fraction of the total contributed by this vector + The weighted sum of the two vectors +
+ + + Computes the distance between this vector and another one. + + A vector + The distance between the vectors + + + + Computes the dot-product of two vectors + + A vector + The dot product of the vectors + + + + Computes the angle this vector describes to the horizontal axis + + The angle + + + + + + + + + + + + + + + + + + Rotates this vector by + + The angle + The rotated vector + + + + Rotates a vector by a given number of quarter-circles (i.e. multiples of 90 + degrees or Pi/2 radians). A positive number rotates counter-clockwise, a + negative number rotates clockwise. Under this operation the magnitude of + the vector and the absolute values of the ordinates do not change, only + their sign and ordinate index. + + The number of quarter-circles to rotate by + The rotated vector. + + + + + + + + + + + Gets a made of this vector translated by . + + The translation coordinate + A coordinate + + + + Gets a from this vector + + A coordinate + + + + Creates a copy of this vector + + A copy of this vector + + + + Gets a string representation of this vector + + A string representing this vector + + + + Tests if a vector has the same values for the x and y components. + + A with which to do the comparison. + true if is a with the same values for the X and Y components. + + + + Gets a hashcode for this vector. + + A hashcode for this vector + + + + Adds two vectors. + + The first vector to add. + The second vector to add. + The sum of the two vectors. + + + + Modulates a vector with another by performing component-wise multiplication"/>. + + The first vector to multiply. + The second vector to multiply. + The multiplication of the two vectors. + + + + Subtracts two vectors. + + The first vector to subtract. + The second vector to subtract. + The difference of the two vectors. + + + + Reverses the direction of a given vector. + + The vector to negate. + A vector facing in the opposite direction. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Tests for equality between two objects. + + The first value to compare. + The second value to compare. + true if has the same value as + ; otherwise, false. + + + + Tests for inequality between two objects. + + The first value to compare. + The second value to compare. + true if has a different value + than ; otherwise, false. + + + + Represents a vector in 3-dimensional Cartesian space. + + Martin Davis + + + + Creates a new vector with all components set to Zero + + + + + Computes the dot product of the 3D vectors AB and CD. + + The start point of the 1st vector + The end point of the 1st vector + The start point of the 2nd vector + The end point of the 2nd vector + The dot product + + + + Calculates the cross product of two vectors. + + First source vector. + Second source vector. + + + + Creates a new vector with given , and components. + + The x component + The y component + The z component + A new vector + + + + Creates a vector from a 3D . + + The coordinate should have the + X,Y and Z ordinates specified. + + The coordinate to copy + A new vector + + + + Computes the 3D dot-product of two s + + The 1st vector + The 2nd vector + The dot product of the (coordinate) vectors + + + + Creates a new 3D vector from a . The coordinate should have + the X,Y and Z ordinates specified. + + The coordinate to copy + + + + Creates a new vector with the direction and magnitude + of the difference between the + and s. + + The origin coordinate + The destination coordinate + + + + Creates a new vector with the given , and components + + The x component + The y component + The z component + + + + Creates a new using a plus a value for component + + A vector containing the values with which to initialize the X and Y components. + Initial value for the Z component of the vector. + + + + Gets a value indicating the x-ordinate + + + + + Gets a value indicating the y-ordinate + + + + + Gets a value indicating the z-ordinate + + + + + Computes a vector which is the sum + of this vector and the given vector. + + The vector to add + The sum of this and v + + + + Computes a vector which is the difference + of this vector and the given vector. + + The vector to subtract + The difference of this and v + + + + Creates a new vector which has the same direction + and with length equals to the length of this vector + divided by the scalar value d. + + The scalar divisor + A new vector with divided length + + + + Computes the dot-product of this and + + The 2nd vector + The dot product of the vectors + + + + Computes the cross-product of this and + + The 2nd vector + The cross product of the vectors + + + + Computes the length of this vector + + The length of this vector + + + + Computes the length of vector . + + A coordinate representing a 3D Vector + The length of + + + + Computes a vector having identical direction + but normalized to have length 1. + + A new normalized vector + + + + Computes a vector having identical direction as v + but normalized to have length 1. + + A coordinate representing a 3D vector + A coordinate representing the normalized vector + + + + + + + + + + + + + Adds two vectors. + + The first vector to add. + The second vector to add. + The sum of the two vectors. + + + + Modulates a vector with another by performing component-wise multiplication. + + The first vector to multiply. + The second vector to multiply. + The multiplication of the two vectors. + + + + Assert a vector (return it unchanged). + + The vector to assert (unchanged). + The asserted (unchanged) vector. + + + + Subtracts two vectors. + + The first vector to subtract. + The second vector to subtract. + The difference of the two vectors. + + + + Reverses the direction of a given vector. + + The vector to negate. + A vector facing in the opposite direction. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Scales a vector by the given value. + + The vector to scale. + The amount by which to scale the vector. + The scaled vector. + + + + Tests for equality between two objects. + + The first value to compare. + The second value to compare. + true if has the same value as ; otherwise, false. + + + + Tests for inequality between two objects. + + The first value to compare. + The second value to compare. + true if has a different value than ; otherwise, false. + + + + Functions for performing vector mathematics. + + + + + Computes the normal vector to the triangle p0-p1-p2. In order to compute the normal each + triangle coordinate must have a Z value. If this is not the case, the returned Coordinate + will have NaN values. The returned vector has unit length. + + A point + A point + A point + The normal vector to the triangle -- + + + + Normalizes the vector + + The normalized + + + + Computes the cross product of and + + A vector + A vector + The cross product of and + + + + Computes the dot product of and + + A vector + A vector + The dot product of and + + + + Computes the determinant of a 2x2 matrix + + The m[0,0] value + The m[0,1] value + The m[1,0] value + The m[1,1] value + The determinant + + + + Represents a read-only list of contiguous line segments. + This can be used for detection of intersections or nodes. + s can carry a context object, which is useful + for preserving topological or parentage information. + + If adding nodes is required use . + + + + + + Creates a new segment string from a list of vertices. + + the vertices of the segment string + the user-defined data of this segment string (may be null) + + + Gets the user-defined data for this segment string. + + + + + Gets the octant of the segment starting at vertex index + + the index of the vertex starting the segment. Must not be the last index in the vertex list + octant of the segment at the vertex + + + + + + + Validates that a collection of s is correctly noded. + Indexing is used to improve performance. + + + + By default validation stops after a single + non-noded intersection is detected. + Alternatively, it can be requested to detect all intersections + by using the property. + + The validator does not check for topology collapse situations + (e.g. where two segment strings are fully co-incident). + + The validator checks for the following situations which indicated incorrect noding: + + Proper intersections between segments (i.e. the intersection is interior to both segments) + Intersections at an interior vertex (i.e. with an endpoint or another interior vertex) + + + + The client may either test the condition, + or request that a suitable be thrown. + + + + + + + Gets a list of all intersections found. + Intersections are represented as s. + List is empty if none were found. + A collection of SegmentStrings + a list of + + + + + Creates a new noding validator for a given set of linework. + + A collection of s + + + + Gets or sets whether all intersections should be found. + + + + + Gets a list of all intersections found. + + Intersections are represented as s. + List is empty if none were found. + + + + + + Checks for an intersection and reports if one is found. + + + + + Returns an error message indicating the segments containing the intersection. + + an error message documenting the intersection location + + + + Checks for an intersection and throws + a TopologyException if one is found. + + if an intersection is found + + + + Finds if two sets of s intersect. + + + Uses indexing for fast performance and to optimize repeated tests + against a target set of lines. + Short-circuited to return as soon an intersection is found. + + Immutable and thread-safe. + + + + + Creates an intersection finder against a given set of segment strings. + + The segment strings to search for intersections + + + Gets the segment set intersector used by this class. + This allows other uses of the same underlying indexed structure. + + + + Tests for intersections with a given set of target s. + + The SegmentStrings to test + true if an intersection was found + + + + Tests for intersections with a given set of target s. + using a given SegmentIntersectionDetector. + + The SegmentStrings to test + The intersection detector to use + true if the detector reports intersections + + + + An interface for classes which support adding nodes to a segment string. + + + + Adds an intersection node for a given point and segment to this segment string. + + the location of the intersection + the index of the segment containing the intersection + + + + Computes all intersections between segments in a set of s. + Intersections found are represented as s and added to the + s in which they occur. + As a final step in the noding a new set of segment strings split at the nodes may be returned. + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Finds interior intersections + between line segments in s, + and adds them as nodes + using . + This class is used primarily for Snap-Rounding. + For general-purpose noding, use . + + + + + + Creates an intersection finder which finds all proper intersections. + + The to use. + + + + + + + + + This method is called by clients + of the class to process + intersections for two segments of the s being intersected.
+ Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). +
+ + + + +
+ + + Always process all intersections + + + + + Computes the possible intersections between two line segments in s + and adds them to each string + using . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initializes a new instance of the class. + + + + + + + + + + + Returns the proper intersection point, or null if none was found. + + + + + + + + + + A proper intersection is an intersection which is interior to at least two + line segments. Note that a proper intersection is not necessarily + in the interior of the entire , since another edge may have + an endpoint equal to the intersection, which according to SFS semantics + can result in the point being on the Boundary of the . + + + + + A proper interior intersection is a proper intersection which is not + contained in the set of boundary nodes set for this . + + + + + An interior intersection is an intersection which is + in the interior of some segment. + + + + + A trivial intersection is an apparent self-intersection which in fact + is simply the point shared by adjacent line segments. + Note that closed edges require a special check for the point shared by the beginning and end segments. + + + + + + + + + + This method is called by clients + of the class to process + intersections for two segments of the being intersected.
+ Note that some clients (such as MonotoneChain") may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). +
+ + + + +
+ + + Always process all intersections + + + + + Processes possible intersections detected by a . + + + + The is passed to a . + + The + method is called whenever the + detects that two s might intersect. + + This class may be used either to find all intersections, or + to detect the presence of an intersection. In the latter case, + Noders may choose to short-circuit their computation by calling the + property. + + + + This class is an example of the Strategy pattern. + + This class may be used either to find all intersections, or + to detect the presence of an intersection. In the latter case, + Noders may choose to short-circuit their computation by calling the + property. + + + + + + This method is called by clients + of the interface to process + intersections for two segments of the s being intersected. + + + + + + + + + Reports whether the client of this class needs to continue testing + all intersections in an arrangement. + + if there is no need to continue testing segments + + + + An interface for classes which represent a sequence of contiguous line segments. + SegmentStrings can carry a context object, which is useful + for preserving topological or parentage information. + + + + + Gets/Sets the user-defined data for this segment string. + + + + + Points that make up ISegmentString + + + + + Size of Coordinate Sequence + + + + + States whether ISegmentString is closed + + + + + Nodes a set of s completely. + The set of s is fully noded; + i.e. noding is repeated until no further intersections are detected. + + Iterated noding using a precision model is not guaranteed to converge, + due to round off error. This problem is detected and an exception is thrown. + Clients can choose to rerun the noding using a lower precision model. + + + + + + + + + + + Initializes a new instance of the class. + + + + + + Gets/Sets the maximum number of noding iterations performed before + the noding is aborted. Experience suggests that this should rarely need to be changed + from the default. The default is . + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Fully nodes a list of s, i.e. performs noding iteratively + until no intersections are found between segments. + Maintains labelling of edges correctly through the noding. + + A collection of SegmentStrings to be noded. + If the iterated noding fails to converge. + + + + Node the input segment strings once + and create the split edges between the nodes. + + + + + + + Nodes a set of s using a index based + on s and a . + The used should be something that supports + envelope (range) queries efficiently (such as a Quadtree" + or . + + The noder supports using an overlap tolerance distance. + This allows determining segment intersection using a buffer for uses + involving snapping with a distance tolerance. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The to use. + + + + Initializes a new instance of the class. + + The to use. + The expansion distance for overlap tests + + + + + + + + + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + + + + + + + + + + + + + + + + + Initializes a new instance of the class. + + The + + + + + + + + + + + + + Intersects two sets of s using a index based + on s and a . + + Thread-safe and immutable. + + + + + Constructs a new intersector for a given set of s. + + The base segment strings to intersect + + + + Gets the index constructed over the base segment strings + + NOTE: To retain thread-safety, treat returned value as immutable + + + + Calls + for all candidate intersections between + the given collection of SegmentStrings and the set of indexed segments. + + A set of segments to intersect + The SegmentIntersector to use + + + + Segment overlap action class + + + + + Creates an instance of this class using the provided + + The segment intersector to use + + + + Represents a list of contiguous line segments, and supports noding the segments. + The line segments are represented by an array of s. + Intended to optimize the noding of contiguous segments by + reducing the number of allocated objects. + s can carry a context object, which is useful + for preserving topological or parentage information. + All noded substrings are initialized with the same context object. + + For read-only applications use , + which is (slightly)more lightweight. + + + + + + Gets the s which result from splitting this string at node points. + + A collection of NodedSegmentStrings + A collection of NodedSegmentStrings representing the substrings + + + + Adds the noded s which result from splitting this string at node points. + + A collection of NodedSegmentStrings + A list which will collect the NodedSegmentStrings representing the substrings + + + + Creates an instance from a list of vertices and optional data object. + + The vertices of the segment string. + The user-defined data of this segment string (may be null). + + + + Creates a new instance from a . + + The segment string to use. + + + + Gets/Sets the user-defined data for this segment string. + + In JTS this property is called Data + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets a list of coordinates with all nodes included. + + An array of coordinates including nodes + + + + + + + + + Gets the octant of the segment starting at vertex index. + + + The index of the vertex starting the segment. + Must not be the last index in the vertex list + + The octant of the segment at the vertex + + + + Adds EdgeIntersections for one or both + intersections found for a segment of an edge to the edge intersection list. + + + + + + + + Add an for intersection intIndex. + An intersection that falls exactly on a vertex + of the is normalized + to use the higher of the two possible segmentIndexes. + + + + + + + + + + + + + + + + + + + Finds non-noded intersections in a set of {@link SegmentString}s, + if any exist. + + Non-noded intersections include: + + Interior intersectionswhich lie in the interior of a segment + (with another segment interior or with a vertex or endpoint) + Vertex intersectionswhich occur at vertices in the interior of s + (with a segment string endpoint or with another interior vertex) + + The finder can be limited to finding only interior intersections + by setting . + + By default only the first intersection is found, + but all can be found by setting . + + + + + Creates a finder which tests if there is at least one intersection. + Uses short-circuiting for efficient performance. + The intersection found is recorded. + + A line intersector. + A finder which tests if there is at least one intersection. + + + + Creates a finder which tests if there is at least one intersection. + The intersections are recorded for later inspection. + + A line intersector. + A finder which finds all intersections. + + + + Creates a finder which finds all interior intersections. + The intersections are recorded for later inspection. + + A line intersector + A finder which finds all interior intersections. + + + + Creates a finder which counts all intersections. + The intersections are note recorded to reduce memory usage. + + A line intersector. + A finder which counts all intersections. + + + + Creates a finder which counts all interior intersections. + The intersections are note recorded to reduce memory usage. + + A line intersector. + A finder which counts all interior intersections. + + + + Creates an intersection finder which finds an interior intersection if one exists + + the LineIntersector to use + + + + Gets/Sets whether all intersections should be computed. + + When this is false (the default value), the value of + is true after the first intersection is found. + Default is false. + + + + + + Gets or sets a value indicating whether only interior (proper) intersections will be found. + + + + + Gets/Sets whether intersection points are recorded. + + If the only need is to count intersection points, this can be set to false. + Default is true. + + + + + + Gets/Sets whether only end segments should be tested for intersection. + This is a performance optimization that may be used if + the segments have been previously noded by an appropriate algorithm. + It may be known that any potential noding failures will occur only in + end segments. + + + + + Tests whether an intersection was found. + + + + + Gets the intersections found. + + A list of . + + + + Gets the count of intersections found. + + The intersection count. + + + + Gets the computed location of the intersection. + Due to round-off, the location may not be exact. + + + + + Gets the computed location of the intersection. + Due to round-off, the location may not be exact. + + + + + Gets the endpoints of the intersecting segments. + + + + + This method is called by clients of the class to process + intersections for two segments of the s being intersected.
+ Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). +
+ + + + +
+ + + Tests if an intersection occurs between a segmentString interior vertex and another vertex. + Note that intersections between two endpoint vertices are valid noding, + and are not flagged. + + A segment vertex + A segment vertex + A segment vertex + A segment vertex + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if an intersection is found/ + + + + Tests if two vertices with at least one in a segmentString interior + are equal. + + A segment vertex + A segment vertex + true if vertex is a segmentString endpoint + true if vertex is a segmentString endpoint + true if an intersection is found + + + + Tests whether a segment in a is an end segment. + (either the first or last). + + a segment string + the index of a segment in the segment string + true if the segment is an end segment + + + + + + + + + Validates that a collection of s is correctly noded. + Throws an appropriate exception if an noding error is found. + + + + + Creates a new validator for the given collection + of s. + + The seg strings. + + + + Checks whether the supplied segment strings + are correctly noded. Throws an exception if they are not. + + + + + Checks if a segment string contains a segment pattern a-b-a (which implies a self-intersection). + + + + + Checks all pairs of segments for intersections at an interior point of a segment. + + + + + Checks for intersections between an endpoint of a segment string + and an interior vertex of another segment string + + + + + Octants in the Cartesian plane. + Octants are numbered as follows: + + \2|1/ + 3 \|/ 0 + ---+-- + 4 /|\ 7 + /5|6\ + + If line segments lie along a coordinate axis, the octant is the lower of the two possible values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Methods for computing and working with of the Cartesian plane. + + + + + Returns the octant of a directed line segment (specified as x and y + displacements, which cannot both be 0). + + + + + + + + Returns the octant of a directed line segment from p0 to p1. + + + + + + + + Allows comparing arrays in an orientation-independent way. + + + + + Creates a new } + for the given array. + + + + + + Computes the canonical orientation for a coordinate array. + + + + true if the points are oriented forwards
+ or falseif the points are oriented in reverse. +
+
+ + + Compares two s for their relative order. + + + + -1 this one is smaller;
+ 0 the two objects are equal;
+ 1 this one is greater. +
+
+ + + + + + + + + + + + + Wraps a and transforms its input into the integer domain. + This is intended for use with Snap-Rounding noders, + which typically are only intended to work in the integer domain. + + Clients should be aware that rescaling can involve loss of precision, + which can cause zero-length line segments to be created. + These in turn can cause problems when used to build a planar graph. + This situation should be checked for and collapsed segments removed if necessary. + + + + + + Initializes a new instance of the class. + + The noder to use + The scale factor to use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A noder which extracts all line segments + as s. + This enables fast overlay of geometries which are known to be already fully noded. + In particular, it provides fast union of polygonal and linear coverages. + Unioning a noded set of lines is an effective way + to perform line merging and line dissolving. + + No precision reduction is carried out. + If that is required, another noder must be used (such as a snap-rounding noder), + or the input must be precision-reduced beforehand. + + Martin Davis + + + + Detects and records an intersection between two s, + if one exists. Only a single intersection is recorded. + + + This strategy can be configured to search for proper intersections. + In this case, the presence of any intersection will still be recorded, + but searching will continue until either a proper intersection has been found + or no intersections are detected. + + + + + Creates an intersection finder using a + + + + + Creates an intersection finder using a given + + The LineIntersector to use + + + + Gets or sets whether processing must continue until a proper intersection is found + + + + + Gets or sets whether processing can terminate once any intersection is found. + + + + + Tests whether an intersection was found. + + + + + Tests whether a proper intersection was found. + + + + + Tests whether a non-proper intersection was found. + + + + + Gets the computed location of the intersection. Due to round-off, the location may not be exact. + + + + Gets the endpoints of the intersecting segments. + + An array of the segment endpoints (p00, p01, p10, p11) + + + + This method is called by clients of the class to process + intersections for two segments of the s being intersected. + + + Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). + + + + + Tests whether processing can terminate, + because all required information has been obtained + (e.g. an intersection of the desired type has been detected). + + + + + Represents an intersection point between two s. + + + + + + + + + + + + + + + Initializes a new instance of the class. + + + + + + + + + Gets the giving the location of this node. + + + + + + + + + + + + + + + + + + + + + -1 this SegmentNode is located before the argument location;
+ 0 this SegmentNode is at the argument location;
+ 1 this SegmentNode is located after the argument location. +
+
+ + + + + + + + > + + + + A list of the s present along a noded . + + + + + Initializes a new instance of the class. + + The edge. + + + + + + + + + + Adds an intersection into the list, if it isn't already there. + The input segmentIndex and dist are expected to be normalized. + + + + The SegmentIntersection found or added. + + + + Returns an iterator of SegmentNodes. + + An iterator of SegmentNodes. + + + + Adds nodes for the first and last points of the edge. + + + + + Adds nodes for any collapsed edge pairs. + Collapsed edge pairs can be caused by inserted nodes, or they can be + pre-existing in the edge vertex list. + In order to provide the correct fully noded semantics, + the vertex at the base of a collapsed pair must also be added as a node. + + + + + Adds nodes for any collapsed edge pairs + which are pre-existing in the vertex list. + + + + + + Adds nodes for any collapsed edge pairs caused by inserted nodes + Collapsed edge pairs occur when the same coordinate is inserted as a node + both before and after an existing edge vertex. + To provide the correct fully noded semantics, + the vertex must be added as a node as well. + + + + + + + + + + + + + + + Creates new edges for all the edges that the intersections in this + list split the parent edge into. + Adds the edges to the provided argument list + (this is so a single list can be used to accumulate all split edges + for a set of s). + + + + + + Create a new "split edge" with the section of points between + (and including) the two intersections. + The label for the new edge is the same as the label for the parent edge. + + + + + + + + Extracts the points for a split edge running between two nodes. + The extracted points should contain no duplicate points. + There should always be at least two points extracted + (which will be the given nodes). + + The start node of the split edge + The end node of the split edge + The points for the split edge + + + Gets the list of coordinates for the fully noded segment string, + including all original segment string vertices and vertices + introduced by nodes in this list. + Repeated coordinates are collapsed. + + An array of s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Implements a robust method of comparing the relative position of two points along the same segment. + The coordinates are assumed to lie "near" the segment. + This means that this algorithm will only return correct results + if the input coordinates have the same precision and correspond to rounded values + of exact coordinates lying on the segment. + + + + + Compares two s for their relative position along a segment + lying in the specified . + + + + + + -1 if node0 occurs first, or
+ 0 if the two nodes are equal, or
+ 1 if node1 occurs first. +
+
+ + + + + + + + + + + + + + + + + + + An intersector for the red-blue intersection problem. + In this class of line arrangement problem, + two disjoint sets of linestrings are intersected. + + Implementing classes must provide a way + of supplying the base set of segment strings to + test against (e.g. in the constructor, + for straightforward thread-safety). + + In order to allow optimizing processing, + the following condition is assumed to hold for each set: + + the only intersection between any two linestrings occurs at their endpoints. + + Implementations can take advantage of this fact to optimize processing + (i.e. by avoiding testing for intersections between linestrings + belonging to the same set). + + + + + Computes the intersections with a given set of s, + using the supplied . + + A collection of s to node + The intersection detector to either record intersection occurrences + or add intersection nodes to the input segment strings. + + + + Dissolves a noded collection of s to produce + a set of merged linework with unique segments. + + + A custom merging strategy + can be supplied. + This strategy will be called when two identical (up to orientation) + strings are dissolved together. + The default merging strategy is simply to discard one of the merged strings. + + A common use for this class is to merge noded edges + while preserving topological labelling. + This requires a custom merging strategy to be supplied + to merge the topology labels appropriately. + + + + + + A merging strategy which can be used to update the context data of s + which are merged during the dissolve process. + + mbdavis + + + + Updates the context data of a + when an identical (up to orientation) one is found during dissolving. + + The segment string to update. + The segment string being dissolved. + + true if the strings are in the same direction, + false if they are opposite. + + + + + Creates a dissolver with a user-defined merge strategy. + + + + + + Creates a dissolver with the default merging strategy. + + + + + Dissolve all s in the input . + + + + + + + + + + + + + Dissolve the given . + + + + + + + + + Gets the collection of dissolved (i.e. unique) s + + + + + Utility methods for processing s + + Martin Davis + + + + Extracts all linear components from a given + to s.
+ The 's data item is set to be the source . +
+ The to extract from. + a list of s. +
+ + + Extracts all linear components from a given + to s.
+ The 's data item is set to be the source . +
+ The to extract from. + a list of s. +
+ + + Extracts all linear components from a given to s. + The 's data item is set to be the source Geometry. + + The to extract from. + a list of s. + + + + Converts a collection of s into a . + The geometry will be either a + or a (possibly empty). + + A collection of . + A geometry factory + A or a . + + + + Nodes a set of s by + performing a brute-force comparison of every segment to every other one. + This has n^2 performance, so is too slow for use on large numbers of segments. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + + + + + + + + Intersects two sets of s using + brute-force comparison. + + + + + Constructs a new intersector for a given set of s. + + The base segment strings to intersect + + + + Calls + for all candidate intersections between + the given collection of SegmentStrings and the set of base segments. + + A collection of s to node + The intersection detector to either record intersection occurences + or add intersection nodes to the input segment strings. + + + + Processes all of the segment pairs in the given segment strings + using the given SegmentIntersector. + + A segment string + A segment string + The segment intersector to use + + + + Base class for s which make a single pass to find intersections. + This allows using a custom + (which for instance may simply identify intersections, rather than insert them). + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The to use. + + + + Gets/sets the to use with this noder. + A will normally add intersection nodes + to the input segment strings, but it may not - it may + simply record the presence of intersections. + However, some s may require that intersections be added. + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Nodes the linework in a list of s using Snap-Rounding + to a given . + + The input coordinates do not need to be rounded to the + precision model. + All output coordinates are rounded to the precision model. + + This class does not dissolve the output linework, + so there may be duplicate linestrings in the output. + Subsequent processing (e.g. polygonization) may require + the linework to be unique. Using UnaryUnion is one way + to do this (although this is an inefficient approach). + + + + + Creates a new noder which snap-rounds to a grid specified by the given + + The precision model for the grid to snap-round to. + + + + Gets or sets whether noding validity is checked after noding is performed. + + + + + Nodes the linework of a set of Geometrys using SnapRounding. + + A collection of Geometrys of any type + A list of LineStrings representing the noded linework of the input + + + + Implements a "hot pixel" as used in the Snap Rounding algorithm. + A hot pixel is a square region centred + on the rounded valud of the coordinate given, + and of width equal to the size of the scale factor. + It is a partially open region, which contains + the interior of the tolerance square and + the boundary + minus the top and right segments. + This ensures that every point of the space lies in a unique hot pixel. + It also matches the rounding semantics for numbers. + + The hot pixel operations are all computed in the integer domain + to avoid rounding problems. + + Hot Pixels support being marked as nodes. + This is used to prevent introducing nodes at line vertices + which do not have other lines snapped to them. + + + + The scaled x-ordinate of the hot pixel point () + + + The scaled y-ordinate of the hot pixel point () + + + + Initializes a new instance of the class. + + The coordinate at the center of the hot pixel + The scale factor determining the pixel size + The intersector to use for testing intersection with line segments + + + + Creates a new hot pixel centered on a rounded point, using a given scale factor. + The scale factor must be strictly positive(non-zero). + + The coordinate at the center of the hot pixel (already rounded) + The scale factor determining the pixel size + + + + Gets the coordinate this hot pixel is based at. + + + + + Gets the scale factor for the precision grid for this pixel. + + + + + Gets the width of the hot pixel in the original coordinate system. + + + + + Gets or sets a value indicating whether this pixel has been marked as a node. + + true if the pixel is marked as a node + + + + Scale without rounding. + This ensures intersections are checked against original + linework. + This is required to ensure that intersections are not missed + because the segment is moved by snapping. + + + + + Returns a "safe" envelope that is guaranteed to contain the hot pixel. + The envelope returned will be larger than the exact envelope of the pixel. + + An envelope which contains the pixel + + + + Tests whether a coordinate lies in (intersects) this hot pixel. + + The coordinate to test + true if the coordinate intersects this hot pixel + + + + Tests whether the line segment (p0-p1) + intersects this hot pixel. + + The first coordinate of the line segment to test + The second coordinate of the line segment to test + true if the line segment intersects this hot pixel. + + + + + + + + + + + + Test whether the given segment intersects + the closure of this hot pixel. + This is NOT the test used in the standard snap-rounding + algorithm, which uses the partially closed tolerance square instead. + This routine is provided for testing purposes only. + + + + + + + + Adds a new node (equal to the snap pt) to the specified segment + if the segment passes through the hot pixel + + + + true if a node was added to the segment + + + + An index which creates unique s for provided points, + and performs range queries on them. + The points passed to the index do not needed to be + rounded to the specified scale factor; this is done internally + when creating the HotPixels for them. + + Martin Davis + + + + Creates a new hot pixel index using the provided . + + The precision model + + + + Utility class to enumerate through a shuffled array of + s using the + Fisher-Yates shuffle algorithm + + + + + Creates an instance of this class using the provided s. + + An array of coordinates + + + + Creates an instance of this class using the provided s. + + An array of coordinates + + + + + + + + + + + + + + + + + + + Adds a series of points as non-node pixels + + The points to add + + + + Adds a list of points as node pixels. + + The points to add + + + + Adds a point as a Hot Pixel.
+ If the point has been added already, it is marked as a node. +
+ The point to add + The hot-pixel for the point +
+ + + Visits all the hot pixels which may intersect a segment (p0-p1). + The visitor must determine whether each hot pixel actually intersects + the segment. + + The segment start point + The segment end point + The visitor to apply + + + + "Snaps" all s in a containing + s to a given . + + + + + Initializes a new instance of the class. + + + + + + + + + + + + + + + + + + + + + + + Snaps (nodes) all interacting segments to this hot pixel. + The hot pixel may represent a vertex of an edge, + in which case this routine uses the optimization + of not noding the vertex itself + + The hot pixel to snap to. + The edge containing the vertex, if applicable, or null. + + true if a node was added for this pixel. + + + + Snaps (nodes) all interacting segments to this hot pixel. + The hot pixel may represent a vertex of an edge, + in which case this routine uses the optimization + of not noding the vertex itself + + The hot pixel to snap to. + true if a node was added for this pixel. + + + + Returns a "safe" envelope that is guaranteed to contain the hot pixel. + The envelope returned is larger than the exact envelope of the + pixel by a safe margin. + + An envelope which contains the hot pixel + + + + + + + + + Initializes a new instance of the class. + + + + + + + + Reports whether the HotPixel caused a node to be added in any target + segmentString(including its own). If so, the HotPixel must be added as a + node as well. + + + true if a node was added in any target segmentString. + + + + + Check if a segment of the monotone chain intersects + the hot pixel vertex and introduce a snap node if so. + Optimized to avoid noding segments which + contain the vertex (which otherwise + would cause every vertex to be noded). + + A monotone chain + A start index + + + + Adds a new node (equal to the snap pt) to the specified segment + if the segment passes through the hot pixel + + if a node was added to the segment + + + + Uses Snap Rounding to compute a rounded, + fully noded arrangement from a set of s. + Implements the Snap Rounding technique described in + papers by Hobby, Guibas and Marimont, and Goodrich et al. + Snap Rounding assumes that all vertices lie on a uniform grid; + hence the precision model of the input must be fixed precision, + and all the input vertices must be rounded to that precision. + + This implementation uses a monotone chains and a spatial index to + speed up the intersection tests. + +

KNOWN BUGS

+ This implementation is not fully robust. + instead. +
+ +
+ + + Initializes a new instance of the class. + + The to use. + + + + Returns a of fully noded s. + The s have the same context as their parent. + + + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + + + + + + + + + + + + Computes all interior intersections in the collection of s, + and returns their s. + + Does NOT node the segStrings. + + + + A list of Coordinates for the intersections. + + + + Snaps segments to nodes created by segment intersections. + + + + + + Snaps segments to all vertices + + The list of segment strings to snap together + + + + Snaps segments to the vertices of a Segment String. + + + + + + Uses Snap Rounding to compute a rounded, + fully noded arrangement from a set of s. + + Implements the Snap Rounding technique described in + the papers by Hobby, Guibas & Marimont, and Goodrich et al. + Snap Rounding enforces that all vertices lie on a uniform grid, + which is determined by the provided . + Input vertices do not have to be rounded to this grid; + this will be done during the snap-rounding process. + + This implementation uses simple iteration over the line segments. + This is not an efficient approach for large sets of segments. + This implementation appears to be fully robust using an integer precision model. + It will function with non-integer precision models, but the + results are not 100% guaranteed to be correctly noded. + + + + + + Initializes a new instance of the class. + + The to use. + + + + Returns a of fully noded s. + The s have the same context as their parent. + + A Collection of NodedSegmentStrings representing the substrings + + + + Computes the noding for a collection of s. + Some Noders may add all these nodes to the input s; + others may only add some or none at all. + + A collection of NodedSegmentStrings + + + + + + + + + + Gets a list of the rounded coordinates. + Duplicate (collapsed) coordinates are removed. + + The coordinates to round + An array of rounded coordinates + + + + Computes all interior intersections in the collection of s, + and returns their s. + + Also adds the intersection nodes to the segments. + + + A list of s for the intersections. + + + + Computes nodes introduced as a result of snapping segments to snap points (hot pixels). + + + + + + + + + + + + This is where all the work of snapping to hot pixels gets done + (in a very inefficient brute-force way). + + + + + Computes nodes introduced as a result of + snapping segments to vertices of other segments. + + The list of segment strings to snap together + + + + Performs a brute-force comparison of every segment in each . + This has n^2 performance. + + + + + + + Finds intersections between line segments which will be snap-rounded, + and adds them as nodes to the segments. + + Intersections are detected and computed using full precision. + Snapping takes place in a subsequent phase. + + The intersection points are recorded, so that HotPixels can be created for them. + + To avoid robustness issues with vertices which lie very close to line segments + a heuristic is used: + nodes are created if a vertex lies within a tolerance distance + of the interior of a segment. + The tolerance distance is chosen to be significantly below the snap-rounding grid size. + This has empirically proven to eliminate noding failures. + + + + + Creates an intersector which finds all snapped interior intersections, + and adds them as nodes. + + The precision model to use + + + + Creates an intersector which finds all snapped interior intersections, + and adds them as nodes. + + the intersection distance tolerance + + + + Gets the created intersection nodes, + so they can be processed as hot pixels. + + A list of intersection points + + + + This method is called by clients + of the class to process + intersections for two segments of the + s being intersected. + Note that some clients (such as MonotoneChain s) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g.by an disjoint envelope test). + + + + + If an endpoint of one segment is near + the interior of the other segment, add it as an intersection. + EXCEPT if the endpoint is also close to a segment endpoint + (since this can introduce "zigs" in the linework). + + This resolves situations where + a segment A endpoint is extremely close to another segment B, + but is not quite crossing.Due to robustness issues + in orientation detection, this can + result in the snapped segment A crossing segment B + without a node being introduced. + + + + + Always process all intersections + + Always false + + + + Uses Snap Rounding to compute a rounded, + fully noded arrangement from a set of s, + in a performant way, and avoiding unnecessary noding. + + Implements the Snap Rounding technique described in + the papers by Hobby, Guibas & Marimont, and Goodrich et al. + Snap Rounding enforces that all output vertices lie on a uniform grid, + which is determined by the provided . + + Input vertices do not have to be rounded to the grid beforehand; + this is done during the snap-rounding process. + In fact, rounding cannot be done a priori, + since rounding vertices by themselves can distort the rounded topology + of the arrangement (i.e. by moving segments away from hot pixels + that would otherwise intersect them, or by moving vertices + across segments). + + To minimize the number of introduced nodes, + the Snap-Rounding Noder avoids creating nodes + at edge vertices if there is no intersection or snap at that location. + However, if two different input edges contain identical segments, + each of the segment vertices will be noded. + This still provides fully-noded output. + This is the same behaviour provided by other noders, + such as + and . + + 1.17 + + + + The division factor used to determine + nearness distance tolerance for intersection detection. + + + + + Gets a Collection of NodedSegmentStrings representing the substrings + + + + + Computes the nodes in the snap-rounding line arrangement. + The nodes are added to the s provided as the input. + + A Collection of NodedSegmentStrings + + + + Detects interior intersections in the collection of {@link SegmentString}s, + and adds nodes for them to the segment strings. + Also creates HotPixel nodes for the intersection points. + + The input NodedSegmentStrings + + + + Creates HotPixels for each vertex in the input segStrings. + The HotPixels are not marked as nodes, since they will + only be nodes in the final line arrangement + if they interact with other segments(or they are already + created as intersection nodes). + + The input NodedSegmentStrings + + + + Gets a list of the rounded coordinates. + Duplicate (collapsed) coordinates are removed. + + The coordinates to round + Array of rounded coordinates + + + + Computes new segment strings which are rounded and contain + intersections added as a result of snapping segments to snap points (hot pixels). + + Segments to snap + The snapped segment strings + + + + Add snapped vertices to a segment string. + If the segment string collapses completely due to rounding, + null is returned. + + The segment string to snap + + The snapped segment string, or null if it collapses completely + + + + + Snaps a segment in a segmentString to HotPixels that it intersects. + + The segment start coordinate + The segment end coordinate + The segment string to add intersections to + The index of the segment/ + + + + Add nodes for any vertices in hot pixels that were + added as nodes during segment noding. + + A noded segment string + + + + Finds intersections between line segments which are being snapped, + and adds them as nodes. + + 1.17 + + + + Creates an intersector which finds all snapped intersections, + and adds them as nodes. + + The snapping tolerance distance + A snap index to use + + + + This method is called by clients + of the class to process + intersections for two segments of the s being intersected. + Note that some clients (such as MonotoneChains) may optimize away + this call for segment pairs which they have determined do not intersect + (e.g. by an disjoint envelope test). + + + + + If an endpoint of one segment is near + the interior of the other segment, add it as an intersection. + EXCEPT if the endpoint is also close to a segment endpoint + (since this can introduce "zigs" in the linework). + + This resolves situations where + a segment A endpoint is extremely close to another segment B, + but is not quite crossing. Due to robustness issues + in orientation detection, this can + result in the snapped segment A crossing segment B + without a node being introduced. + + + + + Test if two segments are adjacent segments on the same SegmentString. + Note that closed edges require a special check for the point shared by the beginning + and end segments. + + + + > + Always process all intersections> + false + + + + Nodes a set of segment strings + snapping vertices and intersection points together if + they lie within the given snap tolerance distance. + Vertices take priority over intersection points for snapping. + Input segment strings are generally only split at true node points + (i.e.the output segment strings are of maximal length in the output arrangement). + + The snap tolerance should be chosen to be as small as possible + while still producing a correct result. + It probably only needs to be small enough to eliminate + "nearly-coincident" segments, for which intersection points cannot be computed accurately. + This implies a factor of about 10e-12 + smaller than the magnitude of the segment coordinates. + + With an appropriate snap tolerance this algorithm appears to be very robust. + So far no failure cases have been found, + given a small enough snap tolerance. + + The correctness of the output is not verified by this noder. + If required this can be done by . + + 1.17 + + + + Creates a snapping noder using the given snap distance tolerance. + + Points are snapped if within this distance + + + > + A collection of s representing the substrings + + + Computes the noding of a set of s + A Collection of s + + + + Seeds the snap index with a small set of vertices + chosen quasi-randomly using a low-discrepancy sequence. + Seeding the snap index KdTree induces a more balanced tree. + This prevents monotonic runs of vertices + unbalancing the tree and causing poor query performance. + + The segStrings to be noded + + + + Computes all interior intersections in the collection of s, + and returns their s. + + Also adds the intersection nodes to the segments. + + A list of noded substrings + + + + An index providing fast creation and lookup of snap points. + + + + + Since points are added incrementally, this index needs to be dynamic. + This class also makes use of the KdTree support for a tolerance distance + for point equality. + + + + + Creates a snap point index using a specified distance tolerance. + + Points are snapped if within this distance + + + + Snaps a coordinate to an existing snap point, + if it is within the snap tolerance distance. + Otherwise adds the coordinate to the snap point index. + + The point to snap + The point it snapped to, or the input point + + + + Gets a value indicating the snapping tolerance value for the index + + + + + Gets a value indicating the depth of the tree + + + + + A wrapper for s which validates + the output arrangement is correctly noded. + An arrangement of line segments is fully noded if + there is no line segment + which has another segment intersecting its interior. + If the noding is not correct, a is thrown + with details of the first invalid location found. + + Martin Davis + + + + + Creates a noding validator wrapping the given + + The noder to validate + + + + Checks whether the output of the wrapped noder is fully noded. + Throws an exception if it is not. + + + + + + + + + A geometry service provider class + + + When overriding this class, you need to provide a public constructor with the following arguments: + + CoordinateSequenceFactoryA factory to create coordinate sequences + PrecisionModelA precision model + intspatial reference id (srid) + GeometryOverlayA class that bundles an overlay operation function set + CoordinateEqualityComparerA class that performs checks s for equality. + + + + + + + Creates an instance of this class, using the + as default and a precision model.
+ No is specified.
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using the + as default and a precision model. + No is specified + + The function set to perform overlay operations + + + + Creates an instance of this class, using the as default.
+ No is specified.
+ The default precision model is defined by .
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using the as default.
+ A value of is assigned to .
+ The default precision model is defined by .
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using a precision model as default.
+ No is specified.
+ The default coordinate sequence factory is defined by .
+ The function set for overlay operations is being used. +
+
+ + + Creates an instance of this class, using the provided , + and spatial reference Id (). + + The coordinate sequence factory to use. + The precision model. + The default spatial reference ID + + + + Creates an instance of this class, using the provided , + , a spatial reference Id () and + a . + + The coordinate sequence factory to use. + The precision model. + The default spatial reference ID + The geometry overlay function set to use. + The equality comparer for coordinates + + + + Gets or sets the default instance of . + + + Thrown when trying to set the value to . + + + + + Gets or sets a value indicating the operations to use for geometry overlay. + + A set of geometry overlay functions. + + + + Gets an object that is used to test 2 coordinates for equality. + + A coordinate equality tester object + + + + Gets the default spatial reference id + + + + + Gets or sets the coordiate sequence factory to use + + + + + Gets or sets the default precision model + + + + + Creates a precision model based on given precision model type + + The precision model type + + + + Creates a precision model based on given precision model. + + The precision model + + + + Creates a precision model based on the given scale factor. + + The scale factor + The precision model. + + + + Creates or retrieves a geometry factory using , and + . + + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + The precision model to use. + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + The precision model to use. + The spatial reference id. + A geometry factory + + + + Creates or retrieves a geometry factory using , and + . + + The precision model to use. + The spatial reference id. + + A geometry factory + + + + Creates a based on the given parameters. + + + The value for . + + + The value for . + + + The value for . + + + A that has the given values. + + + + This method is expected to be safe to call from any number of threads at once. + + + Implementations must make sure to use a constructor which + is properly assigning to the factory. + + + Although the result for a given set of parameters is cached, there is no guarantee that, + once this method is called with some set of parameters, it will never be called again + with an exactly equal set of parameters. When this does happen, an arbitrary result is + chosen as the winner (not necessarily the first one to start or finish), and all other + results are discarded. + + + + + + Computes the boundary of a . + Allows specifying the to be used. + This operation will always return a of the appropriate + dimension for the boundary (even if the input geometry is empty). + The boundary of zero-dimensional geometries (Points) is + always the empty . + + Martin Davis + + + + Computes a geometry representing the boundary of a geometry. + + The input geometry. + The computed boundary. + + + + Computes a geometry representing the boundary of a geometry, + using an explicit . + + The input geometry. + The Boundary Node Rule to use. + The computed boundary. + + + + Tests if a geometry has a boundary (it is non-empty).
+ The semantics are: + + Empty geometries do not have boundaries. + Points do not have boundaries. + For linear geometries the existence of the boundary + is determined by the . + Non-empty polygons always have a boundary. + +
+ The geometry providing the boundary + The Boundary Node Rule to use + true if the boundary exists +
+ + + Initializes a new instance of the class for the given geometry. + + The input geometry. + + + + Initializes a new instance of the class for the given geometry. + + The input geometry. + Tthe Boundary Node Rule to use. + + + + Gets the computed boundary. + + The boundary geometry. + + + + A map which maintains the edges in sorted order around the node. + + + + + Stores an integer count, for use as a Map entry. + + Martin Davis + + + + Builds the buffer geometry for a given input geometry and precision model. + Allows setting the level of approximation for circular arcs, + and the precision model in which to carry out the computation. + + + When computing buffers in floating point double-precision + it can happen that the process of iterated noding can fail to converge (terminate). + In this case a will be thrown. + Retrying the computation in a fixed precision + can produce more robust results. + + + + Compute the change in depth as an edge is crossed from R to L + + + + Initializes a new instance of the class using the given parameters. + + The buffer parameters to use. + + + + Sets the precision model to use during the curve computation and noding, + if it is different to the precision model of the Geometry. + + + If the precision model is less than the precision of the Geometry precision model, + the Geometry must have previously been rounded to that precision. + + + + + Sets the to use during noding. + This allows choosing fast but non-robust noding, or slower + but robust noding. + + + + + Sets whether the offset curve is generated + using the inverted orientation of input rings. + This allows generating a buffer(0) polygon from the smaller lobes + of self-crossing rings. + + + + + Inserted edges are checked to see if an identical edge already exists. + If so, the edge is not inserted, but its label is merged + with the existing edge. + + + + + Completes the building of the input subgraphs by depth-labelling them, + and adds them to the PolygonBuilder. + + + The subgraph list must be sorted in rightmost-coordinate order. + + the subgraphs to build + the PolygonBuilder which will build the final polygons + + + + Gets the standard result for an empty buffer. + Since buffer always returns a polygonal result, this is chosen to be an empty polygon. + + The empty result geometry + + + + Creates all the raw offset curves for a buffer of a Geometry. + Raw curves need to be noded together and polygonized to form the final buffer area. + + + + + + + The input geometry + The offset distance + A precision model + The buffer parameters + + + + Gets or sets a value indicating whether the offset curve is generated + using the inverted orientation of input rings. + This allows generating a buffer(0) polygon from the smaller lobes + of self-crossing rings. + + + + + Computes orientation of a ring using a signed-area orientation test. + For invalid (self-crossing) rings this ensures the largest enclosed area + is taken to be the interior of the ring. + This produces a more sensible result when + used for repairing polygonal geometry via buffer-by-zero. + For buffer use the lower robustness of orientation-by-area + doesn't matter, since narrow or flat rings + produce an acceptable offset curve for either orientation. + + The ring coordinates + true if the ring is CCW + + + + Computes the set of raw offset curves for the buffer. + Each offset curve has an attached {Label} indicating + its left and right location. + + A Collection of SegmentStrings representing the raw buffer curves. + + + + Creates a {SegmentString} for a coordinate list which is a raw offset curve, + and adds it to the list of buffer curves. + The SegmentString is tagged with a Label giving the topology of the curve. + The curve may be oriented in either direction. + If the curve is oriented CW, the locations will be: + Left: Location.Exterior. + Right: Location.Interior. + + + + + + + + + + + + + + + + + Add a Point to the graph. + + + + + + Keeps only valid coordinates, and removes repeated points. + + The coordinates to clean + An array of clean coordinates + + + + + + + + + + Adds an offset curve for a polygon ring. + The side and left and right topological location arguments + assume that the ring is oriented CW. + If the ring is in the opposite orientation, + the left and right locations must be interchanged and the side flipped. + + The coordinates of the ring (must not contain repeated points). + The distance at which to create the buffer. + The side of the ring on which to construct the buffer line. + The location on the L side of the ring (if it is CW). + The location on the R side of the ring (if it is CW). + + + + Tests whether the offset curve for a ring is fully inverted. + An inverted ("inside-out") curve occurs in some specific situations + involving a buffer distance which should result in a fully-eroded (empty) buffer. + It can happen that the sides of a small, convex polygon + produce offset segments which all cross one another to form + a curve with inverted orientation.
+ This happens at buffer distances slightly greater than the distance at + which the buffer should disappear.
+ The inverted curve will produce an incorrect non-empty buffer (for a shell) + or an incorrect hole (for a hole). + It must be discarded from the set of offset curves used in the buffer. + Heuristics are used to reduce the number of cases which area checked, + for efficiency and correctness. + + See +
+ the input ring + the buffer distance + the generated offset curve + true if the offset curve is inverted +
+ + + Computes the maximum distance out of a set of points to a linestring. + + The points + The linestring vertices + The maximum distance + + + + Tests whether a ring buffer is eroded completely (is empty) + based on simple heuristics. + + The is assumed to contain no repeated points. + It may be degenerate (i.e. contain only 1, 2, or 3 points). + In this case it has no area, and hence has a minimum diameter of 0. + + + + + + + + Tests whether a triangular ring would be eroded completely by the given + buffer distance. + This is a precise test. It uses the fact that the inner buffer of a + triangle converges on the inCentre of the triangle (the point + equidistant from all sides). If the buffer distance is greater than the + distance of the inCentre from a side, the triangle will be eroded completely. + This test is important, since it removes a problematic case where + the buffer distance is slightly larger than the inCentre distance. + In this case the triangle buffer curve "inverts" with incorrect topology, + producing an incorrect hole in the buffer. + + + + + + + + Simplifies a buffer input line to remove concavities with shallow depth. + + + + The most important benefit of doing this + is to reduce the number of points and the complexity of + shape which will be buffered. + It also reduces the risk of gores created by + the quantized fillet arcs (although this issue + should be eliminated in any case by the + offset curve generation logic). + + + A key aspect of the simplification is that it + affects inside (concave or inward) corners only. + Convex (outward) corners are preserved, since they + are required to ensure that the generated buffer curve + lies at the correct distance from the input geometry. + + + Another important heuristic used is that the end segments + of the input are never simplified. This ensures that + the client buffer code is able to generate end caps faithfully. + + + No attempt is made to avoid self-intersections in the output. + This is acceptable for use for generating a buffer offset curve, + since the buffer algorithm is insensitive to invalid polygonal + geometry. However, + this means that this algorithm + cannot be used as a general-purpose polygon simplification technique. + + + Martin Davis + + + + Simplify the input coordinate list. + If the distance tolerance is positive, + concavities on the LEFT side of the line are simplified. + If the supplied distance tolerance is negative, + concavities on the RIGHT side of the line are simplified. + + The coordinate list to simplify + simplification distance tolerance to use + The simplified coordinate list + + + + Simplify the input coordinate list. + + + If the distance tolerance is positive, concavities on the LEFT side of the line are simplified. + If the supplied distance tolerance is negative, concavities on the RIGHT side of the line are simplified. + + Simplification distance tolerance to use + + The simplified coordinates list + + + + + Uses a sliding window containing 3 vertices to detect shallow angles + in which the middle vertex can be deleted, since it does not + affect the shape of the resulting buffer in a significant way. + + + + + + Finds the next non-deleted index, or the end of the point array if none + + The start index to search from + The next non-deleted index, if any
+ or _inputLine.Length if there are no more non-deleted indices +
+
+ + + Checks for shallowness over a sample of points in the given section. + This helps to prevent the simplification from incrementally + "skipping" over points which are in fact non-shallow. + + A coordinate of section + A coordinate of section + The start index of section + The end index of section + The tolerated distance + + + + Computes the buffer of a geometry, for both positive and negative buffer distances. + + + + In GIS, the positive (or negative) buffer of a geometry is defined as + the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. + In the CAD/CAM world buffers are known as offset curves. + In morphological analysis the + operation of positive and negative buffering + is referred to as erosion and dilation + + + The buffer operation always returns a polygonal result. + The negative or zero-distance buffer of lines and points is always an empty . + + + Since true buffer curves may contain circular arcs, + computed buffer polygons are only approximations to the true geometry. + The user can control the accuracy of the approximation by specifying + the number of linear segments used to approximate arcs. + This is specified via + or . + + + The of a linear buffer may be specified. + The following end cap styles are supported: +
    +
  • - the usual round end caps
  • +
  • - end caps are truncated flat at the line ends
  • +
  • - end caps are squared off at the buffer distance beyond the line ends
  • +
+
+ + The of the corners in a buffer may be specified. + The following join styles are supported: +
    +
  • - the usual round join
  • +
  • - corners are "sharp" (up to a distance limit})
  • +
  • - corners are beveled (clipped off)
  • +
+
+ + The buffer algorithm may perform simplification on the input to increase performance. + The simplification is performed a way that always increases the buffer area + (so that the simplified input covers the original input). + The degree of simplification can be specified with , + with a used otherwise. + Note that if the buffer distance is zero then so is the computed simplify tolerance, + no matter what the simplify factor. + + + Buffer results are always valid geometry. + Given this, computing a zero-width buffer of an invalid polygonal geometry is + an effective way to "validify" the geometry. + Note however that in the case of self-intersecting "bow-tie" geometries, + only the largest enclosed area will be retained. + +
+
+ + + A number of digits of precision which leaves some computational "headroom" + for floating point operations. + + + This value should be less than the decimal precision of double-precision values (16). + + + + + Compute a scale factor to limit the precision of + a given combination of Geometry and buffer distance. + The scale factor is determined by + the number of digits of precision in the (geometry + buffer distance), + limited by the supplied value. + + The scale factor is based on the absolute magnitude of the (geometry + buffer distance). + since this determines the number of digits of precision which must be handled. + + the Geometry being buffered + the buffer distance + the max # of digits that should be allowed by + the precision determined by the computed scale factor + + a scale factor for the buffer computation + + + + Computes the buffer of a geometry for a given buffer distance. + + the geometry to buffer + the buffer distance + the buffer of the input geometry + + + + Computes the buffer for a geometry for a given buffer distance + and accuracy of approximation. + + the geometry to buffer + the buffer distance + the buffer parameters to use + the buffer of the input geometry + + + + Computes the buffer for a geometry for a given buffer distance + and accuracy of approximation. + + the geometry to buffer + the buffer distance + the number of segments used to approximate a quarter circle + the buffer of the input geometry + + + + Buffers a geometry with distance zero. + The result can be computed using the maximum-signed-area orientation, + or by combining both orientations. + + This can be used to fix an invalid polygonal geometry to be valid + (i.e.with no self-intersections). + For some uses(e.g.fixing the result of a simplification) + a better result is produced by using only the max-area orientation. + Other uses (e.g.fixing geometry) require both orientations to be used. + + This function is for INTERNAL use only. + + The polygonal geometry to buffer by zero + A flag indicating if both orientations of input rings should be used + The buffered polygonal geometry + + + + Combines the elements of two polygonal geometries together. + The input geometries must be non-adjacent, to avoid + creating an invalid result. + + A polygonal geometry (which may be empty) + Another polygonal geometry (which may be empty) + A combined polygonal geometry + + + + Initializes a buffer computation for the given geometry + + the geometry to buffer + + + + Initializes a buffer computation for the given geometry + with the given set of parameters + + the geometry to buffer + the buffer parameters to use + + + + Gets or sets the number of line segments in a quarter-circle + used to approximate angle fillets for round end caps and joins. + + + + + Returns the buffer computed for a geometry for a given buffer distance. + + the buffer distance + the buffer of the input geometry + + + + A value class containing the parameters which + specify how a buffer should be constructed. + + The parameters allow control over: + + Quadrant segments (accuracy of approximation for circular arcs) + End Cap style + Join style + Mitre limit + whether the buffer is single-sided + + + Martin Davis + + + + The default number of facets into which to divide a fillet of 90 degrees.
+ A value of 8 gives less than 2% max error in the buffer distance. + For a max error of < 1%, use QS = 12. + For a max error of < 0.1%, use QS = 18. +
+
+ + + The default number of facets into which to divide a fillet of 90 degrees.
+ A value of 8 gives less than 2% max error in the buffer distance. + For a max error of < 1%, use QS = 12. + For a max error of < 0.1%, use QS = 18. +
+
+ + + The default mitre limit + Allows fairly pointy mitres. + + + + + The default simplify factor. + Provides an accuracy of about 1%, which matches + the accuracy of the parameter. + + + + + Creates a default set of parameters + + + + + Creates a set of parameters with the given quadrantSegments value. + + The number of quadrant segments to use + + + + Creates a set of parameters with the + given quadrantSegments and endCapStyle values. + + the number of quadrant segments to use + the end cap style to use + + + + Creates a set of parameters with the + given parameter values. + + the number of quadrant segments to use + the end cap style to use + the join style to use + the mitre limit to use + + + + Gets or sets the number of line segments in a quarter-circle + used to approximate angle fillets in round endcaps and joins. + The value should be at least 1. + + This determines the + error in the approximation to the true buffer curve.
+ The default value of 8 gives less than 2% error in the buffer distance. + For an error of < 1%, use QS = 12. + For an error of < 0.1%, use QS = 18. + The error is always less than the buffer distance + (in other words, the computed buffer curve is always inside the true + curve). +
+
+ + + Computes the maximum distance error due to a given level of approximation to a true arc. + + The number of segments used to approximate a quarter-circle + The error of approximation + + + + Gets or sets the end cap style of the generated buffer. + + + + The styles supported are , + , and + . + + The default is . + + + + + Gets/Sets the join style for outside (reflex) corners between line segments. + + + The styles supported are , + and + The default is + + + + + Sets the limit on the mitre ratio used for very sharp corners. + + + + The mitre ratio is the ratio of the distance from the corner + to the end of the mitred offset corner. + When two line segments meet at a sharp angle, + a miter join will extend far beyond the original geometry. + (and in the extreme case will be infinitely far.) + To prevent unreasonable geometry, the mitre limit + allows controlling the maximum length of the join corner. + Corners with a ratio which exceed the limit will be beveled. + + + + + + Gets or sets whether the computed buffer should be single-sided. + A single-sided buffer is constructed on only one side of each input line. + + The side used is determined by the sign of the buffer distance: + + a positive distance indicates the left-hand side + a negative distance indicates the right-hand side + + The single-sided buffer of point geometries is the same as the regular buffer. + + The End Cap Style for single-sided buffers is always ignored, + and forced to the equivalent of . + + + + + + Factor used to determine the simplify distance tolerance + for input simplification. + Simplifying can increase the performance of computing buffers. + Generally the simplify factor should be greater than 0. + Values between 0.01 and .1 produce relatively good accuracy for the generate buffer. + Larger values sacrifice accuracy in return for performance. + + + + + Creates a copy + + + + + + A connected subset of the graph of + DirectedEdges and Nodes. + Its edges will generate either + a single polygon in the complete buffer, with zero or more holes, or + one or more connected holes. + + + + + + + + + + + + + + + + + + + + Gets the rightmost coordinate in the edges of the subgraph. + + + + + Creates the subgraph consisting of all edges reachable from this node. + Finds the edges in the graph and the rightmost coordinate. + + A node to start the graph traversal from. + + + + Adds all nodes and edges reachable from this node to the subgraph. + Uses an explicit stack to avoid a large depth of recursion. + + A node known to be in the subgraph. + + + + Adds the argument node and all its out edges to the subgraph + + The node to add. + The current set of nodes being traversed. + + + + + + + + + + + + + + + Compute depths for all dirEdges via breadth-first traversal of nodes in graph. + + Edge to start processing with. + + + + + + + + + + + + + + + + Find all edges whose depths indicates that they are in the result area(s). + Since we want polygon shells to be + oriented CW, choose dirEdges with the interior of the result on the RHS. + Mark them as being in the result. + Interior Area edges are the result of dimensional collapses. + They do not form part of the result area boundary. + + + + + BufferSubgraphs are compared on the x-value of their rightmost Coordinate. + This defines a partial ordering on the graphs such that: + g1 >= g2 - Ring(g2) does not contain Ring(g1) + where Polygon(g) is the buffer polygon that is built from g. + This relationship is used to sort the BufferSubgraphs so that shells are guaranteed to + be built before holes. + + + + + End cap style constants + + + + + Specifies a round line buffer end cap style. + + + + + Specifies a flat line buffer end cap style. + + + + + Specifies a square line buffer end cap style. + + + + + Join style constants + + + + + Specifies a round join style. + + + + + Specifies a mitre join style. + + + + + Specifies a bevel join style. + + + + + Computes an offset curve from a geometry. + The offset curve is a linear geometry which is offset a specified distance + from the input. + If the offset distance is positive the curve lies on the left side of the input; + if it is negative the curve is on the right side. + + The offset curve of a line is a . + The offset curve of a Point is an empty . + The offset curve of a Polygon is the boundary of the polygon buffer (which + may be a . + For a collection the output is a {@link MultiLineString} of the element offset curves. + + The offset curve is computed as a single contiguous section of the geometry buffer boundary. + In some geometric situations this definition is ill-defined. + This algorithm provides a "best-effort" interpretation. + In particular: + + For self-intersecting lines, the buffer boundary includes + offset lines for both left and right sides of the input line. + Only a single contiguous portion on the specified side is returned. + If the offset corresponds to buffer holes, only the largest hole is used. + + Offset curves support setting the number of quadrant segments, + the join style, and the mitre limit(if applicable) via + the . + + Martin Davis + + + + The nearness tolerance between the raw offset linework and the buffer curve. + + + + + Computes the offset curve of a geometry at a given distance. + + A geometry + the offset distance (positive = left, negative = right) + The offset curve + + + + Computes the offset curve of a geometry at a given distance, + and for a specified quadrant segments, join style and mitre limit. + + A geometry + The offset distance (positive = left, negative = right) + The quadrant segments + The join style + The mitre limit + The offset curve + + + + Creates a new instance for computing an offset curve for a geometryat a given distance. + with default quadrant segments( + and join style (). + + The geometry + A distance value + + + Creates a new instance for computing an offset curve for a geometry at a given distance. + allowing the quadrant segments and join style and mitre limit to be set + via {@link BufferParameters}. + + @param geom + @param distance + @param bufParams + + + + Gets the computed offset curve. + + The offset curve geometry + + + + Force LinearRings to be LineStrings. + + A geometry, which may be a LinearRing + A geometry which will be a LineString or MulitLineString + + + + Gets the raw offset line. + The quadrant segments and join style and mitre limit to be set + via . + + The raw offset line may contain loops and other artifacts which are + not present in the true offset curve. + The raw offset line is matched to the buffer ring (which is clean) + to extract the offset curve. + + The LineString to offset + The offset distance + The buffer parameters to use + The raw offset line + + + + Gets the raw offset line, with default buffer parameters. + + The LineString to offset + The offset distance + The raw offset line + + + + Extracts the largest polygon by area from a geometry. + Used here to avoid issues with non-robust buffer results which have spurious extra polygons. + + A geometry + The polygon element of largest area + + + + An action to match a raw offset curve segment + to segments in the buffer ring + and mark them as being in the offset curve. + + Martin Davis + + + + Extracts a section of a ring of coordinates, starting at a given index, + and keeping coordinates which are flagged as being required. + + The ring of points + The index of the start coordinate + A flag indicating if coordinate is to be extracted + + + + Computes the raw offset curve for a + single component (ring, line or point). + A raw offset curve line is not noded - + it may contain self-intersections (and usually will).g + The final buffer polygon is computed by forming a topological graph + of all the noded raw curves and tracing outside contours. + The points in the raw curve are rounded + to a given . + + + + + Gets the buffer parameters being used to generate the curve. + + + + + This method handles single points as well as LineStrings. + LineStrings are assumed not to be closed (the function will not + fail for closed lines, but will generate superfluous line caps). + + The vertices of the line to offset + The offset distance + A Coordinate array representing the curve
+ or null if the curve is empty +
+
+ + + Tests whether the offset curve for line or point geometries + at the given offset distance is empty (does not exist). + This is the case if: + + the distance is zero + the distance is negative, except for the case of singled-sided buffers + + + The offset curve distance + true if the offset curve is empty + + + + This method handles the degenerate cases of single points and lines, + as well as rings. + + A Coordinate array representing the curve
+ or null if the curve is empty
+
+ + + This method handles the degenerate cases of single points and lines, + as well as rings. + + A Coordinate array representing the curve
+ or null if the curve is empty
+
+ + + Computes the distance tolerance to use during input + line simplification. + + The buffer distance + The simplification tolerance + + + + Creates all the raw offset curves for a buffer of a Geometry. + Raw curves need to be noded together and polygonized to form the final buffer area. + + + + + + + + + + + + + Gets or sets a value indicating whether the offset curve is generated + using the inverted orientation of input rings. + This allows generating a buffer(0) polygon from the smaller lobes + of self-crossing rings. + + + + + Computes orientation of a ring using a signed-area orientation test. + For invalid (self-crossing) rings this ensures the largest enclosed area + is taken to be the interior of the ring. + This produces a more sensible result when + used for repairing polygonal geometry via buffer-by-zero. + For buffer use the lower robustness of orientation-by-area + doesn't matter, since narrow or flat rings + produce an acceptable offset curve for either orientation. + + The ring coordinates + true if the ring is CCW + + + + Computes the set of raw offset curves for the buffer. + Each offset curve has an attached {Label} indicating + its left and right location. + + A Collection of SegmentStrings representing the raw buffer curves. + + + + Creates a {SegmentString} for a coordinate list which is a raw offset curve, + and adds it to the list of buffer curves. + The SegmentString is tagged with a Label giving the topology of the curve. + The curve may be oriented in either direction. + If the curve is oriented CW, the locations will be: + Left: Location.Exterior. + Right: Location.Interior. + + + + + + + + + + + + + + + + + Add a Point to the graph. + + + + + + Keeps only valid coordinates, and removes repeated points. + + The coordinates to clean + An array of clean coordinates + + + + + + + + + + Adds an offset curve for a polygon ring. + The side and left and right topological location arguments + assume that the ring is oriented CW. + If the ring is in the opposite orientation, + the left and right locations must be interchanged and the side flipped. + + The coordinates of the ring (must not contain repeated points). + The distance at which to create the buffer. + The side of the ring on which to construct the buffer line. + The location on the L side of the ring (if it is CW). + The location on the R side of the ring (if it is CW). + + +
+ Tests whether the offset curve for a ring is fully inverted. + An inverted ("inside-out") curve occurs in some specific situations + involving a buffer distance which should result in a fully-eroded (empty) buffer. + It can happen that the sides of a small, convex polygon + produce offset segments which all cross one another to form + a curve with inverted orientation.
+ This happens at buffer distances slightly greater than the distance at + which the buffer should disappear.
+ The inverted curve will produce an incorrect non-empty buffer (for a shell) + or an incorrect hole (for a hole). + It must be discarded from the set of offset curves used in the buffer. + Heuristics are used to reduce the number of cases which area checked, + for efficiency and correctness. + + See
+
+ the input ring + the buffer distance + the generated offset curve + true if the offset curve is inverted + + + + Computes the maximum distance out of a set of points to a linestring. + + The points + The linestring vertices + The maximum distance + + + + Tests whether a ring buffer is eroded completely (is empty) + based on simple heuristics. + + The is assumed to contain no repeated points. + It may be degenerate (i.e. contain only 1, 2, or 3 points). + In this case it has no area, and hence has a minimum diameter of 0. + + + + + + + + Tests whether a triangular ring would be eroded completely by the given + buffer distance. + This is a precise test. It uses the fact that the inner buffer of a + triangle converges on the inCentre of the triangle (the point + equidistant from all sides). If the buffer distance is greater than the + distance of the inCentre from a side, the triangle will be eroded completely. + This test is important, since it removes a problematic case where + the buffer distance is slightly larger than the inCentre distance. + In this case the triangle buffer curve "inverts" with incorrect topology, + producing an incorrect hole in the buffer. + + + + + + + + A list of the vertices in a constructed offset curve. + + Automatically removes close adjacent vertices. + Martin Davis + + + + Gets/Sets the precision model to use when adding new points. + + + + + The distance below which two adjacent points on the curve are considered to be coincident. + + This is chosen to be a small fraction of the offset distance. + + + + Function to add a point + + + The point is only added if evaluates to false. + + The point to add. + + + + Tests whether the given point duplicates the previous point in the list (up to tolerance) + + The point to test + true if the point duplicates the previous point + + + + Automatically closes the ring (if it not alread is). + + + + + Gets the Coordinates for the curve. + + + + + + + + Generates segments which form an offset curve. + Supports all end cap and join options + provided for buffering. + This algorithm implements various heuristics to + produce smoother, simpler curves which are + still within a reasonable tolerance of the + true curve. + + Martin Davis + + + + Factor which controls how close offset segments can be to + skip adding a filler or mitre. + + + + + Factor which controls how close curve vertices on inside turns can be to be snapped + + + + + Factor which controls how close curve vertices can be to be snapped + + + + + Factor which determines how short closing segs can be for round buffers + + + + + The max error of approximation (distance) between a quad segment and the true fillet curve + + + + + The angle quantum with which to approximate a fillet curve + (based on the input # of quadrant segments) + + + + + The Closing Segment Length Factor controls how long + "closing segments" are. Closing segments are added + at the middle of inside corners to ensure a smoother + boundary for the buffer offset curve. + In some cases (particularly for round joins with default-or-better + quantization) the closing segments can be made quite short. + This substantially improves performance (due to fewer intersections being created). + + A closingSegFactor of 0 results in lines to the corner vertex + A closingSegFactor of 1 results in lines halfway to the corner vertex + A closingSegFactor of 80 results in lines 1/81 of the way to the corner vertex + (this option is reasonable for the very common default situation of round joins + and quadrantSegs >= 8) + + + + + + Gets whether the input has a narrow concave angle + (relative to the offset distance). + In this case the generated offset curve will contain self-intersections + and heuristic closing segments. + This is expected behaviour in the case of buffer curves. + For pure offset curves, + the output needs to be further treated + before it can be used. + + + + + Add last offset point + + + + + Adds the offset points for an outside (convex) turn + + + + + Adds the offset points for an inside (concave) turn. + + + + + + + Compute an offset segment for an input segment on a given side and at a given distance. + The offset points are computed in full double precision, for accuracy. + + The segment to offset + The side of the segment the offset lies on + The offset distance + The points computed for the offset segment + + + + Add an end cap around point , terminating a line segment coming from + + + + + + + Adds a mitre join connecting two convex offset segments. + The mitre is beveled if it exceeds the mitre limit factor. + The mitre limit is intended to prevent extremely long corners occurring. + If the mitre limit is very small it can cause unwanted artifacts around fairly flat corners. + This is prevented by using a simple bevel join in this case. + In other words, the limit prevents the corner from getting too long, + but it won't force it to be very short/flat. + + A corner point + The first offset segment + The second offset segment + The offset distance + + + + Adds a limited mitre join connecting two convex offset segments. + A limited mitre join is beveled at the distance + determined by the mitre limit factor, + or as a standard bevel join, whichever is further. + + The first offset segment + The second offset segment + The offset distance + The mitre limit distance + + + + Projects a point to a given distance in a given direction angle. + + The point to project + The projection distance + The direction angle (in radians) + The projected point + + + + Adds a bevel join connecting the two offset segments + around a reflex corner. + + The first offset segment + The second offset segment + + + + Add points for a circular fillet around a convex corner. + Adds the start and end points + + Base point of curve + Start point of fillet curve + Endpoint of fillet curve + The orientation of the fillet + The radius of the fillet + + + + Adds points for a circular fillet arc + between two specified angles. + The start and end point for the fillet are not added - + the caller must add them if required. + + The center point + Is -1 for a angle, 1 for a angle + The start angle of the fillet + The end angle of the fillet + The radius of the fillet + + + + Creates a circle around a point + + + + + Creates a square around a point + + + + + A dynamic list of the vertices in a constructed offset curve. + Automatically removes adjacent vertices + which are closer than a given tolerance. + + Martin Davis + + + + The distance below which two adjacent points on the curve + are considered to be coincident.
+ This is chosen to be a small fraction of the offset distance. +
+
+ + + Tests whether the given point is redundant + relative to the previous + point in the list (up to tolerance). + + + true if the point is redundant + + + + Computes the raw offset curve for a single component (ring, line or point). + + + A raw offset curve line is not noded - it may contain self-intersections (and usually will). + The final buffer polygon is computed by forming a topological graph + of all the noded raw curves and tracing outside contours. + The points in the raw curve are rounded to the required precision model. + + + + + The angle quantum with which to approximate a fillet curve + (based on the input # of quadrant segments) + + + + + The max error of approximation (distance) between a quad segment and the true fillet curve + + + + + Factor which controls how close curve vertices can be to be snapped + + + + + Factor which controls how close offset segments can be to + skip adding a filler or mitre. + + + + + Factor which controls how close curve vertices on inside turns can be to be snapped + + + + + Factor which determines how short closing segs can be for round buffers + + + + + The Closing Segment Factor controls how long + "closing segments" are. Closing segments are added + at the middle of inside corners to ensure a smoother + boundary for the buffer offset curve.
+ In some cases (particularly for round joins with default-or-better + quantization) the closing segments can be made quite short. + This substantially improves performance (due to fewer intersections being created). +
+ A closingSegFactor of 0 results in lines to the corner vertex
+ A closingSegFactor of 1 results in lines halfway to the corner vertex
+ A closingSegFactor of 80 results in lines 1/81 of the way to the corner vertex + (this option is reasonable for the very common default situation of round joins + and quadrantSegs >= 8) +
+
+ + + This method handles single points as well as lines. + Lines are assumed to not be closed (the function will not + fail for closed lines, but will generate superfluous line caps). + + a List of Coordinate[] + + + + This method handles the degenerate cases of single points and lines, as well as rings. + + a List of Coordinate[] + + + + This method handles the degenerate cases of single points and lines, as well as rings. + + a List of Coordinate[] + + + + Use a value which results in a potential distance error which is + significantly less than the error due to + the quadrant segment discretization. + For QS = 8 a value of 100 is reasonable. + This should produce a maximum of 1% distance error. + + + + + Computes the distance tolerance to use during input + line simplification. + + The buffer distance + The simplification tolerance + + + + Adds the offset points for an outside (convex) turn + + + + + + + + Adds the offset points for an inside (concave) turn. + + + + + + + Add last offset point + + + + + Compute an offset segment for an input segment on a given side and at a given distance. + The offset points are computed in full double precision, for accuracy. + + The segment to offset + The side of the segment () the offset lies on + The offset distance + The points computed for the offset segment + + + + Add an end cap around point p1, terminating a line segment coming from p0 + + + + + Adds a mitre join connecting the two reflex offset segments. + The mitre will be beveled if it exceeds the mitre ratio limit. + + The base point + The first offset segment + The second offset segment + The offset distance + + + + Adds a limited mitre join connecting the two reflex offset segments. + + + A limited mitre is a mitre which is beveled at the distance + determined by the mitre ratio limit. + + The first offset segment + The second offset segment + The offset distance + The mitre limit ratio + + + + Adds a bevel join connecting the two offset segments around a reflex corner. + + The first offset segment + The second offset segment + + + + Add points for a circular fillet around a reflex corner. Adds the start and end points + + Base point of curve + Start point of fillet curve + Endpoint of fillet curve + The orientation of the fillet + The radius of the fillet + + + + Adds points for a circular fillet arc between two specified angles. + + + The start and end point for the fillet are not added - the caller must add them if required. + + The point around which to add the fillet points + The start angle (in radians) + The end angle (in radians) + Is -1 for a CW angle, 1 for a CCW angle + The radius of the fillet + + + + Adds a CW circle around a point + + + + + Adds a CW square around a point + + + + + A RightmostEdgeFinder find the DirectedEdge in a list which has the highest coordinate, + and which is oriented L to R at that point. (I.e. the right side is on the RHS of the edge.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A spatial index over a segment sequence + using s. + + Martin Davis + + + + Locates a subgraph inside a set of subgraphs, + in order to determine the outside depth of the subgraph. + The input subgraphs are assumed to have had depths + already calculated for their edges. + + + + + + + + + + + + + + + + + + Finds all non-horizontal segments intersecting the stabbing line. + The stabbing line is the ray to the right of stabbingRayLeftPt. + + The left-hand origin of the stabbing line. + A List of {DepthSegments} intersecting the stabbing line. + + + + Finds all non-horizontal segments intersecting the stabbing line + in the list of dirEdges. + The stabbing line is the ray to the right of stabbingRayLeftPt. + + The left-hand origin of the stabbing line. + + The current list of DepthSegments intersecting the stabbing line. + + + + Finds all non-horizontal segments intersecting the stabbing line + in the input dirEdge. + The stabbing line is the ray to the right of stabbingRayLeftPt. + + The left-hand origin of the stabbing line. + + The current list of DepthSegments intersecting the stabbing line. + + + + A segment from a directed edge which has been assigned a depth value + for its sides. + + + + + Gets or sets the depth to the left of this segment + + + + + Initializes this DepthSegments + + A line segment + A depth value + + + + Defines a comparison operation on s + which orders them left to right. + + + Assumes the segments are normalized. + + The definition of ordering is: + + -1if DS1.seg is left of or below DS2.seg (DS1 < DS2). + 1if DS1.seg is right of or above DS2.seg (DS1 > DS2). + 0if the segments are identical + + Known Bugs: + + The logic does not obey the contract. + This is acceptable for the intended usage, but may cause problems if used with some + utilities in the .Net standard library (e.g. . + + + A DepthSegment + The comparison value + + + + Finds the approximate maximum distance from a buffer curve to + the originating geometry. + + The approximate maximum distance is determined by testing + all vertices in the buffer curve, as well + as midpoints of the curve segments. + Due to the way buffer curves are constructed, this + should be a very close approximation. + This is similar to the Discrete Oriented Hausdorff distance + from the buffer curve to the input. + + mbdavis + + + + Validates that a given buffer curve lies an appropriate distance + from the input generating it. + + + Useful only for round buffers (cap and join). + Can be used for either positive or negative distances. + + This is a heuristic test, and may return false positive results + (I.e. it may fail to detect an invalid result.) + It should never return a false negative result, however + (I.e. it should never report a valid result as invalid.) + + mbdavis + + + + Gets a geometry which indicates the location and nature of a validation failure. + + The indicator is a line segment showing the location and size + of the distance discrepancy. + + + A geometric error indicator + or null, if no error was found + + + + Checks that two geometries are at least a minimum distance apart. + + A geometry + A geometry + The minimum distance the geometries should be separated by + + + + Checks that the furthest distance from the buffer curve to the input + is less than the given maximum distance. + + + This uses the Oriented Hausdorff distance metric. It corresponds to finding + the point on the buffer curve which is furthest from some point on the input. + + A geometry + A geometry + The maximum distance that a buffer result can be from the input + + + + Validates that the result of a buffer operation + is geometrically correct, within a computed tolerance. + + + This is a heuristic test, and may return false positive results + (I.e. it may fail to detect an invalid result.) + It should never return a false negative result, however + (I.e. it should never report a valid result as invalid.) + This test may be (much) more expensive than the original buffer computation. + + Martin Davis + + + Checks whether the geometry buffer is valid, and returns an error message if not. + + + + + An appropriate error message
+ or nullif the buffer is valid
+ +
+ + + Gets the error message + + + + + Gets the error location + + + + + Gets a geometry which indicates the location and nature of a validation failure. + + If the failure is due to the buffer curve being too far or too close + to the input, the indicator is a line segment showing the location and size + of the discrepancy. + + + A geometric error indicator
+ or null, if no error was found
+
+ + + Computes the Euclidean distance (L2 metric) from a Point to a Geometry. + Also computes two points which are separated by the distance. + + + + + Contains a pair of points and the distance between them. + Provides methods to update with a new point pair with + either maximum or minimum distance. + + + + + Initializes the points, avoiding recomputing the distance. + + The first point + The second point + The distance between and + + + + Creates a buffer polygon with a varying buffer distance + at each vertex along a line. + + Only single lines are supported as input, since buffer widths + generally need to be specified individually for each line. + + Martin Davis + + + + Creates a buffer polygon along a line with the buffer distance interpolated + between a start distance and an end distance. + + The line to buffer + The buffer width at the start of the line + The buffer width at the end of the line + The variable-distance buffer polygon + + + + Creates a buffer polygon along a line with the buffer distance interpolated + between a start distance, a middle distance and an end distance. + The middle distance is attained at + the vertex at or just past the half-length of the line. + For smooth buffering of a (or the rings of a ) + the start distance and end distance should be equal. + + The line to buffer + The buffer width at the start of the line + The buffer width at the middle vertex of the line + The buffer width at the end of the line + The variable-distance buffer polygon + + + + Creates a buffer polygon along a line with the distance specified + at each vertex. + + The line to buffer + The buffer distance for each vertex of the line + The variable-width buffer polygon + + + + Computes a list of values for the points along a line by + interpolating between values for the start and end point. + The interpolation is + based on the distance of each point along the line + relative to the total line length. + + The line to interpolate along + The start value + The end value + The array of interpolated values + + + + Computes a list of values for the points along a line by + interpolating between values for the start, middle and end points. + The interpolation is + based on the distance of each point along the line + relative to the total line length. + The middle distance is attained at + the vertex at or just past the half-length of the line. + + The line to interpolate along + The start value + The mid value + The end value + The array of interpolated values + + + + Creates a generator for a variable-distance line buffer. + + The linestring to buffer + The buffer distance for each vertex of the line + + + + Computes the buffer polygon. + + A buffer polygon + + + + Computes a variable buffer polygon for a single segment, + with the given endpoints and buffer distances. + The individual segment buffers are unioned + to form the final buffer. + + The segment start point + The segment end point + The buffer distance at the start point + The buffer distance at the end point + The segment buffer + + + + Returns a circular polygon. + + The circle center point + The radius + A polygon, or null if the radius is 0 + + + + Adds a semi-circular cap CCW around the point . + + The centre point of the cap + The cap radius + the starting point of the cap + The ending point of the cap + The coordinate list to add to + + + + Computes the angle for the given cap point index. + + The fillet angle index + + + + Computes the canonical cap point index for a given angle. + The angle is rounded down to the next lower + index. + + In order to reduce the number of points created by overlapping end caps, + cap points are generated at the same locations around a circle. + The index is the index of the points around the circle, + with 0 being the point at (1,0). + The total number of points around the circle is + 4 * . + + The angle + The index for the angle. + + +
+ Computes the two circumference points defining the outer tangent line + between two circles. + + For the algorithm see Wikipedia. + + The centre of circle 1 + The radius of circle 1 + The centre of circle 2 + The radius of circle 2 + The outer tangent line segment, or null if none exists + + + + Snap trig values to integer values for better consistency. + + The result of a trigonometric function + snapped to the integer interval + + + + A wrapper which + projects 3D coordinates into one of the + three Cartesian axis planes, + using the standard orthonormal projection + (i.e. simply selecting the appropriate ordinates into the XY ordinates). + The projected data is represented as 2D coordinates. + + Martin Davis + + + + Creates a wrapper projecting to the XY plane. + + The sequence to be projected + A sequence which projects coordinates + + + + Creates a wrapper projecting to the XZ plane. + + The sequence to be projected + A sequence which projects coordinates + + + + Creates a wrapper projecting to the YZ plane. + + The sequence to be projected + A sequence which projects coordinates + + + + + + + Find two points on two 3D s which lie within a given distance, + or else are the nearest points on the geometries (in which case this also + provides the distance between the geometries). + + 3D geometries have vertex Z ordinates defined. + 3D s are assumed to lie in a single plane (which is enforced if not actually the case). + 3D s and s may have any configuration. + + The distance computation also finds a pair of points in the input geometries + which have the minimum distance between them. If a point lies in the interior + of a line segment, the coordinate computed is a close approximation to the + exact point. + + The algorithms used are straightforward O(n^2) comparisons. This worst-case + performance could be improved on by using Voronoi techniques or spatial + indexes. + + 1.13 + + + + Compute the distance between the nearest points of two geometries. + + A geometry + A geometry + The distance between the geometries + + + + Test whether two geometries lie within a given distance of each other. + + A geometry + A geometry + The distance to test + true if g0.distance(g1) <= + + + + Compute the the nearest points of two geometries. The points are + presented in the same order as the input Geometries. + + A geometry + A geometry + The nearest points in the geometries + + + + Constructs a DistanceOp that computes the distance and nearest points + between the two specified geometries. + + A geometry + A geometry + + + + Constructs a DistanceOp that computes the distance and nearest points + between the two specified geometries. + + A geometry + A geometry + The distance on which to terminate the search + + + + Report the distance between the nearest points on the input geometries. + + The distance between the geometries
+ or 0 if either input geometry is empty
+ Thrown if either input geometry is null. +
+ + + Report the coordinates of the nearest points in the input geometries. The + points are presented in the same order as the input Geometries. + + A pair of s of the nearest points + + + + Gets the locations of the nearest points in the input geometries. The + locations are presented in the same order as the input Geometries. + + A pair of s for the nearest points + + + + Finds the index of the "most polygonal" input geometry. + This optimizes the computation of the best-fit plane, + since it is cached only for the left-hand geometry. + + The index of the most polygonal geometry + + + + Convenience method to create a Plane3DPolygon + + + + + Computes distance between two polygons. + + + To compute the distance, compute the distance + between the rings of one polygon and the other polygon, + and vice-versa. + If the polygons intersect, then at least one ring must + intersect the other polygon. + Note that it is NOT sufficient to test only the shell rings. + A counter-example is a "figure-8" polygon A + and a simple polygon B at right angles to A, with the ring of B + passing through the holes of A. + The polygons intersect, + but A's shell does not intersect B, and B's shell does not intersect A. + + + Compute distance between a polygon and the rings of another. + + + + Computes a point at a distance along a segment + specified by two relatively proportional values. + The fractional distance along the segment is d0/(d0+d1). + + Start point of the segment. + End point of the segment + Proportional distance from start point to computed point + Proportional distance from computed point to end point + The computed point + + + + Models a polygon lying in a plane in 3-dimensional Cartesian space. + The polygon representation is supplied + by a , + containing coordinates with XYZ ordinates. + 3D polygons are assumed to lie in a single plane. + The plane best fitting the polygon coordinates is + computed and is represented by a . + + Martin Davis + + + + Creates an instance of this class using the provided . + + The polygon + + + + Finds a best-fit plane for the polygon, + by sampling a few points from the exterior ring. + + The algorithm used is Newell's algorithm: + + a base point for the plane is determined from the average of all vertices + the normal vector is determined by computing the area of the projections on each of the axis planes + + + The polygon to determine the plane for + The best-fit plane + + + + Computes an average normal vector from a list of polygon coordinates. + Uses Newell's method, which is based + on the fact that the vector with components + equal to the areas of the projection of the polygon onto + the Cartesian axis planes is normal. + + The sequence of coordinates for the polygon + A normal vector + + + + Computes a point which is the average of all coordinates + in a sequence.
+ If the sequence lies in a single plane, + the computed point also lies in the plane. +
+ A coordinate sequence + A Coordinate with averaged ordinates +
+ + + Gets a value indicating the plane + + + + + Gets a value indicating the polygon + + + + + Checks if intersects with this . + + The point to check + true if intPt intersects this PlanarPolygon3d. + + + + Checks if the point intersects with when projected to this instance's facing plane + + A point + A ring + true if point and linestring intersect + + + + A ConnectedElementPointFilter extracts a single point + from each connected element in a Geometry + (e.g. a polygon, linestring or point) + and returns them in a list. The elements of the list are + s. + Empty geometries do not provide a location item. + + + + + Returns a list containing a point from each Polygon, LineString, and Point + found inside the specified point. Thus, if the specified point is + not a GeometryCollection, an empty list will be returned. The elements of the list + are s. + + + + + + + + + + + + + + + + + Extracts a single point + from each connected element in a Geometry + (e.g. a polygon, linestring or point) + and returns them in a list + + + + + Returns a list containing a Coordinate from each Polygon, LineString, and Point + found inside the specified point. Thus, if the specified point is + not a GeometryCollection, an empty list will be returned. + + + + + + + + + + + + + + + + + Computes the distance and + closest points between two Geometrys. + The distance computation finds a pair of points in the input geometries + which have minimum distance between them. These points may + not be vertices of the geometries, but may lie in the interior of + a line segment. In this case the coordinate computed is a close + approximation to the exact point. + + Empty geometry collection components are ignored. + + The algorithms used are straightforward O(n^2) + comparisons. This worst-case performance could be improved on + by using Voronoi techniques. + + + + + Compute the distance between the closest points of two geometries. + + A Geometry. + Another Geometry. + The distance between the geometries. + + + + Test whether two geometries lie within a given distance of each other. + + + + + + + + + Compute the the closest points of two geometries. + The points are presented in the same order as the input Geometries. + + A Geometry. + Another Geometry. + The closest points in the geometries. + + + + Constructs a that computes the distance and closest points between + the two specified geometries. + + A geometry + A geometry + + + + Constructs a that computes the distance and closest points between + the two specified geometries. + + A geometry + A geometry + The distance on which to terminate the search. + + + + Report the distance between the closest points on the input geometries. + + The distance between the geometries
+ or 0 if either input geometry is empty.
+ if either input geometry is null +
+ + + Report the coordinates of the nearest points in the input geometries. + The points are presented in the same order as the input Geometries. + + A pair of Coordinates of the nearest points. + + + + Report the locations of the nearest points in the input geometries. + The locations are presented in the same order as the input Geometries. + + A pair of s for the nearest points. + + + + + + + + + + + + + + + + + + + + + + + + + + + Computes distance between facets (lines and points) of input geometries. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a sequence of facets (points or line segments) of a + specified by a subsequence of a . + + Martin Davis + + + + Creates a new sequence of facets based on a + contained in the given . + + The geometry containing the facets. + The sequence containing the facet points. + The index of the start point. + The index of the end point. + + + + Creates a new sequence of facets based on a . + + The sequence containing facet points. + The index of the start point + The index of the end point + 1 + + + + Creates a new sequence for a single point from a CoordinateSequence. + + The sequence containing the facet point. + the index of the point + + + + Gets the envelope of this facet sequence + + + + + Gets the number of coordinates in this facet sequence + + + + + Gets the coordinate at the given index + + The index + The coordinate at the given index + + + + Tests if this facet sequence consists of only one point + + + + + Computes the distance between this and another + . + + The sequence to compute the distance to. + The minimum distance between the sequences. + + + + Computes the locations of the nearest points between this sequence + and another sequence. + The locations are presented in the same order as the input sequences. + + A pair of s for the nearest points. + + + + + + + Utility class to build facet sequencs STRtrees- + + + + + + + + + + + + Creates facet sequences from a given geometry + + The geometry + A list of s + + + + Represents the location of a point on a Geometry. + Maintains both the actual point location + (which may not be exact, if the point is not a vertex) + as well as information about the component + and segment index where the point occurs. + Locations inside area Geometrys will not have an associated segment index, + so in this case the segment index will have the sentinel value of . + + + + + A special value of segmentIndex used for locations inside area geometries. + These locations are not located on a segment, + and thus do not have an associated segment index. + + + + + Constructs a GeometryLocation specifying a point on a point, as well as the + segment that the point is on (or if the point is not on a segment). + + The component of the geometry containing the point + The segment index of the location, or + The coordinate of the location + + + + Constructs a GeometryLocation specifying a point inside an area point. + + The component of the geometry containing the point + The coordinate of the location + + + + Returns the geometry component on (or in) which this location occurs. + + + + + Returns the segment index for this location. If the location is inside an + area, the index will have the value . + + + + + Returns the of this location. + + + + + Tests whether this location represents a point inside an area geometry. + + + + + + + + Computes the distance between the facets (segments and vertices) + of two s + using a Branch-and-Bound algorithm. + The Branch-and-Bound algorithm operates over a + traversal of R-trees built + on the target and the query geometries. + + This approach provides the following benefits: + + + Performance is dramatically improved due to the use of the + R-tree index + and the pruning due to the Branch-and-Bound approach + + The spatial index on the target geometry is cached + which allow reuse in an repeated query situation. + + Using this technique is usually much more performant + than using the brute-force + when one or both input geometries are large, + or when evaluating many distance computations against + a single geometry. + + + This class is thread-safe. + + Martin Davis + + + + + Computes the distance between facets of two geometries. + + + For geometries with many segments or points, + this can be faster than using a simple distance + algorithm. + + A geometry + A geometry + The distance between the two geometries + + + + Tests whether the facets of two geometries lie within a given distance. + + A geometry + A geometry + The distance limit + true if two facets lie with the given distance + + + + Computes the nearest points of the facets of two geometries. + + A geometry + A geometry + The nearest points on the facets of the geometries + + + + Creates a new distance-finding instance for a given target . + + + + Distances will be computed to all facets of the input geometry. + The facets of the geometry are the discrete segments and points + contained in its components. + + In the case of and inputs, + this is equivalent to computing the conventional distance. + + In the case of inputs, this is equivalent + to computing the distance to the polygon boundaries. + + + A Geometry, which may be of any type. + + + + Computes the distance from the base geometry to the given geometry. + + The geometry to compute the distance to. + The computed distance + + + + Computes the nearest locations on the base geometry + and the given geometry. + + Ihe geometry to compute the nearest location to. + The nearest locations. + + + + Computes the nearest locations on the target geometry + and the given geometry. + + Ihe geometry to compute the nearest point to. + The nearest points. + + + + Tests whether the base geometry lies within + a specified distance of the given geometry. + + The geometry to test + The maximum distance to test + true if the geometry lies with the specified distance + + + + The base class for operations that require s. + + + + + + + + + + + + + + + The operation args into an array so they can be accessed by index. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests whether a is simple. + In general, the SFS specification of simplicity + follows the rule: + + + A Geometry is simple if and only if the only self-intersections are at boundary points. + + + + + Simplicity is defined for each } subclass as follows: + + Valid geometries are simple by definition, so + IsSimple trivially returns true.
+ (Note: this means that IsSimple cannot be used to test + for (invalid) self-intersections in Polygons. + In order to check if a Polygonal geometry has self-intersections, + use ).
+ geometries are simple if and only if they do not self-intersect at interior points + (i.e. points other than boundary points). + This is equivalent to saying that no two linear components satisfy the SFS + predicate. + Zero-dimensional () geometries are simple if and only if they have no + repeated points. + Empty s are always simple by definition. +
+ For geometries the evaluation of simplicity + can be customized by supplying a + to define how boundary points are determined. + The default is the SFS-standard . + Note that under the Mod-2 rule, closed LineStrings (rings) + will never satisfy the touches predicate at their endpoints, since these are + interior points, not boundary points. + If it is required to test whether a set of LineStrings touch + only at their endpoints, use IsSimpleOp with . + For example, this can be used to validate that a set of lines form a topologically valid + linear network. +
+
+ + + Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule + + The geometry to test + + + + Creates a simplicity checker using a given + + The geometry to test + The rule to use + + + + Tests whether the geometry is simple. + + true if the geometry is simple + + + + Gets a coordinate for the location where the geometry fails to be simple. + (i.e. where it has a non-boundary self-intersection). + must be called before this location is accessed + + a coordinate for the location of the non-boundary self-intersection + or null if the geometry is simple + + + + Computes simplicity for polygonal geometries. + Polygonal geometries are simple if and only if + all of their component rings are simple. + + A Polygonal geometry + true if the geometry is simple + + + Semantics for GeometryCollection is + simple if all components are simple. + A GeometryCollection + true if the geometry is simple + + + + For all edges, check if there are any intersections which are NOT at an endpoint. + The Geometry is not simple if there are intersections not at endpoints. + + + + + + + + + + + Creates an instance of this class + + The endpoint + + + + Tests that no edge intersection is the endpoint of a closed line. + This ensures that closed lines are not touched at their endpoint, + which is an interior point according to the Mod-2 rule + To check this we compute the degree of each endpoint. + The degree of endpoints of closed lines + must be exactly 2. + + + + + Add an endpoint to the map, creating an entry for it if none exists. + + + + + + + + A sequence of LineMergeDirectedEdges forming one of the lines that will + be output by the line-merging process. + + + + + Constructs an EdgeString with the given factory used to convert this EdgeString + to a LineString. + + + + + + Adds a directed edge which is known to form part of this line. + + + + + + + + + + + Converts this EdgeString into a LineString. + + + + + A com.vividsolutions.jts.planargraph.DirectedEdge of a LineMergeGraph. + + + + + Constructs a LineMergeDirectedEdge connecting the from node to the to node. + + + + + specifies this DirectedEdge's direction (given by an imaginary + line from the from node to directionPt). + + + whether this DirectedEdge's direction is the same as or + opposite to that of the parent Edge (if any). + + + + + Returns the directed edge that starts at this directed edge's end point, or null + if there are zero or multiple directed edges starting there. + + + + + An edge of a LineMergeGraph. The marked field indicates + whether this Edge has been logically deleted from the graph. + + + + + Constructs a LineMergeEdge with vertices given by the specified LineString. + + + + + + Returns the LineString specifying the vertices of this edge. + + + + + A planar graph of edges that is analyzed to sew the edges together. The + marked flag on s + and s indicates whether they have been + logically deleted from the graph. + + + + + Adds an Edge, DirectedEdges, and Nodes for the given LineString representation + of an edge. + + + + + + + + + + + + Sews together a set of fully noded LineStrings. + + + Sewing stops at nodes of degree 1 + or 3 or more -- the exception is an isolated loop, which only has degree-2 nodes, + in which case a node is simply chosen as a starting point. The direction of each + merged LineString will be that of the majority of the LineStrings from which it + was derived. + + Any dimension of Geometry is handled -- the constituent linework is extracted to + form the edges. The edges must be correctly noded; that is, they must only meet + at their endpoints. The LineMerger will still run on incorrectly noded input + but will not form polygons from incorrected noded edges. + + NOTE:once merging has been performed, no more + + + + + + + + + + + + + + + + + + + + + + Adds a Geometry to be processed. May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be + extracted. + + + + + + Adds a collection of Geometries to be processed. May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be + extracted. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the LineStrings built by the merging process. + + + + + + + Builds a sequence from a set of s, + so that they are ordered end to end. + A sequence is a complete non-repeating list of the linear + components of the input. Each linestring is oriented + so that identical endpoints are adjacent in the list. + + + The input linestrings may form one or more connected sets. + The input linestrings should be correctly noded, or the results may + not be what is expected. + The output of this method is a single , + containing the ordered linestrings in the sequence. + + + The sequencing employs the classic 'Eulerian path' graph algorithm. + Since Eulerian paths are not uniquely determined, further rules are used to + make the computed sequence preserve as much as possible of the input ordering. + Within a connected subset of lines, the ordering rules are: + - If there is degree-1 node which is the start + node of an linestring, use that node as the start of the sequence. + - If there is a degree-1 node which is the end + node of an linestring, use that node as the end of the sequence. + - If the sequence has no degree-1 nodes, use any node as the start + + + Not all arrangements of lines can be sequenced. + For a connected set of edges in a graph, + Euler's Theorem states that there is a sequence containing each edge once + if and only if there are no more than 2 nodes of odd degree. + If it is not possible to find a sequence, the + property will return false. + + + + + + Tests whether a is sequenced correctly. + s are trivially sequenced. + s are checked for correct sequencing. + Otherwise, IsSequenced is defined + to be true for geometries that are not lineal. + + The to test. + + true if the is sequenced or is not lineal. + + + + + Adds a of s to be sequenced. + May be called multiple times. + Any dimension of Geometry may be added; the constituent linework will be extracted. + + A of geometries to add. + + + + Adds a to be sequenced. + May be called multiple times. + Any dimension of may be added; + the constituent linework will be extracted. + + + + + + A private implementation for + + + + + Initializes a new instance of the class. + + The sequencer. + + + + Performs an operation with or on + + + A to which the filter is applied. + + + + + Tests whether the arrangement of linestrings has a valid sequence. + + true if a valid sequence exists. + + + + Returns the or + built by the sequencing process, if one exists. + + The sequenced linestrings, + or null if a valid sequence does not exist. + + + + Tests whether a complete unique path exists in a graph + using Euler's Theorem. + + The containing the edges. + true if a sequence exists. + + + + Finds an for an unvisited edge (if any), + choosing the which preserves orientation, if possible. + + The to examine. + + The found, + or null if none were unvisited. + + + + + Computes a version of the sequence which is optimally + oriented relative to the underlying geometry. + + Heuristics used are: + - If the path has a degree-1 node which is the start + node of an linestring, use that node as the start of the sequence. + - If the path has a degree-1 node which is the end + node of an linestring, use that node as the end of the sequence. + - If the sequence has no degree-1 nodes, use any node as the start + (NOTE: in this case could orient the sequence according to the majority of the + linestring orientations). + + + A of s. + + A of s oriented appropriately. + + + + + Reverse the sequence. + This requires reversing the order of the s, + and flipping each as well. + + + A enumeration of s, + in sequential order. + + The reversed sequence. + + + + Builds a geometry ( or ) + representing the sequence. + + + An enumeration of s of s + with s as their parent edges. + + + The sequenced geometry, or null if no sequence exists. + + + + + Unions a valid coverage of polygons or lines + in an efficient way. + + A valid polygonal coverage is a collection of s + which satisfy the following conditions: + + Vector-cleanLine segments within the collection + must either be identical or intersect only at endpoints. + Non-overlappingNo two polygons + may overlap. Equivalently, polygons must be interior-disjoint. + + + A valid linear coverage is a collection of s + which satisfies the Vector-clean condition. + Note that this does not require the LineStrings to be fully noded + - i.e. they may contain coincident linework. + Coincident line segments are dissolved by the union. + Currently linear output is not merged (this may be added in a future release.) + + Currently no checking is done to determine whether the input is a valid coverage. + This is because coverage validation involves segment intersection detection, + which is much more expensive than the union phase. + If the input is not a valid coverage + then in some cases this will be detected during processing + and a is thrown. + Otherwise, the computation will produce output, but it will be invalid. + + Unioning a valid coverage implies that no new vertices are created. + This means that a precision model does not need to be specified. + The precision of the vertices in the output geometry is not changed. + + Martin Davis + + + + + Unions a valid polygonal coverage or linear network. + + A coverage of polygons or lines + The union of the coverage + Thrown in some cases if the coverage is invalid + + + + Represents the linework for edges in a topology graph, + derived from(up to) two parent geometries. + An edge may be the result of the merging of + two or more edges which have the same linework + (although possibly different orientations). + In this case the topology information is + derived from the merging of the information in the + source edges.
+ Merged edges can occur in the following situations + + Due to coincident edges of polygonal or linear geometries. + Due to topology collapse caused by snapping or rounding + of polygonal geometries. + + The source edges may have the same parent geometry, + or different ones, or a mix of the two. +
+ Martin Davis +
+ + + Tests if the given point sequence + is a collapsed line. + A collapsed edge has fewer than two distinct points. + + The point sequence to check + true if the points form a collapsed line + + + + Compares two coincident edges to determine + whether they have the same or opposite direction. + + An edge + true if the edges have the same direction, false if not + + + + Populates the label for an edge resulting from an input geometry. + + + If the edge is not part of the input, the label is left as + If input is an Area and the edge is on the boundary (which may include some collapses), edge is marked as an edge and side locations are assigned + If input is an Area and the edge is collapsed (depth delta = 0), the label is set to . The location will be determined later by evaluating the final graph topology. + If input is a Line edge is set to a edge. For line edges the line location is not significant (since there is no parent area for which to determine location). + + + + + + Tests whether the edge is part of a shell in the given geometry. + This is only the case if the edge is a boundary. + + The index of the geometry + true if this edge is a boundary and part of a shell + + + + Merges an edge into this edge, + updating the topology info accordingly. + + The edge to merge + + + + A key for sorting and comparing edges in a noded arrangement. + Relies on the fact that in a correctly noded arrangement + edges are identical (up to direction) + if they have their first segment in common. + + Martin Davis + + + + + + + + + + + + + Performs merging on the noded edges of the input geometries. + Merging takes place on edges which are coincident + (i.e.have the same coordinate list, modulo direction). + The following situations can occur: + + Coincident edges from different input geometries have their labels combined + Coincident edges from the same area geometry indicate a topology collapse. + In this case the topology locations are "summed" to provide a final + assignment of side location + Coincident edges from the same linear geometry can simply be merged + using the same ON location + + + The merging attempts to preserve the direction of linear + edges if possible(which is the case if there is + no other coincident edge, or if all coincident edges have the same direction). + This ensures that the overlay output line direction will be as consistent + as possible with input lines. + + The merger also preserves the order of the edges in the input. + This means that for polygon-line overlay + the result lines will be in the same order as in the input + (possibly with multiple result lines for a single input line). + + Martin Davis + + + + Builds a set of noded, unique, labelled Edges from + the edges of the two input geometries. + + It performs the following steps: + + Extracts input edges, and attaches topological information + if clipping is enabled, handles clipping or limiting input geometry + chooses a based on provided precision model, unless a custom one is supplied + calls the chosen Noder, with precision model + removes any fully collapsed noded edges + builds s and merges them + + + Martin Davis + + + + Creates a new builder, with an optional custom noder. + If the noder is not provided, a suitable one will + be used based on the supplied precision model. + + The precision model to use + An optional noder to use (may be null) + + + + Gets or sets a noder appropriate for the precision model supplied.
+ This is one of: + + Fixed precision:a snap-rounding noder (which should be fully robust) + Floating precision:a conventional noder (which may be non-robust). + In this case, a validation step is applied to the output from the noder. + +
+
+ + + Reports whether there are noded edges + for the given input geometry. + If there are none, this indicates that either + the geometry was empty, or has completely collapsed + (because it is smaller than the noding precision). + + index of the input geometry + true if there are edges for the geometry + + + + Creates a set of labelled {Edge}s. + representing the fully noded edges of the input geometries. + Coincident edges (from the same or both geometries) + are merged along with their labels + into a single unique, fully labelled edge. + + The first geometry + The second geometry + The noded, merged, labelled edges + + + + Nodes a set of segment strings and creates s from the result. + The input segment strings each carry a object, + which is used to provide source topology info to the constructed Edges + (and is then discarded). + + + + + Adds a polygon ring to the graph. + + Empty rings are ignored. + + + + Tests whether a geometry (represented by its envelope) + lies completely outside the clip extent(if any). + + The geometry envelope + true if the geometry envelope is outside the clip extent. + + + + If clipper is present, + clip the line to the clip extent. + + If clipping is enabled, then every ring MUST + be clipped, to ensure that holes are clipped to + be inside the shell. + This means it is not possible to skip + clipping for rings with few vertices. + + The line to clip + The points in the clipped ring + + + + Removes any repeated points from a linear component. + This is required so that noding can be computed correctly. + + The line to process + The points of the line with repeated points removed + + + + Adds a line geometry, limiting it if enabled, + and otherwise removing repeated points. + + The line to add + The index of the parent geometry + + + + Tests whether it is worth limiting a line. + Lines that have few vertices or are covered + by the clip extent do not need to be limited. + + The line to test + true if the line should be limited + + + + If limiter is provided, + limit the line to the clip envelope. + + The line to clip + the point sections in the clipped line + + + + Records topological information about an + edge representing a piece of linework (lineString or polygon ring) + from a single source geometry. + This information is carried through the noding process + (which may result in many noded edges sharing the same information object). + It is then used to populate the topology info fields + in s (possibly via merging). + That information is used to construct the topology graph s. + + Martin Davis + + + A simple elevation model used to populate missing Z values + in overlay results. + + The model divides the extent of the input geometry(s) + into an NxM grid. + The default grid size is 3x3. + If the input has no extent in the X or Y dimension, + that dimension is given grid size 1. + The elevation of each grid cell is computed as the average of the Z values + of the input vertices in that cell (if any). + If a cell has no input vertices within it, it is assigned + the average elevation over all cells. + + If no input vertices have Z values, the model does not assign a Z value. + + The elevation of an arbitrary location is determined as the + Z value of the nearest grid cell. + + An elevation model can be used to populate missing Z values + in an overlay result geometry. + + Martin Davis + + + + Creates an elevation model from two geometries (which may be null). + + An input geometry + An input geometry + The elevation model computed from the geometries + + + + Creates a new elevation model covering an extent by a grid of given dimensions. + + The XY extent to cover + The number of grid cells in the X dimension + The number of grid cells in the Y dimension + + + + Updates the model using the Z values of a given geometry. + + The geometry to scan for Z values. + + + + Gets the model Z value at a given location. + If the location lies outside the model grid extent, + this returns the Z value of the nearest grid cell. + If the model has no elevation computed (i.e. due + to empty input), the value is returned as + + x-ordinate of the location + y-ordinate of the location + The computed Z value + + + + Computes Z values for any missing Z values in a geometry, + using the computed model. + If the model has no Z value, or the geometry coordinate dimension + does not include Z, the geometry is not updated. + + The geometry to populate Z values for + + + + Locates points on a linear geometry, + using a spatial index to provide good performance. + + Martin Davis + + + + Manages the input geometries for an overlay operation. + The second geometry is allowed to be null, + to support for instance precision reduction. + + Martin Davis + + + + Gets the index of an input which is an area, + if one exists. + Otherwise returns -1. + + The index of an area input, or -1 + + + + Tests if an input geometry has edges. + This indicates that topology needs to be computed for them. + + + true if the input geometry has edges + + + + Determines the location within an area geometry. + This allows disconnected edges to be fully + located. + + The index of the geometry + The coordinate to locate + The location of the coordinate + + + + + Extracts Point resultants from an overlay graph + created by an Intersection operation + between non-Point inputs. + Points may be created during intersection + if lines or areas touch one another at single points. + Intersection is the only overlay operation which can + result in Points from non-Point inputs. + + Overlay operations where one or more inputs + are Points are handled via a different code path. + + Martin Davis + + + + + Controls whether lines created by area topology collapses + to participate in the result computation.
+ True provides the original JTS semantics. +
+
+ + + Tests if a node is a result point. + This is the case if the node is incident on edges from both + inputs, and none of the edges are themselves in the result. + + An edge originating at the node + true if the node is a result point. + + + + Finds and builds overlay result lines from the overlay graph. + Output linework has the following semantics: + + Linework is fully noded + Lines are as long as possible between nodes + + Various strategies are possible for how to + merge graph edges into lines. + This implementation uses the approach + of having output lines run contiguously from node to node. + For rings a node point is chosen arbitrarily. + + Another possible strategy would be to preserve input linework + as far as possible (i.e.any sections of input lines which are not + coincident with other linework would be preserved). + + It would also be possible to output LinearRings, + if the input is a LinearRing and is unchanged. + This will require additional info from the input linework. + + Martin Davis + + + + Indicates whether intersections are allowed to produce + heterogeneous results including proper boundary touches. + This does not control inclusion of touches along collapses.
+ True provides the original JTS semantics. +
+
+ + + Allow lines created by area topology collapses + to appear in the result.
+ True provides the original JTS semantics. +
+
+ + + Creates a builder for linear elements which may be present + in the overlay result. + + The input geometries + The topology graph + true if an area has been generated for the result + The overlay operation code + The output geometry factory + + + + Checks if the topology indicated by an edge label + determines that this edge should be part of a result line. + + Note that the logic here relies on the semantic + that for intersection lines are only returned if + there is no result area components. + + The label for an edge + true if the edge should be included in the result + + + + Determines the effective location for a line, + for the purpose of overlay operation evaluation. + Line edges and Collapses are reported as INTERIOR + so they may be included in the result + if warranted by the effect of the operation on the two edges. + (For instance, the intersection of a line edge and a collapsed boundary + is included in the result). + + The label of line + The index of parent geometry + The effective location of the line + + + + Adds lines which form rings (i.e. have only degree-2 vertices). + + + + + Traverses edges from edgeStart which + lie in a single line (have degree = 2). + + The direction of the linework is preserved as far as possible. + Specifically, the direction of the line is determined + by the start edge direction. This implies + that if all edges are reversed, the created line + will be reversed to match. + This ensures the orientation of linework is faithful to the input + in the case of polygon-line overlay. + However, this does not provide a consistent orientation + in the case of line-line intersection(where A and B might have different orientations). + (Other more complex strategies would be possible. + E.g. using the direction of the majority of segments, + or preferring the direction of the A edges.) + + + + + Finds the next edge around a node which forms + part of a result line. + + A line edge originating at the node to be scanned + The next line edge, or null if there is none + + + + + Computes the degree of the line edges incident on a node + + Node to compute degree for + Degree of the node line edges + + + + Limits the segments in a list of segments + to those which intersect an envelope. + This creates zero or more sections of the input segment sequences, + containing only line segments which intersect the limit envelope. + Segments are not clipped, since that can move + line segments enough to alter topology, + and it happens in the overlay in any case. + This can substantially reduce the number of vertices which need to be + processed during overlay. + + This optimization is only applicable to Line geometries, + since it does not maintain the closed topology of rings. + Polygonal geometries are optimized using the . + + + Martin Davis + + + + Creates a new limiter for a given envelope. + + The envelope to limit to + + + + Limits a list of segments. + + The segment sequence to limit + The sections which intersect the limit envelope + + + + Traverses the star of edges originating at a node + and links consecutive result edges together + into maximal edge rings. + To link two edges the resultNextMax pointer + for an incoming result edge + is set to the next outgoing result edge. + + Edges are linked when: + + they belong to an area (i.e.they have sides) + they are marked as being in the result + + + Edges are linked in CCW order + (which is the order they are linked in the underlying graph). + This means that rings have their face on the Right + (in other words, + the topological location of the face is given by the RHS label of the DirectedEdge). + This produces rings with CW orientation. + + PRECONDITIONS:
+ - This edge is in the result
+ - This edge is not yet linked
+ - The edge and its sym are NOT both marked as being in the result +
+
+ + + Links the edges of a around this node + into minimal edge rings (s). + Minimal ring edges are linked in the opposite orientation (CW) + to the maximal ring. + This changes self-touching rings into a two or more separate rings, + as per the OGC SFS polygon topology semantics. + This relinking must be done to each max ring separately, + rather than all the node result edges, since there may be + more than one max ring incident at the node. + + The maximal ring to link + An edge originating at this node + + + + Tests if an edge of the maximal edge ring is already linked into + a minimal . If so, this node has already been processed + earlier in the maximal edgering linking scan. + + An edge of a maximal edgering + The maximal edgering + true if the edge has already been linked into a minimal edgering. + + + + Creates a single OverlayEdge. + + + + + A new edge based on the given coordinates and direction. + + + + Gets a which sorts by the origin Coordinates. + + + + + true indicates direction is forward along segString
+ false is reverse direction
+ The label must be interpreted accordingly. +
+
+ + + Adds the coordinates of this edge to the given list, + in the direction of the edge. + Duplicate coordinates are removed + (which means that this is safe to use for a path + of connected edges in the topology graph). + + The coordinate list to add to + + + + ets the symmetric pair edge of this edge. + + The symmetric pair edge + + + + Gets the next edge CCW around the origin of this edge, + with the same origin.
+ If the origin vertex has degree 1 then this is the edge itself. +
+ + The next edge around the origin + +
+ + + Gets or sets a link to next edge in the result ring. + The origin of the edge is the dest of this edge. + + + + + Tests whether this ring is a hole. + + true if this ring is a hole + + + + Tests whether this ring has a shell assigned to it. + + true if the ring has a shell + + + + Gets or sets a value indicating the shell for this ring.
+ The shell is the ring itself if it is not a hole, otherwise its parent shell. +
+
+ + + Computes the list of coordinates which are contained in this ring. + The coordinates are computed once only and cached. + + An array of the s in this ring + + + + Finds the innermost enclosing shell OverlayEdgeRing + containing this OverlayEdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: +
+ ring A contains ring B if envelope(ring A) contains envelope(ring B) +
+ This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell) + + To improve performance of this function the caller should + make the passed shellList as small as possible (e.g. + by using a spatial index filter beforehand). +
+ The containing EdgeRing, if there is one + or null if no containing EdgeRing is found + +
+ + + Computes the formed by this ring and any contained holes. + + The formed by this ring and its holes. + + + + A planar graph of edges, representing + the topology resulting from an overlay operation. + Each source edge is represented + by a pair of s, + with opposite(symmetric) orientation. + The pair of OverlayEdges share the edge coordinates + and a single . + + Martin Davis + + + + Gets the set of edges in this graph. + Only one of each symmetric pair of OverlayEdges is included. + The opposing edge can be found by using . + + The collection of representative edges in this graph + + + + Gets the collection of edges representing the nodes in this graph. + For each star of edges originating at a node + a single representative edge is included.
+ The other edges around the node can be found by following the next and prev links. +
+ The collection of representative node edges +
+ + + Gets an edge originating at the given node point. + + The node coordinate to query + An edge originating at the point, or null if none exists + + + + Gets the representative edges marked as being in the result area. + + The result area edges + + + + Adds an edge between the coordinates orig and dest + to this graph.
+ Only valid edges can be added (in particular, zero-length segments cannot be added) +
+ The edge to add. + The edge topology information + The created graph edge with same orientation as the linework +
+ + + Inserts a single half-edge into the graph. + The sym edge must also be inserted. + + The half-edge to insert + + + + A structure recording the topological situation + for an edge in a topology graph + used during overlay processing. + + + A label contains the topological for + one or two input geometries to an overlay operation. + An input geometry may be either a Line or an Area. + The label locations for each input geometry are populated + with the + for the edge s + when they are created or once they are computed by topological evaluation. + A label also records the(effective) dimension of each input geometry. + For area edges the role(shell or hole) + of the originating ring is recorded, to allow + determination of edge handling in collapse cases. + + In an + a single label is shared between + the two oppositely-oriented s + of a symmetric pair. + Accessors for orientation-sensitive information + are parameterized by the orientation of the containing edge. + + For each input geometry (0 and 1), the label records + that an edge is in one of the following states + (identified by thedim field). + Each state has additional information about the edge topology. + + A Boundary edge of an Area (polygon) + + dim = DIM_BOUNDARY + locLeft, locRight : the locations of the edge sides for the Area + locLine : INTERIOR + isHole : whether the edge is in a shell or a hole (the ring role) + + + + A Collapsed edge of an input Area + (formed by merging two or more parent edges) + + dim = DIM_COLLAPSE + locLine : the location of the edge relative to the effective input Area + (a collapsed spike is EXTERIOR, a collapsed gore or hole is INTERIOR) + isHole : true if all parent edges are in holes; + false if some parent edge is in a shell + + + + A Line edge from an input line + + dim = DIM_LINE + locLine : the location of the edge relative to the Line. + Initialized to LOC_UNKNOWN to simplify logic. + + + An edge which is Not Part of an input geometry + (and thus must be part of the other geometry). + + dim = NOT_PART + + + + Note that: + + an edge cannot be both a Collapse edge and a Line edge in the same input geometry, + because each input geometry must be homogeneous. + an edge may be an Boundary edge in one input geometry + and a Line or Collapse edge in the other input. + + + Martin Davis + + + + The dimension of an input geometry which is not known. + + + + + The dimension of an edge which is not part of a specified input geometry. + + + + + The dimension of an edge which is a line. + + + + + The dimension for an edge which is part of an input Area geometry boundary. + + + + + The dimension for an edge which is a collapsed part of an input Area geometry boundary. + A collapsed edge represents two or more line segments which have the same endpoints. + They usually are caused by edges in valid polygonal geometries + having their endpoints become identical due to precision reduction. + + + + + Indicates that the location is currently unknown + + + + + Creates a label for an Area edge + + The input index of the parent geometry + The location of the left side of the edge + The location of the right side of the edge + Whether the edge role is a hole or a shell + + + + Creates a label for a Line edge + + The input index of the parent geometry + + + + Creates an uninitialized label + + + + + Creates a label which is a copy of another label. + + The template label + + + + Gets the effective dimension of the given input geometry. + + The input index of the parent geometry + The dimension + + + + + + + + + Initializes the label for an input geometry which is an Area boundary. + + The input index of the parent geometry + The location of the left side of the edge + The location of the right side of the edge + Whether the edge role is a hole or a shell + + + + Initializes the label for an edge which is the collapse of + part of the boundary of an Area input geometry. + + The location of the collapsed edge relative to the + parent area geometry is initially unknown. + It must be determined from the topology of the overlay graph + + The index of the parent input geometry + Whether the dominant edge role is a hole or a shell + + + + Initializes the label for an input geometry which is a Line. + + The index of the parent input geometry + + + + Initializes the label for an edge which is not part of an input geometry. + + The index of the parent input geometry + + + + Sets the line location. +
+ This is used to set the locations for linear edges + encountered during area label propagation. +
+ The index of the input geometry + Location to set +
+ + + Sets the location of all postions for a given input. + + The index of the input geometry + The location to set + + + + Sets the location for a collapsed edge (the Line position) + for an input geometry, + depending on the ring role recorded in the label. + If the input geometry edge is from a shell, + the location is , if it is a hole + it is . + + The index of the input geometry + + + + Tests whether at least one of the sources is a Line. + + true if at least one source is a line + + + + Tests whether a source is a Line. + + The index of the input geometry + true if the input is a Line + + + + Tests whether an edge is linear (a Line or a Collapse) in an input geometry. + + The index of the input geometry + true if the edge is linear + + + + Tests whether the source of a label is known. + + The index of the input geometry + true if the source is known + + + + Tests whether a label is for an edge which is not part + of a given input geometry. + + The index of the input geometry + true if the edge is not part of the geometry + + + + Gets a value indicating if a label is for an edge which is in the boundary of either source geometry. + + true if the label is a boundary for either source + + + + Gets a value indicating if a label is for an edge which is in the boundary of both source geometries. + + true if the label is a boundary for both sources + + + + Tests if the label is a collapsed edge of one area + and is a(non-collapsed) boundary edge of the other area. + + true if the label is for a collapse coincident with a boundary + + + + Tests if a label is for an edge where two + area touch along their boundary. + + true if the edge is a boundary touch + + + + Tests if a label is for an edge which is in the boundary of a source geometry. + Collapses are not reported as being in the boundary. + + The index of the input geometry + true if the label is a boundary for the source + + + + Tests whether a label is for an edge which is a boundary of one geometry + and not part of the other. + + true if the edge is a boundary singleton + + + + Tests if the line location for a source is unknown. + + The index of the input geometry + true if the line location is unknown + + + + Tests if a line edge is inside a source geometry + (i.e.it has location ). + + The index of the input geometry + true if the line is inside the source geometry + + + + Tests if the ring role of an edge is a hole. + + The index of the input geometry + true if the ring role is a hole + + + + Tests if an edge is a Collapse for a source geometry. + + The index of the input geometry + true if the label indicates the edge is a collapse for the source + + + + Tests if a label is a Collapse has location {@link Location#INTERIOR}, + to at least one source geometry. + + true if the label is an Interior Collapse to a source geometry + + + + Tests if a label is a Collapse + and NotPart with location {@link Location#INTERIOR} for the other geometry. + + true if the label is a Collapse and a NotPart with Location Interior + + + + Gets the line location for a source geometry. + + The index of the input geometry + The line location for the source + + + + Tests if a line is in the interior of a source geometry. + + The index of the source geometry + true if the label is a line and is interior + + + + Gets the location for a of an edge of a source + for an edge with given orientation. + + The index of the input geometry + The position to get the location for + true if the orientation of the containing edge is forward + The location of the oriented position in the source + + + + Gets the location for this label for either + a Boundary or a Line edge. + This supports a simple determination of + whether the edge should be included as a result edge. + + The source index + The position for a boundary label + The direction for a boundary label + The location for the specified position + + + + Gets the linear location for the given source. + + The source geometry index + The linear location for the source + + + + Tests whether this label has side position information + for a source geometry. + + The index of the input geometry + true if at least one side position is known + + + + Creates a copy of this label + + A copy of this label + + + + Gets a symbol for the a ring role (Shell or Hole). + + true for a hole, false for a shell + The ring role symbol character + + + + Gets the symbol for the dimension code of an edge. + + The dimension code + The dimension symbol character + + + + Implements the logic to compute the full labeling + for the edges in an . + + Martin Davis + + + + Computes the topological labeling for the edges in the graph. + + + + + Labels edges around nodes based on the arrangement + of incident area boundary edges. + Also propagates the labeling to connected linear edges. + + The nodes to label + + + + Scans around a node CCW, propagating the side labels + for a given area geometry to all edges (and their sym) + with unknown locations for that geometry. + + + The geometry to propagate locations for + + + + Finds a boundary edge for this geom originating at the given + node, if one exists. + A boundary edge should exist if this is a node on the boundary + of the parent area geometry. + + An edge for this node + The parent geometry index + A boundary edge, or null if no boundary edge exists + + + + At this point collapsed edges with unknown location + must be disconnected from the boundary edges of the parent + (because otherwise the location would have + been propagated from them).
+ They can be now located based on their parent ring role(shell or hole). + (This cannot be done earlier, because the location + based on the boundary edges must take precedence.
+ There are situations where a collapsed edge has a location + which is different to its ring role - + e.g.a narrow gore in a polygon, which is in + the interior of the reduced polygon, but whose + ring role would imply the location EXTERIOR.) + + Note that collapsed edges can NOT have location determined via a PIP location check, + because that is done against the unreduced input geometry, + which may give an invalid result due to topology collapse. + + The labeling is propagated to other connected linear edges, + since there may be NOT_PART edges which are connected, + and they can be labeled in the same way. + (These would get labeled anyway during subsequent disconnected labeling pass, + but may be more efficient and accurate to do it here.) +
+
+ + + There can be edges which have unknown location + but are connected to a linear edge with known location. + In this case linear location is propagated to the connected edges. + + + + + Performs a breadth-first graph traversal to find and label + connected linear edges. + + The index of the input geometry to label. + + + + Finds all OverlayEdges which are linear + (i.e.line or collapsed) and have a known location + for the given input geometry. + + The index of the input geometry + A list of linear edges with known location + + + + At this point there may still be edges which have unknown location + relative to an input geometry.
+ This must be because they are NOT_PART edges for that geometry, + and are disconnected from any edges of that geometry. + An example of this is rings of one geometry wholly contained + in another geometry.
+ The location must be fully determined to compute a + correct result for all overlay operations. + + If the input geometry is an Area the edge location can + be determined via a PIP test. + If the input is not an Area the location is EXTERIOR. +
+
+ + + Determines the location of an edge relative to a target input geometry. + The edge has no location information + because it is disconnected from other + edges that would provide that information. + The location is determined by checking + if the edge lies inside the target geometry area(if any). + + The edge to label + The input geometry to label against + + + + Determines the for an edge within an Area geometry + via point-in-polygon location. + + NOTE this is only safe to use for disconnected edges, + since the test is carried out against the original input geometry, + and precision reduction may cause incorrect results for edges + which are close enough to a boundary to become connected. + + The parent geometry index + The edge to locate + The location of the edge. + + + + Determines the {@link Location} for an edge within an Area geometry + via point-in-polygon location, + by checking that both endpoints are interior to the target geometry. + Checking both endpoints ensures correct results in the presence of topology collapse. + + NOTE this is only safe to use for disconnected edges, + since the test is carried out against the original input geometry, + and precision reduction may cause incorrect results for edges + which are close enough to a boundary to become connected. + + The parent geometry index + The edge to locate + The location of the edge + + + + Marks an edge which forms part of the boundary of the result area. + This is determined by the overlay operation being executed, + and the location of the edge. + The relevant location is either the right side of a boundary edge, + or the line location of a non-boundary edge. + + The edge to mark + The overlay operation + + + + Unmarks result area edges where the sym edge + is also marked as in the result. + This has the effect of merging edge-adjacent result areas, + as required by polygon validity rules. + + + + + Computes an overlay where one input is Point(s) and one is not. + This class supports overlay being used as an efficient way + to find points within or outside a polygon. + + Input semantics are: + + Duplicates are removed from Point output + Non-point output is rounded and noded using the given precision model + + Output semantics are: + + An empty result is an empty atomic geometry + with dimension determined by the inputs and the operation as per overlay semantics + + + For efficiency the following optimizations are used: + + Input points are not included in the noding of the non-point input geometry + (in particular, they do not participate in snap-rounding if that is used). + If the non-point input geometry is not included in the output + it is not rounded and noded.This means that points + are compared to the non-rounded geometry. + This will be apparent in the result. + + This means that overlay is efficient to use for finding points + within or outside a polygon. + + Martin Davis + + + + Copy the non-point input geometry if not + already done by precision reduction process. + + A copy of the non-point geometry + + + + Computes the geometric overlay of two s, + using an explicit precision model to allow robust computation. + + The overlay can be used to determine any of the + following set-theoretic operations (boolean combinations) of the geometries: + + all points which lie in both geometries + all points which lie in at least one geometry + all points which lie in the first geometry but not the second + all points which lie in one geometry but not both + + Input geometries may have different dimension. + Input collections must be homogeneous (all elements must have the same dimension). + + The precision model used for the computation can be supplied + independent of the precision model of the input geometry. + The main use for this is to allow using a fixed precision + for geometry with a floating precision model. + This does two things: ensures robust computation; + and forces the output to be validly rounded to the precision model. + + For fixed precision models noding is performed using a . + This provides robust computation(as long as precision is limited to + around 13 decimal digits). + + For floating precision an is used. + This is not fully robust, so can sometimes result in + s being thrown. + For robust full-precision overlay see . + + A custom can be supplied. + This allows using a more performant noding strategy in specific cases, + for instance in . + + Note: If a is used + it is best to specify a fairly small snap tolerance, + since the intersection clipping optimization can + interact with the snapping to alter the result. + + Optionally the overlay computation can process using strict mode + (via = true). + In strict mode result semantics are: + + Lines and Points resulting from topology collapses are not included in the result + Result geometry is homogeneous + for the and operations. + Result geometry is homogeneous + for the and operations + if the inputs have the same dimension + + Strict mode has the following benefits: + + Results are simpler + Overlay operations are easily chainable + without needing to remove lower-dimension elements + + The original JTS overlay semantics corresponds to non-strict mode. + + If a robustness error occurs, a is thrown. + These are usually caused by numerical rounding causing the noding output + to not be fully noded. + For robust computation with full-precision + can be used. + + + + + The code for the Intersection overlay operation. + + + + + The code for the Union overlay operation. + + + + + The code for the Difference overlay operation. + + + + + The code for the Symmetric Difference overlay operation. + + + + + The default setting for Strict Mode. + + The original JTS overlay semantics used non-strict result + semantics, including;
+ - An Intersection result can be mixed-dimension, + due to inclusion of intersection components of all dimensions
+ - Results can include lines caused by Area topology collapse +
+
+ + + Tests whether a point with a given topological + relative to two geometries is contained in + the result of overlaying the geometries using + a given overlay operation. + + The method handles arguments of correctly + + The topological label of the point + The code for the overlay operation to test + true if the label locations correspond to the overlay + + + + Tests whether a point with given s + relative to two geometries would be contained in + the result of overlaying the geometries using + a given overlay operation. + This is used to determine whether components + computed during the overlay process should be + included in the result geometry. + + The method handles arguments of correctly. + + The code for the overlay operation to test + The code for the location in the first geometry + The code for the location in the second geometry + true if a point with given locations is in the result of the overlay operation + + + + Computes an overlay operation for + the given geometry operands, with the + noding strategy determined by the precision model. + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The precision model to use + The result of the overlay operation + + + + Computes an overlay operation for + the given geometry operands, using a supplied . + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The precision model to use (which may be null if the noder does not use one) + The noder to use + The result of the overlay operation + + + + Computes an overlay operation on the given geometry operands, + using a supplied . + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The noder to use + The result of the overlay operation + + + + Computes an overlay operation on + the given geometry operands, + using the precision model of the geometry. + and an appropriate noder. + + The noder is chosen according to the precision model specified. + + For + a snap-rounding noder is used, and the computation is robust. + For + a non-snapping noder is used, + and this computation may not be robust. + If errors occur a is thrown. + + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The result of the overlay operation + + + + Computes a union operation on + the given geometry, with the supplied precision model. + + The input must be a valid geometry. + Collections must be homogeneous. + + To union an overlapping set of polygons in a more performant way use . + To union a polygonal coverage or linear network in a more performant way, + use . + + The geometry + The precision model to use + The result of the union operation + + + + + Computes a union of a single geometry using a custom noder. + + The primary use of this is to support coverage union. + Because of this the overlay is performed using strict mode. + + The geometry to union + The precision model to use (maybe be null) + The noder to use + the result geometry + + + + + Creates an overlay operation on the given geometries, + with a defined precision model. + + The A operand geometry + The B operand geometry (may be null) + The precision model to use + The overlay opcode + + + + Creates an overlay operation on the given geometries + using the precision model of the geometries. + + The noder is chosen according to the precision model specified. + + For + a snap - rounding noder is used, and the computation is robust. + For a non - snapping noder is used, + and this computation may not be robust. + If errors occur a is thrown. + + + The A operand geometry + The B operand geometry (may be null) + The overlay opcode + + + + Creates a union of a single geometry with a given precision model. + + The geometry + The precision model to use + + + + Gets or sets whether the overlay results are computed according to strict mode + semantics. + + Lines resulting from topology collapse are not included + Result geometry is homogeneous for the + and + operations. + Result geometry is homogeneous for the + and + operations if the inputs have the same dimension + + + + + + + Gets or sets a value indicating whether overlay processing optimizations are enabled. + + It may be useful to disable optimizations + for testing purposes. + + Default is true (optimization enabled). + + + + + Gets or sets whether the result can contain only components. + This is used if it is known that the result must be an (possibly empty) area. + + true if the result should contain only area components + + + + Gets the result of the overlay operation. + e + The result of the overlay operation. + Thrown, if the input is not supported (e.g. a mixed-dimension geometry) + Thrown, if a robustness error occurs + + + + Extracts the result geometry components from the fully labelled topology graph. + + This method implements the semantic that the result of an + intersection operation is homogeneous with highest dimension. + In other words, + if an intersection has components of a given dimension + no lower-dimension components are output. + For example, if two polygons intersect in an area, + no linestrings or points are included in the result, + even if portions of the input do meet in lines or points. + This semantic choice makes more sense for typical usage, + in which only the highest dimension components are of interest. + + The overlay operation + The topology graph + The result geometry + + + + Performs an overlay operation using , + increasing robustness by using a series of + increasingly robust (but slower) noding strategies. + + The noding strategies used are: + + A simple fast noder using precision + A using an automatically-determined snap tolerance + First snapping each geometry to itself, and then overlaying them wih a + The above two strategies are repeated with increasing snap tolerance, up to a limit + Finally a is used with a automatically-determined scale factor. + + If all of the above heuristics fail to compute a valid overlay, + the original is thrown. + In practice this should be extremely unlikely to occur. + + This algorithm relies on each overlay operation execution + throwing a if it is unable + to compute the overlay correctly. + Generally this occurs because the noding phase does + not produce a valid noding. + This requires the use of a + in order to check the results of using a floating noder. + + Martin Davis + + + + Computes the unary union of a geometry using robust computation. + + The geometry to union + The union result + + + + Computes the unary union of a collection of geometries using robust computation. + + An enumeration of geometries to union + The union result + + + + Computes the unary union of a collection of geometries using robust computation. + + An enumeration of geometries to union + The geometry factory to use + The union of the geometries + + + + Overlay two geometries, using heuristics to ensure + computation completes correctly. + In practice the heuristics are observed to be fully correct. + + A geometry + A geometry + The overlay operation code + The overlay result geometry + + + + Attempt overlay using snapping with repeated tries with increasing snap tolerances. + + + + + The computed overlay result, or null if the overlay fails + + + + Attempt overlay using a . + + + + + + The computed overlay result, or null if the overlay fails + + + + Attempt overlay with first snapping each geometry individually. + + + + + + The computed overlay result, or null if the overlay fails + + + + Self-snaps a geometry by running a union operation with it as the only input. + This helps to remove narrow spike/gore artifacts to simplify the geometry, + which improves robustness. + Collapsed artifacts are removed from the result to allow using + it in further overlay operations. + + Geometry to self-snap + Snap tolerance + The snapped geometry (homogenous) + + + + A factor for a snapping tolerance distance which + should allow noding to be computed robustly. + + + + + Computes a heuristic snap tolerance distance + for overlaying a pair of geometries using a . + + + + + + + + Computes the largest magnitude of the ordinates of a geometry, + based on the geometry envelope. + + + The magnitude of the largest ordinate + + + + Attempt Overlay using Snap-Rounding with an automatically-determined + scale factor. + + + + + the computed overlay result, or null if the overlay fails + + + + Performs an overlay operation on inputs which are both point geometries. + + Semantics are: + + Points are rounded to the precision model if provided + Points with identical XY values are merged to a single point + Extended ordinate values are preserved in the output, apart from merging + An empty result is returned as POINT EMPTY + + + Martin Davis + + + + Performs an overlay operation on inputs which are both point geometries. + + The code for the desired overlay operation + The first geometry argument + The second geometry argument + The precision model to use + The result of the overlay operation + + + + Creates an instance of an overlay operation on inputs which are both point geometries. + + The code for the desired overlay operation + The first geometry argument + The second geometry argument + The precision model to use + + + + Gets the result of the overlay. + + + + + Round the key point if precision model is fixed. + Note: return value is only copied if rounding is performed. + + + + + Utility methods for overlay processing. + + Martin Davis + + + + A null-handling wrapper for + + A precision model + true if the provided precision model is floating + + + + Computes a clipping envelope for overlay input geometries. + The clipping envelope encloses all geometry line segments which + might participate in the overlay, with a buffer to + account for numerical precision + (in particular, rounding due to a precision model. + The clipping envelope is used in both the + and in the . + + Some overlay operations (i.e. and ) + cannot use clipping as an optimization, + since the result envelope is the full extent of the two input geometries. + In this case the returned + envelope is null to indicate this. + + The overlay op code + The input geometries + The precision model being used + An envelope for clipping and line limiting, or null if no clipping is performed + + + + Computes an envelope which covers the extent of the result of + a given overlay operation for given inputs. + The operations which have a result envelope smaller than the extent of the inputs + are: + + + result envelope is the intersection of the input envelopes + + result envelope is the envelope of the A input geometry + + Otherwise, null is returned to indicate full extent. + + The overlay op code + The input geometries + The precision model being used + The result envelope, or null if the full extent + + + + Determines a safe geometry envelope for clipping, + taking into account the precision model being used. + + A safe geometry envelope for clipping + The precision model + A safe envelope to use for clipping + + + + Tests if the result can be determined to be empty + based on simple properties of the input geometries + (such as whether one or both are empty, + or their envelopes are disjoint). + + The overlay operation + The A operand geometry + The B operand geometry + The precision model to use + true if the overlay result is determined to be empty + + + + Tests if the geometry envelopes are disjoint, or empty. + The disjoint test must take into account the precision model + being used, since geometry coordinates may shift under rounding. + + The A operand geometry + The B operand geometry + The precision model to use + true if the geometry envelopes are disjoint or empty + + + + Tests for disjoint envelopes adjusting for rounding + caused by a fixed precision model. + Assumes envelopes are non-empty. + + The A operand envelope + The B operand envelope + The precision model to use + true if the envelopes are disjoint + + + + Creates an empty result geometry of the appropriate dimension, + based on the given overlay operation and the dimensions of the inputs. + The created geometry is an atomic geometry, + not a collection(unless the dimension is , + in which case a GEOMETRYCOLLECTION EMPTY is created. + + The dimension of the empty geometry + The geometry factory being used for the operation + An empty atomic geometry of the appropriate dimension + + + + Computes the dimension of the result of + applying the given operation to inputs + with the given dimensions. + This assumes that complete collapse does not occur. + + The result dimension is computed using the following rules: + + result has the dimension of the lowest input dimension + result has the dimension of the highest input dimension + result has the dimension of the left-hand input + result has the dimension of the highest input dimension + (since the Symmetric Difference is the Union of the Differences). + + + The overlay operation + Dimension of the LH input + Dimension of the RH input + + + + + Creates an overlay result geometry for homogeneous or mixed components. + + An enumeration of result polygons (may be empty or null) + An enumeration of result lines (may be empty or null) + An enumeration of result points (may be empty or null) + The geometry factory to use. + A geometry structured according to the overlay result semantics + + + + Round the key point if precision model is fixed. + Note: return value is only copied if rounding is performed. + + The point to round + The precision model to use + The rounded point coordinate, or null if empty + + + + A heuristic check for overlay result correctness + comparing the areas of the input and result. + The heuristic is necessarily coarse, but it detects some obvious issues.
+ (e.g. ) + + Note: - this check is only safe if the precision model is floating. + It should also be safe for snapping noding if the distance tolerance is reasonably small. + (Fixed precision models can lead to collapse causing result area to expand.) +
+ Input geometry 0 + Input geometry 1 + The overlay opcode + The overlay result + true if the result area is consistent +
+ + + For all OverlayEdges in result, form them into MaximalEdgeRings + + + + + Finds the single shell, if any, out of + a list of minimal rings derived from a maximal ring. + The other possibility is that they are a set of (connected) holes, + in which case no shell will be found. + + The shell ring, if there is one + or null, if all rings are holes + + + + + For the set of minimal rings comprising a maximal ring, + assigns the holes to the shell known to contain them. + Assigning the holes directly to the shell serves two purposes: + + it is faster than using a point-in-polygon check later on. + it ensures correctness, since if the PIP test was used the point + chosen might lie on the shell, which might return an incorrect result from the + PIP test + + + + + + Place holes have not yet been assigned to a shell. + These "free" holes should + all be properly contained in their parent shells, so it is safe to use the + findEdgeRingContaining method. + (This is the case because any holes which are NOT + properly contained (i.e. are connected to their + parent shell) would have formed part of a MaximalEdgeRing + and been handled in a previous step). + + If a hole cannot be assigned to a shell + + + + Functions to reduce the precision of a geometry + by rounding it to a given precision model. + + This class handles only polygonal and linear inputs. + For full functionality . + + + Martin Davis + + + + Reduces the precision of a geometry by rounding and snapping it to the + supplied .
+ The input geometry must be polygonal or linear. + + The output is always a valid geometry. This implies that input components + may be merged if they are closer than the grid precision. + if merging is not desired, then the individual geometry components + should be processed separately. + + The output is fully noded (i.e. coincident lines are merged and noded). + This provides an effective way to node / snap-round a collection of s. +
+ The geometry to reduce + The precision model to use + The precision-reduced geometry +
+ + + Functions for computing precision model scale factors + that ensure robust geometry operations. + In particular, these can be used to + automatically determine appropriate scale factors for operations + using limited-precision noding (such as ). + + WARNING: the inherentScale and robustScale + functions can be very slow, due to the method used to determine + number of decimal places of a number. + These are not recommended for production use. + + Martin Davis + + + + A number of digits of precision which leaves some computational "headroom" + to ensure robust evaluation of certain double-precision floating point geometric operations. + + This value should be less than the maximum decimal precision of double-precision values (16). + + + + + Computes a safe scale factor for a numeric value. + A safe scale factor ensures that rounded + number has no more than + digits of precision. + + A numeric value. + A safe scale factor for the value + + + + Computes a safe scale factor for a geometry. + A safe scale factor ensures that rounded + number has no more than + digits of precision. + + A geometry. + A safe scale factor for the geometry ordinates + + + + Computes a safe scale factor for two geometry. + A safe scale factor ensures that rounded + number has no more than + digits of precision. + + A geometry. + A geometry (which may be null). + A safe scale factor for the geometry ordinates + + + + Determines the maximum magnitude (absolute value) of the bounds of an + of an envelope. + This is equal to the largest ordinate value + which must be accommodated by a scale factor. + + An envelope + The value of the maximum bound magnitude + + + + Computes the scale factor which will + produce a given number of digits of precision(significant digits) + when used to round the given number. + + For example: to provide 5 decimal digits of precision + for the number 123.456 the precision scale factor is 100; + for 3 digits of precision the scale factor is 1; + for 2 digits of precision the scale factor is 0.1. + + Rounding to the scale factor can be performed with + + A number to be rounded + The number of digits of precision required + The scale factor which provides the required number of digits of precision + + + + + Computes the inherent scale of a number. + The inherent scale is the scale factor for rounding + which preserves all digits of precision + (significant digits) + present in the numeric value. + In other words, it is the scale factor which does not + change the numeric value when rounded: + + num = round( num, inherentScale(num) ) + + + A number + The inherent scale factor of the number + + + + Computes the inherent scale of a geometry. + The inherent scale is the scale factor for rounding + which preserves all digits of precision + (significant digits) + present in the geometry ordinates. + + This is the maximum inherent scale + of all ordinate values in the geometry. + + WARNING: this is very slow. + + A geometry + The inherent scale factor in the geometry's ordinates + + + + Computes the inherent scale of two geometries. + The inherent scale is the scale factor for rounding + which preserves all digits of precision + (significant digits) + present in the geometry ordinates. + + This is the maximum inherent scale + of all ordinate values in the geometries. + + A geometry + A geomety (which may be null) + The inherent scale factor in the geometries' ordinates + + + + Determines the + number of decimal places represented in a double-precision + number (as determined by .NET). + This uses the .NET double-precision print routine + to determine the number of decimal places, + This is likely not optimal for performance, + but should be accurate and portable. + + A numeric value + The number of decimal places in the value + + + + Applies the inherent scale calculation + to every ordinate in a geometry. + + WARNING: this is very slow. + + Martin Davis + + + + Determines a precision model to + use for robust overlay operations for one geometry. + The precision scale factor is chosen to maximize + output precision while avoiding round-off issues. + + NOTE: this is a heuristic determination, so is not guaranteed to + eliminate precision issues. + + WARNING: this is very slow. + + A geometry + A suitable precision model for overlay + + + + Determines a scale factor which maximizes + the digits of precision and is + safe to use for overlay operations. + The robust scale is the minimum of the + inherent scale and the safe scale factors. + + WARNING: this is very slow. + + A geometry + A geometry + A scale factor for use in overlay operations + + + + Determines a scale factor which maximizes + the digits of precision and is + safe to use for overlay operations. + The robust scale is the minimum of the + inherent scale and the safe scale factors. + + A geometry + A scale factor for use in overlay operations + + + + Clips a ring of points to an rectangle. + Uses a variant of Cohen-Sutherland clipping. + + In general the output is not topologically valid. + In particular, the output may contain coincident non-noded line segments + along the clip rectangle sides. + However, the output is sufficiently well-structured + that it can be used as input to the algorithm + (which is able to process coincident linework due + to the need to handle topology collapse under precision reduction). + + Because of the likelihood of creating + extraneous line segments along the clipping rectangle sides, + this class is not suitable for clipping linestrings. + + The clipping envelope should be generated using , + to ensure that intersecting line segments are not perturbed + by clipping. + This is required to ensure that the overlay of the + clipped geometry is robust and correct (i.e. the same as + if clipping was not used). + + + Martin Davis + + + + Creates a new clipper for the given envelope. + + The clipping envelope + + + + Clips a list of points to the clipping rectangle box. + + The points of the ring + The points of the clipped ring + + + + Clips line to the axis-parallel line defined by a single box edge. + + The coordinates + An edge index + A flag indicating whether to close the ring. + The clipped coordinates + + + + Computes the intersection point of a segment + with an edge of the clip box. + The segment must be known to intersect the edge. + + First endpoint of the segment + Second endpoint of the segment + Index of box edge + + The intersection point with the box edge + + + + + Computes a robust clipping envelope for a pair of polygonal geometries. + The envelope is computed to be large enough to include the full + length of all geometry line segments which intersect + a given target envelope. + This ensures that line segments which might intersect are + not perturbed when clipped using . + + Martin Davis + + + + Adds a polygon ring to the graph. Empty rings are ignored. + + + + + Unions a collection of geometries in an + efficient way, using + to ensure robust computation. + + This class is most useful for performing UnaryUnion using + a fixed-precision model.
+ For unary union using floating precision, + should be used. +
+ Martin Davis +
+ + + Unions a geometry (which is often a collection) + using a given precision model. + + The geometry to union + The precision model to use + The union of the geometry + + + + + Unions a geometry (which is often a collection) + using a given precision model. + + The geometries to union + The precision model to use + The union of the geometries + + + + + Unions a geometry (which is often a collection) + using a given precision model. + + The geometries to union + The geometry factory to use + The precision model to use + The union of the geometries + + + + + Nodes a set of edges. + Takes one or more sets of edges and constructs a + new set of edges consisting of all the split edges created by + noding the input edges together. + + + + + + + + + + + + + + + + + + + + + + Forms NTS LineStrings out of a the graph of DirectedEdges + created by an OverlayOp. + + + + + + + + + + + + + + + + + A list of the LineStrings in the result of the specified overlay operation. + + + + + Find and mark L edges which are "covered" by the result area (if any). + L edges at nodes which also have A edges can be checked by checking + their depth at that node. + L edges at nodes which do not have A edges can be checked by doing a + point-in-polygon test with the previously computed result areas. + + + + + + + + + + + + + + + + + + + Collect edges from Area inputs which should be in the result but + which have not been included in a result area. + This happens ONLY: + during an intersection when the boundaries of two + areas touch in a line segment + OR as a result of a dimensional collapse. + + + + + + + + + + + + + + + + + + + + Label an isolated node with its relationship to the target point. + + + + + + + A ring of edges which may contain nodes of degree > 2. + A MaximalEdgeRing may represent two different spatial entities: + a single polygon possibly containing inversions (if the ring is oriented CW) + a single hole possibly containing exversions (if the ring is oriented CCW) + If the MaximalEdgeRing represents a polygon, + the interior of the polygon is strongly connected. + These are the form of rings used to define polygons under some spatial data models. + However, under the OGC SFS model, MinimalEdgeRings are required. + A MaximalEdgeRing can be converted to a list of MinimalEdgeRings using the + BuildMinimalRings() method. + + + + + + + + + + + + + + + + + + + + + + + + + + For all nodes in this EdgeRing, + link the DirectedEdges at the node to form minimalEdgeRings + + + + + + + + + + + A ring of edges with the property that no node + has degree greater than 2. These are the form of rings required + to represent polygons under the OGC SFS spatial data model. + + + + + + + + + + + + + + + + + + + + + + + + + + Creates nodes for use in the PlanarGraphs constructed during + overlay operations. + + + + + + + + + + + + The spatial functions supported by this class. + These operations implement various bool combinations of the resultants of the overlay. + + + + + The code for the Intersection overlay operation + + + + + The code for the Union overlay operation + + + + + The code for the Difference overlay operation + + + + + The code for the Symmetric Difference overlay operation + + + + + Computes the geometric overlay of two s. The overlay + can be used to determine any bool combination of the geometries. + + + + + Disable + when an intersection is made (), + so performances are dramatically improved but failures are not managed. + + + Use ay your own risk! + + + + + Computes an overlay operation + for the given geometry arguments. + + The first geometry argument + The second geometry argument + The code for the desired overlay operation + The result of the overlay operation + Thrown if a robustness problem is encountered. + + + + Tests whether a point with a given topological + relative to two geometries is contained in + the result of overlaying the geometries using + a given overlay operation. + + The method handles arguments of correctly + + The topological label of the point + The code for the overlay operation to test + true if the label locations correspond to the overlayOpCode + + + + Tests whether a point with given s + relative to two geometries is contained in + the result of overlaying the geometries using + a given overlay operation. + + The method handles arguments of correctly + + the code for the location in the first geometry + the code for the location in the second geometry + the code for the overlay operation to test + true if the locations correspond to the overlayOpCode. + + + + Constructs an instance to compute a single overlay operation + for the given geometries. + + The first geometry argument + The second geometry argument + + + + Gets the result of the overlay for a given overlay operation. + + Note: this method can be called once only. + + The code of the overlay operation to perform + The computed result geometry + Thrown if a robustness problem is encountered + + + + Gets the graph constructed to compute the overlay. + + + + + Insert an edge from one of the noded input graphs. + Checks edges that are inserted to see if an + identical edge already exists. + If so, the edge is not inserted, but its label is merged + with the existing edge. + + The edge to insert + + + + Update the labels for edges according to their depths. + For each edge, the depths are first normalized. + Then, if the depths for the edge are equal, + this edge must have collapsed into a line edge. + If the depths are not equal, update the label + with the locations corresponding to the depths + (i.e. a depth of 0 corresponds to a Location of Exterior, + a depth of 1 corresponds to Interior) + + + + + If edges which have undergone dimensional collapse are found, + replace them with a new edge which is a L edge + + + + + Copy all nodes from an arg point into this graph. + The node label in the arg point overrides any previously computed + label for that argIndex. + (E.g. a node may be an intersection node with + a previously computed label of Boundary, + but in the original arg Geometry it is actually + in the interior due to the Boundary Determination Rule) + + + + + + Compute initial labelling for all DirectedEdges at each node. + In this step, DirectedEdges will acquire a complete labelling + (i.e. one with labels for both Geometries) + only if they + are incident on a node which has edges for both Geometries + + + + + For nodes which have edges from only one Geometry incident on them, + the previous step will have left their dirEdges with no labelling for the other + Geometry. However, the sym dirEdge may have a labelling for the other + Geometry, so merge the two labels. + + + + + Incomplete nodes are nodes whose labels are incomplete. + (e.g. the location for one Geometry is null). + These are either isolated nodes, + or nodes which have edges from only a single Geometry incident on them. + Isolated nodes are found because nodes in one graph which don't intersect + nodes in the other are not completely labelled by the initial process + of adding nodes to the nodeList. + To complete the labelling we need to check for nodes that lie in the + interior of edges, and in the interior of areas. + When each node labelling is completed, the labelling of the incident + edges is updated, to complete their labelling as well. + + + + + Label an isolated node with its relationship to the target point. + + + + + Find all edges whose label indicates that they are in the result area(s), + according to the operation being performed. Since we want polygon shells to be + oriented CW, choose dirEdges with the interior of the result on the RHS. + Mark them as being in the result. + Interior Area edges are the result of dimensional collapses. + They do not form part of the result area boundary. + + + + + If both a dirEdge and its sym are marked as being in the result, cancel + them out. + + + + + Tests if a point node should be included in the result or not. + + The point coordinate + true if the coordinate point is covered by a result Line or Area geometry. + + + + Tests if an L edge should be included in the result or not. + + The point coordinate + true if the coordinate point is covered by a result Area geometry. + + + + true if the coord is located in the interior or boundary of + a point in the list. + + + + + Creates an empty result geometry of the appropriate dimension, + based on the given overlay operation and the dimensions of the inputs. + The created geometry is always an atomic geometry, + not a collection. + + The empty result is constructed using the following rules: + + - result has the dimension of the lowest input dimension + - result has the dimension of the highest input dimension + - result has the dimension of the left-hand input + - result has the dimension of the highest input dimension + (since symDifference is the union of the differences). + + + The overlay operation being performed + An input geometry + An input geometry + The geometry factory being used for the operation + An empty atomic geometry of the appropriate dimension + + + + Constructs Points from the nodes of an overlay graph. + + + + + Creates an instance of this class + + The operation + The geometry factory + + + + Computes the Point geometries which will appear in the result, + given the specified overlay operation. + + The spatial function + + A list of the Points in the result. + + + + + Determines nodes which are in the result, and creates s for them. + + + This method determines nodes which are candidates for the result via their + labelling and their graph topology. + + The overlay operation + + + + Converts non-covered nodes to Point objects and adds them to the result. + + + A node is covered if it is contained in another element Geometry + with higher dimension (e.g. a node point might be contained in a polygon, + in which case the point can be eliminated from the result). + + The node to test + + + + Forms Polygons out of a graph of {DirectedEdge}s. + The edges to use are marked as being in the result Area. + + + + + + + + + + + Add a complete graph. + The graph is assumed to contain one or more polygons, + possibly with holes. + + + + + + Add a set of edges and nodes, which form a graph. + The graph is assumed to contain one or more polygons, + possibly with holes. + + + + + + + + + + + + For all DirectedEdges in result, form them into MaximalEdgeRings. + + + + + + + + + + + + + + + + This method takes a list of MinimalEdgeRings derived from a MaximalEdgeRing, + and tests whether they form a Polygon. This is the case if there is a single shell + in the list. In this case the shell is returned. + The other possibility is that they are a series of connected holes, in which case + no shell is returned. + + The shell EdgeRing, if there is one
or + null, if all the rings are holes.
+
+ + + This method assigns the holes for a Polygon (formed from a list of + MinimalEdgeRings) to its shell. + Determining the holes for a MinimalEdgeRing polygon serves two purposes: + it is faster than using a point-in-polygon check later on. + it ensures correctness, since if the PIP test was used the point + chosen might lie on the shell, which might return an incorrect result from the + PIP test. + + + + + + + For all rings in the input list, + determine whether the ring is a shell or a hole + and add it to the appropriate list. + Due to the way the DirectedEdges were linked, + a ring is a shell if it is oriented CW, a hole otherwise. + + + + + + + + This method determines finds a containing shell for all holes + which have not yet been assigned to a shell. + These "free" holes should + all be properly contained in their parent shells, so it is safe to use the + findEdgeRingContaining method. + (This is the case because any holes which are NOT + properly contained (i.e. are connected to their + parent shell) would have formed part of a MaximalEdgeRing + and been handled in a previous step). + + + + + + + Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: + ring A contains ring B if envelope(ring A) contains envelope(ring B). + This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell). + + + + Containing EdgeRing, if there is one
or + null if no containing EdgeRing is found.
+
+ + + + + + + + + + Snaps the vertices and segments of a + to another Geometry's vertices. + A snap distance tolerance is used to control where snapping is performed. + Snapping one geometry to another can improve + robustness for overlay operations by eliminating + nearly-coincident edges + (which cause problems during noding and intersection calculation). + It can also be used to eliminate artifacts such as narrow slivers, spikes and gores. + Too much snapping can result in invalid topology + beging created, so the number and location of snapped vertices + is decided using heuristics to determine when it + is safe to snap. + This can result in some potential snaps being omitted, however. + + Martin Davis + + + + Estimates the snap tolerance for a Geometry, taking into account its precision model. + + + The estimated snap tolerance + + + + + + + + + + + + + + + + + + + Snaps two geometries together with a given tolerance. + + + + + + + + + Snaps a geometry to itself. + Allows optionally cleaning the result to ensure it is topologically valid + (which fixes issues such as topology collapses in polygonal inputs). + Snapping a geometry to itself can remove artifacts such as very narrow slivers, gores and spikes. + + the geometry to snap + the snapping tolerance + whether the result should be made valid + a new snapped + + + + Creates a new snapper acting on the given geometry + + the geometry to snap + + + + Snaps the vertices in the component s + of the source geometry to the vertices of the given snap geometry. + + a geometry to snap the source to + + a new snapped Geometry + + + Snaps the vertices in the component s + of the source geometry to the vertices of the same geometry. + Allows optionally cleaning the result to ensure it is topologically valid + (which fixes issues such as topology collapses in polygonal inputs). + The snapping tolerance + Whether the result should be made valid + The geometry snapped to itself + + + + + + + + + + + Computes the snap tolerance based on the input geometries. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Snaps the vertices and segments of a + to a set of target snap vertices. + A snap distance tolerance is used to control where snapping is performed. + The implementation handles empty geometry and empty snap vertex sets. + + + + + Creates a new snapper using the points in the given + as target snap points. + + A LineString to snap (may be empty) + the snap tolerance to use + + + + Creates a new snapper using the given points + as source points to be snapped. + + + + + + + Snaps the vertices and segments of the source LineString + to the given set of snap points. + + the vertices to snap to + list of the snapped points + + + + Snap source vertices to vertices in the target. + + the points to snap + the points to snap to + + + + + + + + + + + + Snap segments of the source to nearby snap vertices. + Source segments are "cracked" at a snap vertex. + A single input segment may be snapped several times + to different snap vertices. + For each distinct snap vertex, at most one source segment + is snapped to. This prevents "cracking" multiple segments + at the same point, which would likely cause + topology collapse when being used on polygonal linework. + + The coordinates of the source linestring to snap + The target snap vertices + + + + Finds a src segment which snaps to (is close to) the given snap point + Only a single segment is selected for snapping. + This prevents multiple segments snapping to the same snap vertex, + which would almost certainly cause invalid geometry + to be created. + (The heuristic approach of snapping used here + is really only appropriate when + snap pts snap to a unique spot on the src geometry) + Also, if the snap vertex occurs as a vertex in the src coordinate list, + no snapping is performed. + + The point to snap to + The source segment coordinates + The index of the snapped segment
+ or -1 if no segment snaps to the snap point.
+
+ + + Performs an overlay operation using snapping and enhanced precision + to improve the robustness of the result. + This class only uses snapping + if an error is detected when running the standard JTS overlay code. + Errors detected include thrown exceptions + (in particular, ) + and invalid overlay computations. + + + + + Performs an overlay operation using snapping and enhanced precision + to improve the robustness of the result. + This class always uses snapping. + This is less performant than the standard JTS overlay code, + and may even introduce errors which were not present in the original data. + For this reason, this class should only be used + if the standard overlay code fails to produce a correct result. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Finds the most likely of a point relative to + the polygonal components of a geometry, using a tolerance value. + + + If a point is not clearly in the Interior or Exterior, + it is considered to be on the Boundary. + In other words, if the point is within the tolerance of the Boundary, + it is considered to be on the Boundary; otherwise, + whether it is Interior or Exterior is determined directly. + + Martin Davis + + + + Extracts linework for polygonal components. + + The geometry from which to extract + A lineal geometry containing the extracted linework + + + + Extracts the LineStrings in the boundaries of all the polygonal elements in the target . + + Martin Davis + + + + Filters out all linework for polygonal elements + + + + + Gets the list of polygonal linework. + + + + + Generates points offset by a given distance from both sides of the midpoint of all segments in a . + + + + Can be used to generate probe points for determining whether a polygonal overlay result is incorrect. + + + The input geometry may have any orientation for its rings, + but is + only meaningful if the orientation is known. + + + Martin Davis + + + + Set the sides on which to generate offset points. + + + + + + + Gets the computed offset points. + + + + + Generates the two points which are offset from the + midpoint of the segment (p0, p1) by the offsetDistance + + The first point of the segment to offset from. + The second point of the segment to offset from + + + + + + Validates that the result of an overlay operation is geometrically correct within a determined tolerance. + Uses fuzzy point location to find points which are + definitely in either the interior or exterior of the result + geometry, and compares these results with the expected ones. + + + This algorithm is only useful where the inputs are polygonal. + This is a heuristic test, and may return false positive results + (I.e. it may fail to detect an invalid result.) + It should never return a false negative result, however + (I.e. it should never report a valid result as invalid.) + + Martin Davis + + + + + Represents a ring of s which form + a ring of a polygon. The ring may be either an outer shell or a hole. + + + + + Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: + ring A contains ring B if envelope(ring A) contains envelope(ring B). + This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell). + + To improve performance of this function the caller should + make the passed shellList as small as possible(e.g. + by using a spatial index filter beforehand). + + + + Containing EdgeRing, if there is one
+ or null if no containing EdgeRing is found.
+
+ + + Traverses a ring of DirectedEdges, accumulating them into a list. + This assumes that all dangling directed edges have been removed + from the graph, so that there is always a next dirEdge. + + The DirectedEdge to start traversing at + A list of DirectedEdges that form a ring + + + + + + + + + + Adds a DirectedEdge which is known to form part of this ring. + + The DirectedEdge to add. + + + + Tests whether this ring is a hole. + Due to the way the edges in the polygonization graph are linked, + a ring is a hole if it is oriented counter-clockwise. + + true if this ring is a hole. + + + + Computes whether this ring is a hole. + Due to the way the edges in the polygonization graph are linked, + a ring is a hole if it is oriented counter-clockwise. + + + + + Adds a hole to the polygon formed by this ring. + + The LinearRing forming the hole. + + + + Adds a hole to the polygon formed by this ring. + + the forming the hole. + + + + Computes and returns the Polygon formed by this ring and any contained holes. + + + + + Tests if the ring formed by this edge ring is topologically valid. + + true if the ring is valid. + + + + Computes and returns the list of coordinates which are contained in this ring. + The coordinates are computed once only and cached. + + + + + Gets the coordinates for this ring as a LineString. + Used to return the coordinates in this ring + as a valid point, when it has been detected that the ring is topologically + invalid. + + + + + Returns this ring as a LinearRing, or null if an Exception occurs while + creating it (such as a topology problem). Details of problems are written to + standard output. + + + + + + + + + + + + + Gets or sets a value indicating the containing shell ring of a ring that has been determined to be a hole. + + + + + Gets a value indicating whether this ring has a shell assigned to it. + + + + + Tests whether this ring is an outer hole. + A hole is an outer hole if it is not contained by a shell. + + + + + Tests whether this ring is an outer shell. + + + + + Gets the outer hole of a shell, if it has one. + An outer hole is one that is not contained + in any other shell. + Each disjoint connected group of shells + is surrounded by an outer hole. + + The outer hole edge ring, or null + + + + Updates the included status for currently non-included shells + based on whether they are adjacent to an included shell. + + + + + Gets a string representation of this object. + + + + + Gets or sets a value indicating whether this ring has been processed. + + + + + Compares EdgeRings based on their envelope, + using the standard lexicographic ordering. + This ordering is sufficient to make edge ring sorting deterministic. + + mbdavis + + + + Assigns hole rings to shell rings + during polygonization. + Uses spatial indexing to improve performance + of shell lookup. + + mdavis + + + + Assigns hole rings to shell rings. + + An enumeration of hole rings to assign + An enumeration of shell rings + + + + Creates a new hole assigner. + + An enumeration of shell rings to assign holes to + + + + Assigns holes to the shells. + + An enumeration of holes to assign to shells + + + + Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any. + The innermost enclosing ring is the smallest enclosing ring. + The algorithm used depends on the fact that: + + ring A contains ring B if envelope(ring A) contains envelope(ring B) + + This routine is only safe to use if the chosen point of the hole + is known to be properly contained in a shell + (which is guaranteed to be the case if the hole does not touch its shell) + + An edge ring to test + + The containing shell EdgeRing, if there is one + or null if no containing EdgeRing is found + + + + + A DirectedEdge of a PolygonizeGraph, which represents + an edge of a polygon formed by the graph. + May be logically deleted from the graph by setting the marked flag. + + + + + Constructs a directed edge connecting the from node to the + to node. + + + + + Specifies this DirectedEdge's direction (given by an imaginary + line from the from node to directionPt). + + + Whether this DirectedEdge's direction is the same as or + opposite to that of the parent Edge (if any). + + + + + Returns the identifier attached to this directed edge. + Attaches an identifier to this directed edge. + + + + + Returns the next directed edge in the EdgeRing that this directed edge is a member of. + Sets the next directed edge in the EdgeRing that this directed edge is a member of. + + + + + Returns the ring of directed edges that this directed edge is + a member of, or null if the ring has not been set. + + + + + Gets/Sets the ring of directed edges that this directed edge is + a member of. + + + + + An edge of a polygonization graph. + + + + + + + + + + + + + + + + Represents a planar graph of edges that can be used to compute a + polygonization, and implements the algorithms to compute the + s formed by the graph. + The marked flag on DirectedEdges is used to indicate that a directed edge + has be logically deleted from the graph. + + + + + + + + + + + + + + + + + + + + Deletes all edges at a node. + + + + + + Create a new polygonization graph. + + + + + + Add a LineString forming an edge of the polygon graph. + + The line to add. + + + + + + + + + + + + + + + + Convert the maximal edge rings found by the initial graph traversal + into the minimal edge rings required by NTS polygon topology rules. + + The list of start edges for the edgeRings to convert. + + + + Finds all nodes in a maximal edgering which are self-intersection nodes + + + + + The list of intersection nodes found, + or null if no intersection nodes were found. + + + + + Computes the minimal EdgeRings formed by the edges in this graph. + + A list of the{EdgeRings found by the polygonization process. + + + + Finds and labels all edgerings in the graph. + The edge rings are labeling with unique integers. + The labeling allows detecting cut edges. + + A List of the DirectedEdges in the graph. + A List of DirectedEdges, one for each edge ring found. + + + + Finds and removes all cut edges from the graph. + + A list of the LineStrings forming the removed cut edges. + + + + + + + + + + + + + + + + + Computes the next edge pointers going CCW around the given node, for the + given edgering label. + This algorithm has the effect of converting maximal edgerings into minimal edgerings + + + + + + + + + + + + + + Marks all edges from the graph which are "dangles". + Dangles are which are incident on a node with degree 1. + This process is recursive, since removing a dangling edge + may result in another edge becoming a dangle. + In order to handle large recursion depths efficiently, + an explicit recursion stack is used. + + A List containing the s that formed dangles. + + + + Traverses the polygonized edge rings in the graph + and computes the depth parity (odd or even) + relative to the exterior of the graph. + + If the client has requested that the output + be polygonally valid, only odd polygons will be constructed. + + + + + Traverses all connected edges, computing the depth parity of the associated polygons. + + + + + + Polygonizes a set of s which contain linework that + represents the edges of a planar graph. + + + All types of Geometry are accepted as input; + the constituent linework is extracted as the edges to be polygonized. + The processed edges must be correctly noded; that is, they must only meet + at their endpoints. Polygonization will accept incorrectly noded input + but will not form polygons from non-noded edges, + and reports them as errors. + + The Polygonizer reports the follow kinds of errors: + + Danglesedges which have one or both ends which are not incident on another edge endpoint + edges which are connected at both ends but which do not form part of polygon + edges which form rings which are invalid + (e.g. the component lines contain a self-intersection) + + + + The constructor allows + extracting only polygons which form a valid polygonal result. + The set of extracted polygons is guaranteed to be edge-disjoint. + This is useful for situations where it is known that the input lines form a + valid polygonal geometry (which may include holes or nested polygons). + + + + + + The default polygonizer output behavior + + + + + Adds every linear element in a into the polygonizer graph. + + + + + Filters all geometry instances + + The geometry instance + + + + Default linestring adder. + + + + + Allows disabling the valid ring checking, + to optimize situations where invalid rings are not expected. + + The default is true + + + + Creates a polygonizer that extracts all polygons. + + + + + Creates a polygonizer, specifying whether a valid polygonal geometry must be created. + If the argument is true + then areas may be discarded in order to + ensure that the extracted geometry is a valid polygonal geometry. + + true if a valid polygonal geometry should be extracted + + + + Adds a collection of s to be polygonized. + May be called multiple times. + Any dimension of Geometry may be added; + the constituent linework will be extracted and used. + + A list of Geometrys with linework to be polygonized. + + + + Adds a to the linework to be polygonized. + May be called multiple times. + Any dimension of Geometry may be added; + the constituent linework will be extracted and used + + A Geometry with linework to be polygonized. + + + + Adds a to the graph of polygon edges. + + The to add. + + + + Gets the list of polygons formed by the polygonization. + + + + + Gets a geometry representing the polygons formed by the polygonization. + If a valid polygonal geometry was extracted the result is a geometry. + + A geometry containing the polygons + + + + Gets the list of dangling lines found during polygonization. + + + + + Gets the list of cut edges found during polygonization. + + + + + Gets the list of lines forming invalid rings found during polygonization. + + + + + Performs the polygonization, if it has not already been carried out. + + + + + For each outer hole finds and includes a single outer shell. + This seeds the traversal algorithm for finding only polygonal shells. + + The list of shell EdgeRings + + + + Optimized implementation of spatial predicate "contains" + for cases where the first Geometry is a rectangle. + As a further optimization, + this class can be used directly to test many geometries against a single rectangle. + + + + + + + + + + + + + Create a new contains computer for two geometries. + + A rectangular geometry. + + + + + + + + + + + + + + + + + + + + + + + + + Tests if a point is contained in the boundary of the target rectangle. + + the point to test + true if the point is contained in the boundary + + + + Tests if a linestring is completely contained in the boundary of the target rectangle. + + the linestring to test + true if the linestring is contained in the boundary + + + + Tests if a line segment is contained in the boundary of the target rectangle. + + an endpoint of the segment + an endpoint of the segment + true if the line segment is contained in the boundary + + + I + Implementation of the Intersects spatial predicate + optimized for the case where one is a rectangle. + + + This class works for all input geometries, including s. + + As a further optimization, this class can be used in batch style + to test many geometries against a single rectangle. + + + + + Crossover size at which brute-force intersection scanning + is slower than indexed intersection detection. + Must be determined empirically. Should err on the + safe side by making value smaller rather than larger. + + + + + Tests whether a rectangle intersects a given geometry. + + A rectangular polygon + A geometry of any kind + true if the geometries intersect. + + + + Create a new intersects computer for a rectangle. + + A rectangular polygon. + + + + Tests whether the given Geometry intersects the query rectangle. + + The Geometry to test (may be of any type) + true if an intersection must occur + or false if no conclusion about intersection can be made + + + + Tests whether it can be concluded that a rectangle intersects a geometry, + based on the relationship of the envelope(s) of the geometry. + + Martin Davis + + + + Creates an instance of this class using the provided Envelope + + The query envelope + + + + Reports whether it can be concluded that an intersection occurs, + or whether further testing is required. + + true if an intersection must occur
+ or false if no conclusion about intersection can be made
+
+ + + + + + + + + + + + + + + A visitor which tests whether it can be + concluded that a geometry contains a vertex of + a query geometry. + + Martin Davis + + + + + + + + + + Gets a value indicating whether it can be concluded that a corner point of the rectangle is + contained in the geometry, or whether further testing is required. + + true if a corner point is contained + or false if no conclusion about intersection can be made + + + + + + + + + + + + + + + + + A visitor to test for intersection between the query rectangle and the line segments of the geometry. + + Martin Davis + + + + Creates a visitor for checking rectangle intersection with segments + + the query rectangle + + + Reports whether any segment intersection exists. + true if a segment intersection exists or + false if no segment intersection exists + + + + Tests if any line segments in two sets of intersect. + Optimized for use when at least one input is of small size. + Short-circuited to return as soon an intersection is found. + + + + + + + + + + + + + + + + + + + + + An EdgeEndBuilder creates EdgeEnds for all the "split edges" + created by the intersections determined for an Edge. + Computes the EdgeEnds which arise from a noded Edge. + + + + + + + + + + + + Creates stub edges for all the intersections in this + Edge (if any) and inserts them into the graph. + + + + + + + Create a EdgeStub for the edge before the intersection eiCurr. + The previous intersection is provided + in case it is the endpoint for the stub edge. + Otherwise, the previous point from the parent edge will be the endpoint. + eiCurr will always be an EdgeIntersection, but eiPrev may be null. + + + + + + + + + Create a StubEdge for the edge after the intersection eiCurr. + The next intersection is provided + in case it is the endpoint for the stub edge. + Otherwise, the next point from the parent edge will be the endpoint. + eiCurr will always be an EdgeIntersection, but eiNext may be null. + + + + + + + + + A collection of EdgeStubs which obey the following invariant: + They originate at the same node and have the same direction. + Contains all EdgeEnds which start at the same point and are parallel. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This computes the overall edge label for the set of + edges in this EdgeStubBundle. It essentially merges + the ON and side labels for each edge. + These labels must be compatible + + + + + + Compute the overall ON location for the list of EdgeStubs. + (This is essentially equivalent to computing the self-overlay of a single Geometry) + edgeStubs can be either on the boundary (e.g. Polygon edge) + OR in the interior (e.g. segment of a LineString) + of their parent Geometry. + In addition, GeometryCollections use the to determine + whether a segment is on the boundary or not. + Finally, in GeometryCollections it can occur that an edge is both + on the boundary and in the interior (e.g. a LineString segment lying on + top of a Polygon edge.) In this case the Boundary is given precedence. + These observations result in the following rules for computing the ON location: + if there are an odd number of Bdy edges, the attribute is Bdy + if there are an even number >= 2 of Bdy edges, the attribute is Int + if there are any Int edges, the attribute is Int + otherwise, the attribute is Null. + + + + + + + Compute the labelling for each side + + + + + + To compute the summary label for a side, the algorithm is: + FOR all edges + IF any edge's location is Interior for the side, side location = Interior + ELSE IF there is at least one Exterior attribute, side location = Exterior + ELSE side location = Null + Note that it is possible for two sides to have apparently contradictory information + i.e. one edge side may indicate that it is in the interior of a point, while + another edge side may indicate the exterior of the same point. This is + not an incompatibility - GeometryCollections may contain two Polygons that touch + along an edge. This is the reason for Interior-primacy rule above - it + results in the summary label having the Geometry interior on both sides. + + + + + + + Update the IM with the contribution for the computed label for the EdgeStubs. + + + + + + + + + + + + An ordered list of EdgeEndBundles around a RelateNode. + They are maintained in CCW order (starting with the positive x-axis) around the node + for efficient lookup and topology building. + + + + + Insert a EdgeEnd in order in the list. + If there is an existing EdgeStubBundle which is parallel, the EdgeEnd is + added to the bundle. Otherwise, a new EdgeEndBundle is created + to contain the EdgeEnd. + + + + + + Update the IM with the contribution for the EdgeStubs around the node. + + + + + + Computes the topological relationship between two Geometries. + RelateComputer does not need to build a complete graph structure to compute + the IntersectionMatrix. The relationship between the geometries can + be computed by simply examining the labelling of edges incident on each node. + RelateComputer does not currently support arbitrary GeometryCollections. + This is because GeometryCollections can contain overlapping Polygons. + In order to correct compute relate on overlapping Polygons, they + would first need to be noded and merged (if not explicitly, at least + implicitly). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copy all nodes from an arg point into this graph. + The node label in the arg point overrides any previously computed + label for that argIndex. + (E.g. a node may be an intersection node with + a computed label of Boundary, + but in the original arg Geometry it is actually + in the interior due to the Boundary Determination Rule) + + + + + + Insert nodes for all intersections on the edges of a Geometry. + Label the created nodes the same as the edge label if they do not already have a label. + This allows nodes created by either self-intersections or + mutual intersections to be labelled. + Endpoint nodes will already be labelled from when they were inserted. + + + + + + For all intersections on the edges of a Geometry, + label the corresponding node IF it doesn't already have a label. + This allows nodes created by either self-intersections or + mutual intersections to be labelled. + Endpoint nodes will already be labelled from when they were inserted. + + + + + + If the Geometries are disjoint, we need to enter their dimension and + boundary dimension in the Ext rows in the IM + + An intersection matrix + The Boundary Node Rule to use + + + + Compute the IM entry for the intersection of the boundary + of a geometry with the Exterior. + This is the nominal dimension of the boundary + unless the boundary is empty, in which case it is . + For linear geometries the Boundary Node Rule determines + whether the boundary is empty. + + The geometry providing the boundary + The Boundary Node Rule to use + The IM dimension entry + + + + + + + + + Update the IM with the sum of the IMs for each component. + + + + + + Processes isolated edges by computing their labelling and adding them + to the isolated edges list. + Isolated edges are guaranteed not to touch the boundary of the target (since if they + did, they would have caused an intersection to be computed and hence would + not be isolated). + + + + + + + Label an isolated edge of a graph with its relationship to the target point. + If the target has dim 2 or 1, the edge can either be in the interior or the exterior. + If the target has dim 0, the edge must be in the exterior. + + + + + + + + Isolated nodes are nodes whose labels are incomplete + (e.g. the location for one Geometry is null). + This is the case because nodes in one graph which don't intersect + nodes in the other are not completely labelled by the initial process + of adding nodes to the nodeList. + To complete the labelling we need to check for nodes that lie in the + interior of edges, and in the interior of areas. + + + + + Label an isolated node with its relationship to the target point. + + + + + + + A RelateNode is a Node that maintains a list of EdgeStubs + for the edges that are incident on it. + + + + + + + + + + + + Update the IM with the contribution for this component. + A component only contributes if it has a labelling for both parent geometries. + + + + + Update the IM with the contribution for the EdgeEnds incident on this node. + + + + + + Used by the NodeMap in a RelateNodeGraph to create RelateNodes. + + + + + + + + + + + + Implements the simple graph of Nodes and EdgeEnd which is all that is + required to determine topological relationships between Geometries. + Also supports building a topological graph of a single Geometry, to + allow verification of valid topology. + It is not necessary to create a fully linked + PlanarGraph to determine relationships, since it is sufficient + to know how the Geometries interact locally around the nodes. + In fact, this is not even feasible, since it is not possible to compute + exact intersection points, and hence the topology around those nodes + cannot be computed robustly. + The only Nodes that are created are for improper intersections; + that is, nodes which occur at existing vertices of the Geometries. + Proper intersections (e.g. ones which occur between the interior of line segments) + have their topology determined implicitly, without creating a Node object + to represent them. + + + + + + + + + + + + + + + + + Insert nodes for all intersections on the edges of a Geometry. + Label the created nodes the same as the edge label if they do not already have a label. + This allows nodes created by either self-intersections or + mutual intersections to be labelled. + Endpoint nodes will already be labelled from when they were inserted. + Precondition: edge intersections have been computed. + + + + + + + Copy all nodes from an arg point into this graph. + The node label in the arg point overrides any previously computed + label for that argIndex. + (E.g. a node may be an intersection node with + a computed label of Boundary, + but in the original arg Geometry it is actually + in the interior due to the Boundary Determination Rule). + + + + + + + + + + + + + Implements the SFS relate() generalized spatial predicate on two s. +
+ The class supports specifying a custom + to be used during the relate computation. +
+ + If named spatial predicates are used on the result + of the RelateOp, the result may or not be affected by the + choice of BoundaryNodeRule, depending on the exact nature of the pattern. + For instance, is insensitive + to the choice of BoundaryNodeRule, + whereas is affected by the rule chosen. + + Note: custom Boundary Node Rules do not (currently) + affect the results of other methods (such + as . The results of + these methods may not be consistent with the relationship computed by + a custom Boundary Node Rule. + +
+ + + Computes the for the spatial relationship + between two s, using the default (OGC SFS) Boundary Node Rule + + A geometry to test + A geometry to test + The IntersectionMatrix for the spatial relationship between the geometries + + + + Computes the for the spatial relationship + between two s, using the specified Boundary Node Rule + + A geometry to test + A geometry to test + The Boundary Node Rule to use + The IntersectionMatrix for the spatial relationship between the geometries + + + + Creates a new Relate operation, using the default (OGC SFS) Boundary Node Rule. + + a Geometry to relate + another Geometry to relate + + + + Creates a new Relate operation, using the default (OGC SFS) Boundary Node Rule. + + a Geometry to relate + another Geometry to relate + The Boundary Node Rule to use + + + + Gets the IntersectionMatrix for the spatial relationship + between the input geometries. + + + + + Provides an efficient method of unioning a collection of + geometries. + The geometries are indexed using a spatial index, + and unioned recursively in index order. + For geometries with a high degree of overlap, + this has the effect of reducing the number of vertices + early in the process, which increases speed + and robustness. + + This algorithm is faster and more robust than + the simple iterated approach of + repeatedly unioning each polygon to a result geometry. + + The buffer(0) trick is sometimes faster, but can be less robust and + can sometimes take a long time to complete. + This is particularly the case where there is a high degree of overlap + between the polygons. In this case, buffer(0) is forced to compute + with all line segments from the outset, + whereas cascading can eliminate many segments + at each stage of processing. + The best situation for using buffer(0) is the trivial case + where there is no overlap between the input geometries. + However, this case is likely rare in practice. + + Martin Davis + + + + + A union strategy that uses the classic NTS , + and for polygonal geometries a robustness fallback using Buffer(0). + + + + + An alternative way of unioning polygonal geometries + by using Buffer(0). + Only worth using if regular overlay union fails. + + A polygonal geometry + A polygonal geometry + The union of the geometries + + + + Computes the union of + a collection of s. + + A collection of s. + The union of the + + + + Computes the union of + a collection of s. + + A collection of s. + A strategy to perform the unioning. + The union of the + + + + Creates a new instance to union + the given collection of s. + + A collection of s + + + + Creates a new instance to union + the given collection of s. + + A collection of s + + + + + The effectiveness of the index is somewhat sensitive + to the node capacity. + Testing indicates that a smaller capacity is better. + For an STRtree, 4 is probably a good number (since + this produces 2x2 "squares"). + + + + + Computes the union of the input geometries. + + + + This method discards the input geometries as they are processed. + In many input cases this reduces the memory retained + as the operation proceeds. + Optimal memory usage is achieved + by disposing of the original input collection + before calling this method. + + The union of the input geometries, + or null if no input geometries were provided + + if this method is called more than once + + + + Unions a list of geometries + by treating the list as a flattened binary tree, + and performing a cascaded union on the tree. + + The list of geometries to union + The union of the list + + + + Unions a section of a list using a recursive binary union on each half + of the section. + + The list of geometries containing the section to union + The start index of the section + The index after the end of the section + The union of the list section + + + + Gets the element at a given list index, or + null if the index is out of range. + + The list of geometries + The index + The geometry at the given index or + null if the index is out of range + + + + Reduces a tree of geometries to a list of geometries + by recursively unioning the subtrees in the list. + + A tree-structured list of geometries + A list of Geometrys + + + + Computes the union of two geometries, + either or both of which may be null. + + A Geometry + A Geometry + The union of the input(s) or + null if both inputs are null + + + + Encapsulates the actual unioning of two polygonal geometries. + + A geometry to union + A geometry to union + A + The union of the inputs + + + Computes a containing only components. + Extracts the s from the input + and returns them as an appropriate geometry. + + If the input is already Polygonal, it is returned unchanged. + + A particular use case is to filter out non-polygonal components + returned from an overlay operation. + + The geometry to filter + A polygonal geometry + + + + Extracts atomic elements from + input geometries or collections, + recording the dimension found. + Empty geometries are discarded since they + do not contribute to the result of . + + Martin Davis + + + + Extracts elements from an enumeration of geometries. + + An enumeration of geometries + An extracter over the geometries. + + + + Extracts elements from a geometry. + + An geometry to extract from + An extracter over the geometry. + + + The default dimension for an empty GeometryCollection + + + + Gets a value indicating if there were any non-empty geometries extracted + + + + + Gets a value indicating the maximum extracted. + + + + + Gets a value indicating the geometry factory from the extracted geometry, + if there is one. + If an empty collection was extracted, will return null. + + + + + Gets the extracted atomic geometries of the given dimension dim. + + The dimension of geometry to return + A list of the extracted geometries of dimension dim. + + + + Unions MultiPolygons efficiently by + using full topological union only for polygons which may overlap, + and combining with the remaining polygons. + Polygons which may overlap are those which intersect the common extent of the inputs. + Polygons wholly outside this extent must be disjoint to the computed union. + They can thus be simply combined with the union result, + which is much more performant. + (There is one caveat to this, which is discussed below). + + This situation is likely to occur during cascaded polygon union, + since the partitioning of polygons is done heuristically + and thus may group disjoint polygons which can lie far apart. + It may also occur in real world data which contains many disjoint polygons + (e.g. polygons representing parcels on different street blocks). + + +

Algorithm

+ The overlap region is determined as the common envelope of intersection. + The input polygons are partitioned into two sets: + + OverlappingPolygons which intersect the overlap region, and thus potentially overlap each other + DisjointPolygons which are disjoint from (lie wholly outside) the overlap region + + The Overlapping set is fully unioned, and then combined with the Disjoint set. + Performing a simple combine works because + the disjoint polygons do not interact with each + other(since the inputs are valid MultiPolygons). + They also do not interact with the Overlapping polygons, + since they are outside their envelope. +

Discussion

+ In general the Overlapping set of polygons will + extend beyond the overlap envelope. This means that the union result + will extend beyond the overlap region. + There is a small chance that the topological + union of the overlap region will shift the result linework enough + that the result geometry intersects one of the Disjoint geometries. + This situation is detected and if it occurs + is remedied by falling back to performing a full union of the original inputs. + Detection is done by a fairly efficient comparison of edge segments which + extend beyond the overlap region. If any segments have changed + then there is a risk of introduced intersections, and full union is performed. + + This situation has not been observed in JTS using floating precision, + but it could happen due to snapping. It has been observed + in other APIs(e.g.GEOS) due to more aggressive snapping. + It is more likely to happen if a Snap - Rounding overlay is used. + + NOTE: Test has shown that using this heuristic impairs performance. +
+ Martin Davis +
+ + + Union a pair of geometries, + using the more performant overlap union algorithm if possible. + + A geometry to union + A geometry to union + The union of the inputs + + + + Union a pair of geometries, + using the more performant overlap union algorithm if possible. + + A geometry to union + A geometry to union + Function to union two geometries + The union of the inputs + + + + Creates a new instance for unioning the given geometries. + + A geometry to union + A geometry to union + + + + Creates a new instance for unioning the given geometries. + + A geometry to union + A geometry to union + Function to union two geometries + + + + Union a pair of geometries, + using the more performant overlap union algorithm if possible. + + The union of the inputs + + + + Gets a value indicating whether the optimized + or full union was performed. + + Used for unit testing.> + true if the optimized union was performed + + + + Implements union using the buffer-by-zero trick. + This seems to be more robust than overlay union, + for reasons somewhat unknown. + + A geometry + A geometry + The union of the geometries + + + + Computes the union of a geometry with + another arbitrary . + Does not copy any component geometries. + + + + + + + + Unions a Collection of s or a single Geometry (which may be a ) together. + + + + By using this special-purpose operation over a collection of geometries + it is possible to take advantage of various optimizations to improve performance. + + + Heterogeneous s are fully supported. + + + The result obeys the following contract: + + Unioning a set of s has the effect of merging the areas (i.e. the same effect as iteratively unioning all individual polygons together). + Unioning a set of s has the effect of fully noding + and dissolving the input linework. + In this context "fully noded" means that there will be + an endpoint or node in the result + for every endpoint or line segment crossing in the input. + "Dissolved" means that any duplicate (e.g. coincident) line segments or portions + of line segments will be reduced to a single line segment in the output. + This is consistent with the semantics of the + operation. + If merged linework is required, the class can be used. + Unioning a set of s has the effect of merging all identical points (producing a set with no duplicates). + + + UnaryUnion always operates on the individual components of MultiGeometries. + So it is possible to use it to "clean" invalid self-intersecting MultiPolygons + (although the polygon components must all still be individually valid.) + + + + mbdavis + + + + + Computes the geometric union of a + + A collection of geometries + The union of the geometries, + or null if the input is empty + + + + Computes the geometric union of a + If no input geometries were provided but a was provided, + an empty is returned. + + A collection of geometries + The geometry factory to use if the collection is empty + The union of the geometries + or an empty GEOMETRYCOLLECTION + + + Constructs a unary union operation for a + (which may be a ). + + A geometry to union + The union of the elements of the geometry + or an empty GEOMETRYCOLLECTION + + + + Constructs a unary union operation for an enumeration + of s, using the + of the input geometries. + + An enumeration of geometries + + + + Constructs a unary union operation for an enumeration + of s. + If no input geometries were provided but a was provided, + + An enumeration of geometries + The geometry factory to use if the enumeration is empty + + + + Constructs a unary union operation for a + (which may be a ). + + A geometry to union + + + + Named setter named setUnionFun[ction] in JTS + + + + + Gets the union of the input geometries. + + The result of empty input is determined as follows: + + If the input is empty and a dimension can be + determined (i.e. an empty geometry is present), + an empty atomic geometry of that dimension is returned. + If no input geometries were provided but a was provided, + an empty is returned. + Otherwise, the return value is null. + + + + A Geometry containing the union, + or an empty atomic geometry, or an empty GEOMETRYCOLLECTION, + ornull if no GeometryFactory was provided + + + + + Computes the union of two geometries, either of both of which may be null. + + + + + The union of the input(s) + or null if both inputs are null + + + + + Computes a unary union with no extra optimization, and no short-circuiting. + + + Due to the way the overlay operations are implemented, this is still efficient in the case of linear and puntal geometries. + + A geometry + The union of the input geometry + + + + Experimental code to union MultiPolygons with processing limited to the elements which actually interact. + + Not currently used, since it doesn't seem to offer much of a performance advantage. + mbdavis + + + + An strategy class that allows UnaryUnion to adapt to different + kinds of overlay algorithms. + + Martin Davis + + + + Computes the union of two geometries. + This method may throw a + if one is encountered. + + A geometry + A geometry + The union of the input + + + + Indicates whether the union function operates using + a floating(full) precision model. + If this is the case, then the unary union code + can make use of the { @link OverlapUnion} + performance optimization, + and perhaps other optimizations as well. + Otherwise, the union result extent may not be the same as the extent of the inputs, + which prevents using some optimizations. + + + + + This class tests that the interior of an area + ( or ) + is connected. An area Geometry is invalid if the interior is disconnected. + This can happen if: + - a shell self-intersects, + - one or more holes form a connected chain touching a shell at two different points, + - one or more holes form a ring around a subset of the interior. + If a disconnected situation is found the location of the problem is recorded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form s in graph into Minimal EdgeRings. + (Minimal Edgerings must be used, because only they are guaranteed to provide + a correct isHole computation). + + + + + + + Mark all the edges for the edgeRings corresponding to the shells of the input polygons. + Only ONE ring gets marked for each shell - if there are others which remain unmarked + this indicates a disconnected interior. + + + + + + + + + + + + + + + + + + + + Check if any shell ring has an unvisited edge. + A shell ring is a ring which is not a hole and which has the interior + of the parent area on the RHS. + (Note that there may be non-hole rings with the interior on the LHS, + since the interior of holes will also be polygonized into CW rings + by the LinkAllDirectedEdges() step). + + + true if there is an unvisited edge in a non-hole ring. + + + + Checks that a {GeometryGraph} representing an area + (a Polygon or MultiPolygon ) + is consistent with the SFS semantics for area geometries. + Checks include: + Testing for rings which self-intersect (both properly and at nodes). + Testing for duplicate rings. + If an inconsistency if found the location of the problem is recorded. + + + + + + + + + + + Returns the intersection point, or null if none was found. + + + + + + + + + + Check all nodes to see if their labels are consistent. + If any are not, return false. + + + + + Checks for two duplicate rings in an area. + Duplicate rings are rings that are topologically equal + (that is, which have the same sequence of points up to point order). + If the area is topologically consistent (determined by calling the + isNodeConsistentArea, + duplicate rings can be found by checking for EdgeBundles which contain more than one EdgeEnd. + (This is because topologically consistent areas cannot have two rings sharing + the same line segment, unless the rings are equal). + The start point of one of the equal rings will be placed in invalidPoint. + Returns true if this area Geometry is topologically consistent but has two duplicate rings. + + + + + Tests whether any holes of a Polygon are + nested inside another hole, using a spatial + index to speed up the comparisons. + + The logic assumes that the holes do not overlap and have no collinear segments + (so they are properly nested, and there are no duplicate holes). + + The situation where every vertex of a hole touches another hole + is invalid because either the hole is nested, + or else it disconnects the polygon interior. + This class detects the nested situation. + The disconnected interior situation must be checked elsewhere. + + + + + Gets a value indicating a point on a nested hole, if one exists. + + A point on a nested hole, or null if none are nested + + + + Tests if any hole is nested (contained) within another hole. + This is invalid. + The will be set to reflect this. + + true if some hole is nested. + + + + Tests whether a MultiPolygon has any element polygon + nested inside another polygon, using a spatial + index to speed up the comparisons. + + The logic assumes that the polygons do not overlap and have no collinear segments + (so they are properly nested, and there are no duplicate rings). + + + + + Gets a point on a nested polygon, if one exists. + + A point on a nested polygon, or null if none are nested + + + + Tests if any polygon is nested (contained) within another polygon. + This is invalid. + The nested point will be set to reflect this. + + true if some polygon is nested + + + + Finds a point of a shell segment which lies inside a polygon, if any. + The shell is assume to touch the polyon only at shell vertices, + and does not cross the polygon. + + The shell to test + The polygon to test against + An interior segment point, or null if the shell is nested correctly + + + + Tests whether any of a set of s are + nested inside another ring in the set, using a spatial + index to speed up the comparisons. + + + + + Tests whether a Geometry is simple as defined by the OGC SFS specification. + + Simplicity is defined for each + type as follows: + + Pointgeometries are simple. + MultiPointgeometries are simple if every point is unique + LineStringgeometries are simple if they do not self-intersect at interior points + (i.e.points other than the endpoints). + MultiLineStringgeometries are simple if + their elements are simple and they intersect only at points + which are boundary points of both elements. + (The notion of boundary points can be user-specified - see below). + Polygonalgeometries have no definition of simplicity. + The IsSimple code checks if all polygon rings are simple. + (Note: this means thatIsSimple cannot be used to test + for all self-intersections in Polygon s. + In order to check if a IPolygonal geometry has self-intersections, + use . + GeometryCollectiongeometries are simple if all their elements are simple. + Empty geometries are simple + + For geometries the evaluation of simplicity + can be customized by supplying a + to define how boundary points are determined. + The default is the SFS-standard . + + Note that under the Mod-2 rule, closed LineStrings (rings) + have no boundary. + This means that an intersection at their endpoints makes the geometry non-simple. + If it is required to test whether a set of LineStrings touch + only at their endpoints, use . + For example, this can be used to validate that a collection of lines + form a topologically valid linear network. + + By default this class finds a single non-simple location. + To find all non-simple locations, set + before calling , and retrieve the locations + via . + This can be used to find all intersection points in a linear network. + + + + + + + Tests whether a geometry is simple. + + The input geometry + true if the geometry is simple + + + + Gets a non-simple location in a geometry, if any. + + The input geometry + A non-simple location, or null if the geometry is simple + + + + Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule + + The geometry to test + + + + Creates a simplicity checker using a given + + The geometry to test + The boundary node rule to use + + + Gets or sets a value indicating if all non-simple points should be reported. + + + + Tests whether the geometry is simple. + + true if the geometry is simple. + + + + Gets the coordinate for an location where the geometry + fails to be simple (i.e. where it has a non-boundary + self-intersection). + + A Coordinate for the location of the non-boundary self-intersection + or null if the geometry is simple + + + + Gets all non-simple intersection locations. + + A list of the Coordinates of non-simple locations. + + + + Computes simplicity for polygonal geometries. + Polygonal geometries are simple if and only if + all of their component rings are simple. + + A geometry + true if the geometry is simple + + + + Semantics for GeometryCollection is + simple if all components are simple. + + A geometry collection + true if the geometry is simple + + + + Creates an instance of this class + + A flag indicating if closed endpoints belong to the interior + A flag indicating that all non-simple intersection points should be found + A list to add the non-simple intersection points to. + + + + Tests whether an intersection was found. + + true if an intersection was found. + + + + + + + Tests whether an intersection vertex is an endpoint of a segment string. + + The segment string + The index of the segment in + The line intersector + The index of the segment in intersector + true if the intersection vertex is an endpoint + + + + Finds the vertex index in a segment of an intersection + which is known to be a vertex. + + The line intersector + The intersection segment index + + The vertex index (0 or 1) in the segment vertex of the intersection point + + + + + + + + Implements the algorithms required to compute the + method for s. + See the documentation for the various geometry types for a specification of validity. + + + + + Tests whether a is valid. + + The geometry to test + true if the geometry is valid + In JTS this function is called IsValid + + + + Checks whether a coordinate is valid for processing. + Coordinates are valid if their x and y ordinates are in the + range of the floating point representation. + + The coordinate to validate + true if the coordinate is valid + + + + The geometry being validated + + + + + If the following condition is TRUE JTS will validate inverted shells and exverted holes + (the ESRI SDE model) + + + + + Creates a new validator for a geometry + + The geometry to validate + + + + Gets or sets a value indicating whether polygons using Self-Touching Rings to form + holes are reported as valid. + If this flag is set, the following Self-Touching conditions + are treated as being valid: + + the shell ring self-touches to create a hole touching the shell + a hole ring self-touches to create two holes touching at a point + + + The default (following the OGC SFS standard) + is that this condition is not valid (false). + + Self-Touching Rings which disconnect the + the polygon interior are still considered to be invalid + (these are invalid under the SFS, and many other + spatial models as well). + This includes: + + exverted ("bow-tie") shells which self-touch at a single point + inverted shells with the inversion touching the shell at another point + exverted holes with exversion touching the hole at another point + inverted ("C-shaped") holes which self-touch at a single point causing an island to be formed + inverted shells or exverted holes which form part of a chain of touching rings + (which disconnect the interior) + + + + + + + Gets/Sets whether polygons using Self-Touching Rings to form + holes are reported as valid. + If this flag is set, the following Self-Touching conditions + are treated as being valid:
+ - The shell ring self-touches to create a hole touching the shell.
+ - A hole ring self-touches to create two holes touching at a point.
+
+ + The default (following the OGC SFS standard) + is that this condition is not valid (false). + + + This does not affect whether Self-Touching Rings + disconnecting the polygon interior are considered valid + (these are considered to be invalid under the SFS, and many other + spatial models as well). + This includes "bow-tie" shells, + which self-touch at a single point causing the interior to be disconnected, + and "C-shaped" holes which self-touch at a single point causing an island to be formed. + +
+ States whether geometry with this condition is valid. +
+ + + Tests the validity of the input geometry. + + true if the geometry is valid. + + + + Gets a value indicating the validity of the geometry + If not valid, returns the validation error for the geometry, + or null if the geometry is valid. + + The validation error, if the geometry is invalid + or null if the geometry is valid + + + + Tests validity of a Point. + + The Point to test + true if the Point is valid + In JTS this function is called IsValid + + + + Tests validity of a MultiPoint. + + The MultiPoint to test + true if the MultiPoint is valid + In JTS this function is called IsValid + + + + Tests validity of a LineString.
+ Almost anything goes for LineStrings! +
+ The LineString to test + In JTS this function is called IsValid +
+ + + Tests validity of a LinearRing.
+
+ The LinearRing to test + In JTS this function is called IsValid +
+ + + Tests validity of a Polygon.
+
+ The Polygon to test + In JTS this function is called IsValid +
+ + + Tests validity of a MultiPolygon.
+
+ The MultiPolygon to test + In JTS this function is called IsValid +
+ + + Tests validity of a GeometryCollection.
+
+ The GeometryCollection to test + In JTS this function is called IsValid +
+ + + Check the number of non-repeated points is at least a given size. + + The line to test + The minimum number of points in + true if the line has the required number of points + + + + Test if the number of non-repeated points in a line + is at least a given minimum size. + + The line to test + The minimum number of points in + true if the line has the required number of non-repeated points + + + + Check whether a ring self-intersects (except at its endpoints). + + The linear ring to check + + + + Tests that each hole is inside the polygon shell. + This routine assumes that the holes have previously been tested + to ensure that all vertices lie on the shell or on the same side of it + (i.e. that the hole rings do not cross the shell ring). + Given this, a simple point-in-polygon test of a single point in the hole can be used, + provided the point is chosen such that it does not lie on the shell. + + The polygon to be tested for hole inclusion + + + + Checks if a polygon hole lies inside its shell + and if not returns a point indicating this. + The hole is known to be wholly inside or outside the shell, + so it suffices to find a single point which is interior or exterior, + or check the edge topology at a point on the boundary of the shell. + + The hole to test + The polygon shell to test against + A hole point outside the shell, or null if it is inside. + + + + Checks if any polygon hole is nested inside another. + Assumes that holes do not cross (overlap), + This is checked earlier. + + The polygon with holes to test + + + + Checks that no element polygon is in the interior of another element polygon. + Preconditions: + + shells do not partially overlap + shells do not touch along an edge + no duplicate rings exist + These have been confirmed by the . + + + + + Find a point from the list of testCoords + that is NOT a node in the edge for the list of searchCoords. + + + + + The point found, or null if none found. + + + Finds and analyzes intersections in and between polygons, + to determine if they are valid. + + The s which are analyzed can have s + attached. If so they will be updated with intersection information + to support further validity analysis which must be done after + basic intersection validity has been confirmed. + + Martin Davis + + + + Creates a new finder, allowing for the mode where inverted rings are valid. + + true if inverted rings are valid. + + + + For a segment string for a ring, gets the coordinate + previous to the given index (wrapping if the index is 0) + + The ring segment string + The segment index + The coordinate previous to the given segment + + + + Tests if two segments in a closed are adjacent. + This handles determining adjacency across the start/end of the ring. + + The segment string + A segment index + A segment index + true if the segments are adjacent + + + + Functions to compute topological information + about nodes (ring intersections) in polygonal geometry. + + Martin Davis + + + + Check if the edges at a node between two rings (or one ring) cross. + The node is topologically valid if the ring edges do not cross. + This function assumes that the edges are not collinear. + + The node location + The previous edge endpoint in a ring + The next edge endpoint in a ring + The previous edge endpoint in the other ring + The next edge endpoint in the other ring + + true if the edges cross at the node + + + + + Tests whether an edge node-b lies in the interior or exterior + of a corner of a ring given by a0-node-a1. + The ring interior is assumed to be on the right of the corner (a CW ring). + The edge must not be collinear with the corner segments. + + The node location + The first vertex of the corner + The second vertex of the corner + The destination vertex of the edge + true if the edge is interior to the ring corner + + + + Tests if an edge p is between edges e0 and e1, + where the edges all originate at a common origin. + The "inside" of e0 and e1 is the arc which does not include the origin. + The edges are assumed to be distinct (non-collinear). + + the origin + the destination point of edge p + the destination point of edge e0 + the destination point of edge e1 + true if p is between e0 and e1 + + + + Tests if the angle with the origin of a vector P is greater than that of the + vector Q. + + The origin of the vectors + The endpoint of the vector P + The endpoint of the vector Q + true if vector P has angle greater than Q + + + + A ring of a polygon being analyzed for topological validity. + The shell and hole rings of valid polygons touch only at discrete points. + The "touch" relationship induces a graph over the set of rings. + The interior of a valid polygon must be connected. + This is the case if there is no "chain" of touching rings + (which would partition off part of the interior). + This is equivalent to the touch graph having no cycles. + Thus the touch graph of a valid polygon is a forest - a set of disjoint trees. + + Also, in a valid polygon two rings can touch only at a single location, + since otherwise they disconnect a portion of the interior between them. + This is checked as the touches relation is built + (so the touch relation representation for a polygon ring does not need to support + more than one touch location for each adjacent ring). + + The cycle detection algorithm works for polygon rings which also contain self-touches + (inverted shells and exverted holes). + + Polygons with no holes do not need to be checked for + a connected interior, unless self-touches are allowed. + + The class also records the topology at self-touch nodes, + to support checking if an invalid self-touch disconnects the polygon. + + Martin Davis + + + + Tests if a polygon ring represents a shell. + + The ring to test (may be null) + true if the ring represents a shell + + + + Records a touch location between two rings, + and checks if the rings already touch in a different location. + + A polygon ring + A polygon ring + The location where they touch + true if the polygons already touch + + + + Finds a location (if any) where a chain of holes forms a cycle + in the ring touch graph. + The shell may form part of the chain as well. + This indicates that a set of holes disconnects the interior of a polygon. + + The list of rings to check + A vertex contained in a ring cycle or null if none is found. + + + + Finds a location of an interior self-touch in a list of rings, + if one exists. + This indicates that a self-touch disconnects the interior of a polygon, + which is invalid. + + The list of rings to check + The location of an interior self-touch node, or null if there are none + + + + The root of the touch graph tree containing this ring. + Serves as the id for the graph partition induced by the touch relation. + + + + + The set of links + for this ring. + The set of all touches in the rings of a polygon + forms the polygon touch graph. + This supports detecting touch cycles, which + reveal the condition of a disconnected interior. + + Only a single touch is recorded between any two rings, + since more than one touch between two rings + indicates interior disconnection as well. + + + + + The set of self-nodes in this ring. + This supports checking valid ring self-touch topology. + + + + + Creates a ring for a polygon shell. + + The polygon shell + + + + Creates a ring for a polygon hole. + + The ring geometry + The index of the hole + The parent polygon shell + + + + Adds a point where a touches another one. + + The other + The touch location + + + + Adds the node (intersection point) + and the endpoints of the four adjacent segments. + + The node + The 1st position of the 1st edge + The 2nd position of the 1st edge + The 1st position of the 2nd edge + The 2nd position of the 2nd edge + + + + Tests if this ring touches a given ring at + the single point specified. + + The other polygon ring + The touch point + true if the rings touch only at the given point. + + + + Detects whether the subgraph of holes linked by touch to this ring + contains a hole cycle. + If no cycles are detected, the set of touching rings is a tree. + The set is marked using this ring as the root. + + A vertex om a hole cycle or null if no cycle found + + + + Scans for a hole cycle starting at a given touch. + + The touch to investigate + The root of the touch subgraph + The queue of rings to scan + + + + Finds the location of an invalid interior self-touch in this ring, + if one exists. + + The location of an interior self-touch node, or null if there are none + + + + + + + + Records a point where a touches another one. + This forms an edge in the induced ring touch graph. + + Martin Davis + + + + Creates an instance of this item + + The polygon ring + The touch position + + + + Represents a ring self-touch node, recording the node (intersection point) + and the endpoints of the four adjacent segments. + + This is used to evaluate validity of self-touching nodes, + when they are allowed. + + Martin Davis + + + + Creates an instance of this point + + The self touch position + The 1st position of the 1st edge + The 2nd position of the 1st edge + The 1st position of the 2nd edge + The 2nd position of the 2nd edge + + + + Gets a value indicating the node point + + + + + Tests if a self-touch has the segments of each half of the touch + lying in the exterior of a polygon. + This is a valid self-touch. + It applies to both shells and holes. + Only one of the four possible cases needs to be tested, + since the situation has full symmetry. + + A flag indicating if the interior is to the right of the parent ring + true if the self-touch is on the exterior. + + + + Analyzes the topology of polygonal geometry + to determine whether it is valid. + + Martin Davis + + + + Finds a self-intersection (if any) in a . + + The ring to analyze + A self-intersection point if one exists, or null + + + + Tests whether a segment p0-p1 is inside or outside a ring. + + Preconditions: + + The segment intersects the ring only at the endpoints + One, none or both of the segment endpoints may lie on the ring + The ring does not self-cross, but it may self-touch + + + A segment vertex + A segment vertex + The ring to test + true if the segment lies inside the ring + + + + Tests whether a touching segment is interior to a ring. + + Preconditions: + + The segment does not intersect the ring other than at the endpoints + The segment vertex p0 lies on the ring + The ring does not self-cross, but it may self-touch + + This works for both shells and holes, but the caller must know + the ring role. + + The first vertex of the segment + The second vertex of the segment + The points of the ring + true if the segment is inside the ring. + + + + Computes the index of the segment which intersects a given point. + + The ring points + The intersection point + The intersection segment index, or -1 if not intersection is found. + + + + Tests whether the interior of the polygonal geometry is + disconnected.
+ If true, the disconnection location is available from + . +
+ true if the interior is disconnected +
+ + + Gets a location where the polyonal interior is disconnected.
+ must be called first. +
+ The location of an interior disconnection, or null +
+ + + Tests whether any polygon with holes has a disconnected interior + by virtue of the holes (and possibly shell) forming a touch cycle. + + This is a global check, which relies on determining + the touching graph of all holes in a polygon. + + If inverted rings disconnect the interior + via a self-touch, this is checked by the . + If inverted rings are part of a disconnected ring chain + this is detected here. + + true if a polygon has a disconnected interior. + + + + Tests if an area interior is disconnected by a self-touching ring. + This must be evaluated after other self-intersections have been analyzed + and determined to not exist, since the logic relies on + the rings not self-crossing (winding). + + true if an area interior is disconnected by a self-touch + + + + Implements the appropriate checks for repeated points + (consecutive identical coordinates) as defined in the + NTS spec. + + + + + Gets a value indicating the location of the repeated point + + + + + Checks if a geometry has a repeated point + + The geometry to test + true if the geometry has a repeated point, otherwise false + + + + Checks if an array of Coordinates has a repeated point + + An array of coordinates + true if has a repeated point, otherwise false + + + + Checks if an array of Coordinates has a repeated point + + A coordinate sequence + true if has a repeated point, otherwise false + + + + Contains information about the nature and location of + a validation error. + + + + + + + + + Indicates that a hole of a polygon lies partially + or completely in the exterior of the shell. + + + + + Indicates that a hole lies + in the interior of another hole in the same polygon. + + + + + Indicates that the interior of a polygon is disjoint + (often caused by set of contiguous holes splitting + the polygon into two parts). + + + + + Indicates that two rings of a polygonal geometry intersect. + + + + + Indicates that a ring self-intersects. + + + + + Indicates that a polygon component of a + lies inside another polygonal component. + + + + + Indicates that a polygonal geometry + contains two rings which are identical. + + + + + Indicates that either: + - A contains a single point. + - A contains 2 or 3 points. + + + + + Indicates that the X or Y ordinate of + a is not a valid + numeric value (e.g. ). + + + + + Indicates that a ring is not correctly closed + (the first and the last coordinate are different). + + + + + Contains information about the nature and location of a Geometry + validation error. + + + + + These messages must synch up with the indexes above + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Finds all connected s of a . + + + + + Initializes a new instance of the class. + + The . + + + + Adds all nodes and edges reachable from this node to the subgraph. + Uses an explicit stack to avoid a large depth of recursion. + + + + + + + Adds the argument node and all its out edges to the subgraph. + + + + + + + + Represents a directed edge in a PlanarGraph. A DirectedEdge may or + may not have a reference to a parent Edge (some applications of + planar graphs may not require explicit Edge objects to be created). Usually + a client using a PlanarGraph will subclass DirectedEdge + to add its own application-specific data and methods. + + + + + Returns a List containing the parent Edge (possibly null) for each of the given + DirectedEdges. + + + + + + + Constructs a DirectedEdge connecting the from node to the + to node. + + + + + Specifies this DirectedEdge's direction (given by an imaginary + line from the from node to directionPt). + + + Whether this DirectedEdge's direction is the same as or + opposite to that of the parent Edge (if any). + + + + + Returns this DirectedEdge's parent Edge, or null if it has none. + Associates this DirectedEdge with an Edge (possibly null, indicating no associated + Edge). + + + + + Returns 0, 1, 2, or 3, indicating the quadrant in which this DirectedEdge's + orientation lies. + + + + + Returns 0, 1, 2, or 3, indicating the quadrant in which this DirectedEdge's + orientation lies. + + + + + Returns a point to which an imaginary line is drawn from the from-node to + specify this DirectedEdge's orientation. + + + + + Returns whether the direction of the parent Edge (if any) is the same as that + of this Directed Edge. + + + + + Returns the node from which this DirectedEdge leaves. + + + + + Returns the node to which this DirectedEdge goes. + + + + + Returns the coordinate of the from-node. + + + + + Returns the angle that the start of this DirectedEdge makes with the + positive x-axis, in radians. + + + + + Returns the symmetric DirectedEdge -- the other DirectedEdge associated with + this DirectedEdge's parent Edge. + Sets this DirectedEdge's symmetric DirectedEdge, which runs in the opposite + direction. + + + + + Returns 1 if this DirectedEdge has a greater angle with the + positive x-axis than b", 0 if the DirectedEdges are collinear, and -1 otherwise. + Using the obvious algorithm of simply computing the angle is not robust, + since the angle calculation is susceptible to round off. A robust algorithm + is: + first compare the quadrants. If the quadrants are different, it it + trivial to determine which vector is "greater". + if the vectors lie in the same quadrant, the robust + RobustCGAlgorithms.ComputeOrientation(Coordinate, Coordinate, Coordinate) + function can be used to decide the relative orientation of the vectors. + + + + + + + Returns 1 if this DirectedEdge has a greater angle with the + positive x-axis than b", 0 if the DirectedEdges are collinear, and -1 otherwise. + Using the obvious algorithm of simply computing the angle is not robust, + since the angle calculation is susceptible to round off. A robust algorithm + is: + first compare the quadrants. If the quadrants are different, it it + trivial to determine which vector is "greater". + if the vectors lie in the same quadrant, the robust + RobustCGAlgorithms.ComputeOrientation(Coordinate, Coordinate, Coordinate) + function can be used to decide the relative orientation of the vectors. + + + + + + + Writes a detailed string representation of this DirectedEdge to the given PrintStream. + + + + + + Tests whether this component has been removed from its containing graph. + + + + + + Removes this directed edge from its containing graph. + + + + + + + + A sorted collection of DirectedEdges which leave a Node + in a PlanarGraph. + + + + + The underlying list of outgoing DirectedEdges. + + + + + Adds a new member to this DirectedEdgeStar. + + + + + + Drops a member of this DirectedEdgeStar. + + + + + + Returns an Iterator over the DirectedEdges, in ascending order by angle with the positive x-axis. + + + + + Returns the number of edges around the Node associated with this DirectedEdgeStar. + + + + + Returns the coordinate for the node at which this star is based. + + + + + Returns the DirectedEdges, in ascending order by angle with the positive x-axis. + + + + + + + + + + Returns the zero-based index of the given Edge, after sorting in ascending order + by angle with the positive x-axis. + + + + + + + Returns the zero-based index of the given DirectedEdge, after sorting in ascending order + by angle with the positive x-axis. + + + + + + + Returns the remainder when i is divided by the number of edges in this + DirectedEdgeStar. + + + + + + + Returns the on the left-hand + side of the given + (which must be a member of this DirectedEdgeStar). + + + + + + + Returns the on the right-hand (CW) + side of the given + (which must be a member of this DirectedEdgeStar). + + + + + Represents an undirected edge of a {PlanarGraph}. An undirected edge + in fact simply acts as a central point of reference for two opposite + DirectedEdges. + Usually a client using a PlanarGraph will subclass Edge + to add its own application-specific data and methods. + + + + + The two DirectedEdges associated with this Edge. + + + + + Constructs an Edge whose DirectedEdges are not yet set. Be sure to call + SetDirectedEdges(DirectedEdge, DirectedEdge). + + + + + Constructs an Edge initialized with the given DirectedEdges, and for each + DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds + this Edge to its from-Node. + + + + + + + Initializes this Edge's two DirectedEdges, and for each DirectedEdge: sets the + Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node. + + + + + + + Returns one of the DirectedEdges associated with this Edge. + + 0 or 1. + + + + + Returns the DirectedEdge that starts from the given node, or null if the + node is not one of the two nodes associated with this Edge. + + + + + + + If node is one of the two nodes associated with this Edge, + returns the other node; otherwise returns null. + + + + + + + Removes this edge from its containing graph. + + + + + Tests whether this component has been removed from its containing graph. + + + + + + The base class for all graph component classes. + Maintains flags of use in generic graph algorithms. + Provides two flags: + marked - typically this is used to indicate a state that persists + for the course of the graph's lifetime. For instance, it can be + used to indicate that a component has been logically deleted from the graph. + visited - this is used to indicate that a component has been processed + or visited by an single graph algorithm. For instance, a breadth-first traversal of the + graph might use this to indicate that a node has already been traversed. + The visited flag may be set and cleared many times during the lifetime of a graph. + + + + + Sets the state + for all s in an . + + A to scan. + The state to set the flag to. + + + + Sets the state + for all s in an . + + A to scan. + The state to set the flag to. + + + + Finds the first + in a set + which has the specified state. + + A to scan. + The state to test. + The first found, or null if none found. + + + + Tests if a component has been visited during the course of a graph algorithm. + + + + + Gets/Sets the visited flag for this component. + + + + + Tests if a component has been marked at some point during the processing + involving this graph. + + + + + Gets/Sets the marked flag for this component. + + + + + Tests whether this component has been removed from its containing graph. + + + + + Gets or sets user defined data for this component + + + + + A node in a PlanarGraph is a location where 0 or more Edges + meet. A node is connected to each of its incident Edges via an outgoing + DirectedEdge. Some clients using a PlanarGraph may want to + subclass Node to add their own application-specific + data and methods. + + + + + Returns all Edges that connect the two nodes (which are assumed to be different). + + + + + + + + The location of this Node. + + + + + The collection of DirectedEdges that leave this Node. + + + + + Constructs a Node with the given location. + + + + + + Constructs a Node with the given location and collection of outgoing DirectedEdges. + + + + + + + Returns the location of this Node. + + + + + Adds an outgoing DirectedEdge to this Node. + + + + + + Returns the collection of DirectedEdges that leave this Node. + + + + + Returns the number of edges around this Node. + + + + + Returns the zero-based index of the given Edge, after sorting in ascending order + by angle with the positive x-axis. + + + + + + + Removes a incident on this node. Does not change the state of the directed edge. + + + + + Removes this node from its containing graph. + + + + + Tests whether this component has been removed from its containing graph. + + + + + + + + + + + + A map of nodes, indexed by the coordinate of the node. + + + + + Adds a node to the map, replacing any that is already at that location. + + + The added node. + + + + Removes the Node at the given location, and returns it (or null if no Node was there). + + + + + + + Returns the Node at the given location, or null if no Node was there. + + + + + + + Returns an Iterator over the Nodes in this NodeMap, sorted in ascending order + by angle with the positive x-axis. + + + + + Returns the Nodes in this NodeMap, sorted in ascending order + by angle with the positive x-axis. + + + + + Returns the number of Nodes in this NodeMap. + + + + + Represents a directed graph which is embeddable in a planar surface. + This class and the other classes in this package serve as a framework for + building planar graphs for specific algorithms. This class must be + subclassed to expose appropriate methods to construct the graph. This allows + controlling the types of graph components ({DirectedEdge}s, + Edges and Nodes) which can be added to the graph. An + application which uses the graph framework will almost always provide + subclasses for one or more graph components, which hold application-specific + data and graph algorithms. + + + + + + + + + + + + + + + + + + + + Returns the at the given location, or null if no was there. + + The location + The node found
+ or null if this graph contains no node at the location +
+
+ + + Adds a node to the map, replacing any that is already at that location. + Only subclasses can add Nodes, to ensure Nodes are of the right type. + + + The added node. + + + + Adds the Edge and its DirectedEdges with this PlanarGraph. + Assumes that the Edge has already been created with its associated DirectEdges. + Only subclasses can add Edges, to ensure the edges added are of the right class. + + + + + + Adds the Edge to this PlanarGraph; only subclasses can add DirectedEdges, + to ensure the edges added are of the right class. + + + + + + Returns an IEnumerator over the Nodes in this PlanarGraph. + + + + + + Returns the Nodes in this PlanarGraph. + + + + + Returns an Iterator over the DirectedEdges in this PlanarGraph, in the order in which they + were added. + + + + + + Returns an Iterator over the Edges in this PlanarGraph, in the order in which they + were added. + + + + + + Returns the Edges that have been added to this PlanarGraph. + + + + + Removes an Edge and its associated DirectedEdges from their from-Nodes and + from this PlanarGraph. Note: This method does not remove the Nodes associated + with the Edge, even if the removal of the Edge reduces the degree of a + Node to zero. + + + + + + Removes a from its from- and from this PlanarGraph. + + + This method does not remove the s associated with the DirectedEdge, + even if the removal of the DirectedEdge reduces the degree of a Node to zero. + + + + + + Removes a node from the graph, along with any associated DirectedEdges and + Edges. + + + + + + Returns all Nodes with the given number of Edges around it. + + + + + + + A subgraph of a . + A subgraph may contain any subset of s + from the parent graph. + It will also automatically contain all s + and s associated with those edges. + No new objects are created when edges are added - + all associated components must already exist in the parent graph. + + + + + + + + + + + + + + + + + + + + + + + + + Creates a new subgraph of the given . + + + + + + Gets the which this subgraph is part of. + + + + + + Adds an to the subgraph. + The associated s and s are also added. + + The to add. + + + + Returns an over the s in this graph, + in the order in which they were added. + + + + + + Returns an over the s in this graph, + in the order in which they were added. + + + + + + Returns an over the s in this graph. + + + + + + Tests whether an is contained in this subgraph. + + The to test. + true if the is contained in this subgraph. + + + + Determines the maximum number of common most-significant + bits in the mantissa of one or numbers. + Can be used to compute the double-precision number which + is represented by the common bits. + If there are no common bits, the number computed is 0.0. + + + + + Computes the bit pattern for the sign and exponent of a + double-precision number. + + + The bit pattern for the sign and exponent. + + + + This computes the number of common most-significant bits in the mantissas + of two double-precision numbers. + It does not count the hidden bit, which is always 1. + It does not determine whether the numbers have the same exponent - if they do + not, the value computed by this function is meaningless. + + + /// + The number of common most-significant mantissa bits. + + + + Zeroes the lower n bits of a bitstring. + + The bitstring to alter. + the number of bits to zero. + The zeroed bitstring. + + + + Extracts the i'th bit of a bitstring. + + The bitstring to extract from. + The bit to extract. + The value of the extracted bit. + + + + + + + + + + + + + + + A representation of the Double bits formatted for easy readability + + + + + + + Provides versions of Geometry spatial functions which use + common bit removal to reduce the likelihood of robustness problems. + In the current implementation no rounding is performed on the + reshifted result point, which means that it is possible + that the returned Geometry is invalid. + Client classes should check the validity of the returned result themselves. + + + + + Creates a new instance of class, which reshifts result Geometrys. + + + + + Creates a new instance of class, specifying whether + the result Geometrys should be reshifted. + + + + + + Computes the set-theoretic intersection of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic intersection of the input Geometries. + + + + Computes the set-theoretic union of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic union of the input Geometries. + + + + Computes the set-theoretic difference of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry, to be subtracted from the first. + The Geometry representing the set-theoretic difference of the input Geometries. + + + Computes the set-theoretic symmetric difference of two geometries, + using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic symmetric difference of the input Geometries. + + + + Computes the buffer a point, using enhanced precision. + + The Geometry to buffer. + The buffer distance. + The Geometry representing the buffer of the input Geometry. + + + + If required, returning the result to the original precision if required. + In this current implementation, no rounding is performed on the + reshifted result point, which means that it is possible + that the returned Geometry is invalid. + + The result Geometry to modify. + The result Geometry with the required precision. + + + + Computes a copy of the input Geometry with the calculated common bits + removed from each coordinate. + + The Geometry to remove common bits from. + A copy of the input Geometry with common bits removed. + + + + Computes a copy of each input Geometrys with the calculated common bits + removed from each coordinate. + + A Geometry to remove common bits from. + A Geometry to remove common bits from. + + An array containing copies + of the input Geometry's with common bits removed. + + + + + Removes common most-significant mantissa bits + from one or more s. + + The CommonBitsRemover "scavenges" precision + which is "wasted" by a large displacement of the geometry + from the origin. + For example, if a small geometry is displaced from the origin + by a large distance, + the displacement increases the significant figures in the coordinates, + but does not affect the relative topology of the geometry. + Thus the geometry can be translated back to the origin + without affecting its topology. + In order to compute the translation without affecting + the full precision of the coordinate values, + the translation is performed at the bit level by + removing the common leading mantissa bits. + + If the geometry envelope already contains the origin, + the translation procedure cannot be applied. + In this case, the common bits value is computed as zero. + + If the geometry crosses the Y axis but not the X axis + (and mutatis mutandum), + the common bits for Y are zero, + but the common bits for X are non-zero. + + + + + Add a point to the set of geometries whose common bits are + being computed. After this method has executed the + common coordinate reflects the common bits of all added + geometries. + + A Geometry to test for common bits. + + + + The common bits of the Coordinates in the supplied Geometries. + + + + + Removes the common coordinate bits from a Geometry. + The coordinates of the Geometry are changed. + + The Geometry from which to remove the common coordinate bits. + The shifted Geometry. + + + + Adds the common coordinate bits back into a Geometry. + The coordinates of the Geometry are changed. + + The Geometry to which to add the common coordinate bits. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The coordinate sequence + + + + Reduces the precision of the s in a + to match the supplied . + + + Uses . + The input is modified in-place, so + it should be cloned beforehand if the + original should not be modified. + + mbdavis + + + + Creates a new precision reducer filter. + + The PrecisionModel to use + + + + Rounds the Coordinates in the sequence to match the PrecisionModel + + + + + Always runs over all geometry components. + + + + + Always reports that the geometry has changed + + + + + Provides versions of Geometry spatial functions which use + enhanced precision techniques to reduce the likelihood of robustness problems. + + + + + Only static methods! + + + + + Computes the set-theoretic intersection of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic intersection of the input Geometries. + + + + Computes the set-theoretic union of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic union of the input Geometries. + + + + Computes the set-theoretic difference of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic difference of the input Geometries. + + + + Computes the set-theoretic symmetric difference of two Geometrys, using enhanced precision. + + The first Geometry. + The second Geometry. + The Geometry representing the set-theoretic symmetric difference of the input Geometries. + + + + Reduces the precision of a + according to the supplied , + ensuring that the result is valid (unless specified otherwise). + + By default the geometry precision model is not changed. + This can be overridden by using . +

Topological Precision Reduction

+ The default mode of operation ensures the reduced result is topologically valid + (i.e. is true). + To ensure this polygonal geometry is reduced in a topologically valid fashion + (technically, by using snap-rounding). + Note that this may change polygonal geometry structure + (e.g.two polygons separated by a distance below the specified precision + will be merged into a single polygon). + Duplicate vertices are removed. + This mode is invoked by the static method . + + Normally, collapsed linear components(e.g.lines collapsing to a point) + are not included in the result. + This behavior can be changed + by setting to false, + or by using the static method . + + In general input must be valid geometry, or an + will be thrown. However if the invalidity is "mild" or very small then it + may be eliminated by precision reduction. +

Pointwise Precision Reduction

+ Alternatively, geometry can be reduced pointwise by using {@link #setPointwise(boolean)}. + Linear and point geometry are always reduced pointwise(i.e.without further change to + topology or structure), since this does not change validity. + Invalid inputs are allowed. + Duplicate vertices are preserved. + Collapsed components are always included in the result. + The result geometry may be invalid. + + This mode is invoked by the static method . +
+
+ + + Reduces precision of a geometry, ensuring output geometry is valid. + Collapsed linear and polygonal components are removed. + The geometry precision model is not changed. + Invalid input geometry may cause an error, + unless the invalidity is below the scale of the precision reduction. + + The geometry to reduce + The precision model to use + The reduced geometry + Thrwon if the reduction fails due to invalid input geometry + + + + Reduces precision of a geometry, ensuring output polygonal geometry is valid, + and preserving collapsed linear elements. + The geometry precision model is not changed. + Invalid input geometry may cause an error, + unless the invalidity is below the scale of the precision reduction. + + The geometry to reduce + The precision model to use + The reduced geometry + Thrwon if the reduction fails due to invalid input geometry + + + + Reduce precision of a geometry in a pointwise way. + All input geometry elements are preserved in the output, + including invalid polygons and collapsed polygons and linestrings. + The output may not be valid, due to collapse or self-intersection. + The geometry precision model is not changed. + Invalid input geometry is allowed. + + The geometry to reduce + The precision model to use + The reduced geometry + + + Gets or sets whether the reduction will result in collapsed components + being removed completely, or simply being collapsed to an (invalid) + Geometry of the same type. + The default is to remove collapsed components. + + + + + Gets or sets whether the of the new reduced Geometry + will be changed to be the supplied to + specify the precision reduction. + + The default is to not change the precision model + + + + + Gets or sets whether the precision reduction will be done + in pointwise fashion only. + Pointwise precision reduction reduces the precision + of the individual coordinates only, but does + not attempt to recreate valid topology. + This is only relevant for geometries containing polygonal components. + + + + + Reduces the precision of a geometry, + according to the specified strategy of this reducer. + + The geometry to reduce + The precision-reduced geometry + if the reduction fails + due to input geometry is invalid. + + + + Duplicates a geometry to one that uses a different PrecisionModel, + without changing any coordinate values. + + The geometry to duplicate + The precision model to use + The geometry value with a new precision model + + + + Computes the Minimum Clearance of a . + + The Minimum Clearance is a measure of + what magnitude of perturbation of + the vertices of a geometry can be tolerated + before the geometry becomes topologically invalid. + The smaller the Minimum Clearance distance, + the less vertex perturbation the geometry can tolerate + before becoming invalid. + + + The concept was introduced by Thompson and Van Oosterom + [TV06], based on earlier work by Milenkovic [Mi88]. + + The Minimum Clearance of a geometry G + is defined to be the value r + such that "the movement of all points by a distance + of r in any direction will + guarantee to leave the geometry valid" [TV06]. + An equivalent constructive definition [Mi88] is that + r is the largest value such: + + No two distinct vertices of G are closer than r. + No vertex of G is closer than r to an edge of G of which the vertex is not an endpoint + + The following image shows an example of the Minimum Clearance + of a simple polygon. + +
minimum clearance
+ + If G has only a single vertex (i.e. is a + ), the value of the minimum clearance + is . + + If G is a or geometry, + then in fact no amount of perturbation + will render the geometry invalid. + In this case a Minimum Clearance is still computed + based on the vertex and segment distances + according to the constructive definition. + + It is possible for no Minimum Clearance to exist. + For instance, a with all members identical + has no Minimum Clearance + (i.e. no amount of perturbation will cause + the member points to become non-identical). + Empty geometries also have no such distance. + The lack of a meaningful MinimumClearance distance is detected + and suitable values are returned by + and . + + The computation of Minimum Clearance utilizes + the + method to provide good performance even for + large inputs. + + An interesting note is that for the case of s, + the computed Minimum Clearance line + effectively determines the Nearest Neighbours in the collection. +

References

+ + [Mi88] Milenkovic, V. J., + Verifiable implementations of geometric algorithms + using finite precision arithmetic. + in Artificial Intelligence, 377-401. 1988 + [TV06] Thompson, Rod and van Oosterom, Peter, + Interchange of Spatial Data-Inhibiting Factors, + Agile 2006, Visegrad, Hungary. 2006 + +
+ /// Martin Davis +
+ + + Computes the Minimum Clearance distance for + the given Geometry. + + The input geometry + The minimum clearance + + + + Gets a LineString containing two points + which are at the Minimum Clearance distance + for the given Geometry. + + The input geometry + The value of the minimum clearance distance
+ or LINESTRING EMPTY if no minimum clearance distance exists.
+
+ + + Creates an object to compute the Minimum Clearance for the given Geometry + + The input geometry + + + + Gets the Minimum Clearance distance. + If no distance exists + (e.g. in the case of two identical points) + is returned. + + + The value of the minimum clearance distance
+ or if no Minimum Clearance distance exists +
+
+ + + Gets a LineString containing two points + which are at the Minimum Clearance distance. + If no distance could be found + (e.g. in the case of two identical points) + LINESTRING EMPTY is returned. + + The value of the minimum clearance distance,
+ or LINESTRING EMPTY if no minimum clearance distance exists.
+
+ + + Implements the MinimumClearance distance function: + + dist(p1, p2) = + p1 != p2 : p1.distance(p2) + p1 == p2 : Double.MAX + + dist(p, seg) = + p != seq.p1 && p != seg.p2 + ? seg.distance(p) + : Double.MaxValue + + Also computes the values of the nearest points, if any. + + Martin Davis + + + + A transformer to reduce the precision of a geometry pointwise. + + Martin Davis + + + + A transformer to reduce the precision of geometry in a + topologically valid way.
+ Repeated points are removed. + If geometry elements collapse below their valid length, + they may be removed + by specifying isRemoveCollapsed as true. +
+ Martin Davis +
+ + + + + + + + + Computes the minimum clearance of a geometry or + set of geometries. + The Minimum Clearance is a measure of + what magnitude of perturbation of its vertices can be tolerated + by a geometry before it becomes topologically invalid. + + This class uses an inefficient O(N^2) scan. + It is primarily for testing purposes. + + + Martin Davis + + + + Creates a curved geometry by replacing the segments + of the input with Cubic Bezier Curves. + + + The Bezier control points are determined from the segments of the geometry + and the alpha control parameter controlling curvedness, and + the optional skew parameter controlling the shape of the curve at vertices. + The Bezier Curves are created to be C2-continuous (smooth) + at each input vertex. + + Alternatively, the Bezier control points can be supplied explicitly. + + The result is not guaranteed to be valid, since large alpha values + may cause self-intersections. + + + + + Creates a geometry of linearized Cubic Bezier Curves + defined by the segments of the input and a parameter + controlling how curved the result should be. + + The geometry defining the curve + A curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved) + The linearized curved geometry + + + + Creates a geometry of linearized Cubic Bezier Curves + defined by the segments of the inputand a parameter + controlling how curved the result should be, with a skew factor + affecting the curve shape at each vertex. + + The geometry defining the curve + The curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved) + The skew parameter (0 is none, positive skews towards longer side, negative towards shorter + The linearized curved geometry + + + + Creates a geometry of linearized Cubic Bezier Curves + defined by the segments of the input + and a list (or lists) of control points. + + + Typically the control point geometry + is a or + containing an element for each line or ring in the input geometry. + The list of control points for each linear element must contain two + vertices for each segment (and thus 2 * npts - 2). + + The geometry defining the curve + A geometry containing the control point elements. + The linearized curved geometry + + + + Creates a new instance producing a Bezier curve defined by a geometry + and an alpha curvedness value. + + The geometry defining curve + A curvedness parameter (0 = linear, 1 = round, 2 = distorted) + + + + Creates a new instance producing a Bezier curve defined by a geometry, + an alpha curvedness value, and a skew factor. + + The geometry defining curve + curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved) + The skew parameter (0 is none, positive skews towards longer side, negative towards shorter + + + + Creates a new instance producing a Bezier curve defined by a geometry, + and a list (or lists) of control points. + + + Typically the control point geometry + is a or + containing an element for each line or ring in the input geometry. + The list of control points for each linear element must contain two + vertices for each segment (and thus 2 * npts - 2). + + + + + Gets the computed Bezier curve geometry + + The curved geometry + + + + Creates control points for each vertex of curve. + The control points are collinear with each vertex, + thus providing C1-continuity. + By default the control vectors are the same length, + which provides C2-continuity(same curvature on each + side of vertex. + The alpha parameter controls the length of the control vectors. + Alpha = 0 makes the vectors zero-length, and hence flattens the curves. + Alpha = 1 makes the curve at right angles roughly circular. + Alpha > 1 starts to distort the curve and may introduce self-intersections. + + The control point array contains a pair of coordinates for each input segment. + + + + + Sets the end control points for a line. + Produce a symmetric curve for the first and last segments + by using mirrored control points for start and end vertex. + + The coordinates + The control points + + + + Creates a control point aimed at the control point at the opposite end of the segment. + + + + + Calculates vertices along a cubic Bezier curve. + + The start point + The end point + The first control point + The second control point + A set of interpolation parameters + An array to hold generated points. + + + + Gets the interpolation parameters for a Bezier curve approximated by a + given number of vertices. + + The number of vertices + An array of double[4] holding the parameter values + + + + Encodes points as the index along finite planar Hilbert curves. + + The planar Hilbert Curve is a continuous space-filling curve. + In the limit the Hilbert curve has infinitely many vertices and fills + the space of the unit square. + A sequence of finite approximations to the infinite Hilbert curve + is defined by the level number. + The finite Hilbert curve at level n Hₙ contains 2ⁿ⁺¹ points. + Each finite Hilbert curve defines an ordering of the + points in the 2-dimensional range square containing the curve. + Curves fills the range square of side 2ˡᵉᵛᵉˡ. + Curve points have ordinates in the range [0, 2ˡᵉᵛᵉˡ - 1]. + The index of a point along a Hilbert curve is called the Hilbert code. + The code for a given point is specific to the level chosen. + + + This implementation represents codes using 32-bit integers. + This allows levels 0 to 16 to be handled. + The class supports encoding points in the range of a given level curve + and decoding the point for a given code value. + + + The Hilbert order has the property that it tends to preserve locality. + This means that codes which are near in value will have spatially proximate + points. The converse is not always true - the delta between + codes for nearby points is not always small. But the average delta + is small enough that the Hilbert order is an effective way of linearizing space + to support range queries. + + + + Martin Davis + + + + + + + The maximum curve level that can be represented. + + + + + The number of points in the curve for the given level. + The number of points is 2²ˡᵉᵛᵉˡ. + + The level of the curve + The number of points. + + + + The maximum ordinate value for points + in the curve for the given level. + The maximum ordinate is 2ˡᵉᵛᵉˡ - 1. + + The level of the curve. + The maximum ordinate value. + + + + The level of the finite Hilbert curve which contains at least + the given number of points. + + The number of points required. + The level of the curve. + + + + Encodes a point (x,y) + in the range of the the Hilbert curve at a given level + as the index of the point along the curve. + The index will lie in the range [0, 2ˡᵉᵛᵉˡ⁺¹]. + + The level of the Hilbert curve. + The x ordinate of the point. + The y ordinate of the point. + The index of the point along the Hilbert curve. + + + + Clamps a level to the range valid for + the index algorithm used. + + The level of a Hilbert curve. + A valid level. + + + + Computes the point on a Hilbert curve + of given level for a given code index. + The point ordinates will lie in the range [0, 2ˡᵉᵛᵉˡ - 1]. + + The Hilbert curve level. + The index of the point on the curve. + The point on the Hilbert curve. + + + + Generates a representing the Hilbert Curve + at a given level. + + + + + Initializes a new instance of the class + using the provided . + + The geometry factory to use. + + + + Gets or sets the level of curve to generate. + The level must be in the range [0 - 16]. + This determines the + number of points in the generated curve. + + + + + + + + The height of an equilateral triangle of side one + + + + + Encodes points as the index along the planar Morton (Z-order) curve. + + The planar Morton (Z-order) curve is a continuous space-filling curve. + The Morton curve defines an ordering of the + points in the positive quadrant of the plane. + The index of a point along the Morton curve is called the Morton code. + + + A sequence of subsets of the Morton curve can be defined by a level number. + Each level subset occupies a square range. + The curve at level n Mₙ contains 2ⁿ⁺¹ points. + It fills the range square of side 2ˡᵉᵛᵉˡ. + Curve points have ordinates in the range [0, 2ˡᵉᵛᵉˡ - 1]. + The code for a given point is identical at all levels. + The level simply determines the number of points in the curve subset + and the size of the range square. + + + This implementation represents codes using 32-bit integers. + This allows levels 0 to 16 to be handled. + The class supports encoding points + and decoding the point for a given code value. + + + The Morton order has the property that it tends to preserve locality. + This means that codes which are near in value will have spatially proximate + points. The converse is not always true - the delta between + codes for nearby points is not always small. But the average delta + is small enough that the Morton order is an effective way of linearizing space + to support range queries. + + + + Martin Davis + + + + + + + The maximum curve level that can be represented. + + + + + The number of points in the curve for the given level. + The number of points is 2²ˡᵉᵛᵉˡ. + + The level of the curve + The number of points. + + + + The maximum ordinate value for points + in the curve for the given level. + The maximum ordinate is 2ˡᵉᵛᵉˡ - 1. + + The level of the curve. + The maximum ordinate value. + + + + The level of the finite Morton curve which contains at least + the given number of points. + + The number of points required. + The level of the curve. + + + + Computes the index of the point (x,y) + in the Morton curve ordering. + + The x ordinate of the point. + The y ordinate of the point. + The index of the point along the Morton curve. + + + + Computes the point on the Morton curve + for a given index. + + The index of the point on the curve. + The point on the curve. + + + + Generates a representing the Morton Curve + at a given level. + + + + + Initializes a new instance of the class + using the provided . + + The geometry factory to use. + + + + Gets or sets the level of curve to generate. + The level must be in the range [0 - 16]. + + + + + + + + Gets or sets the total number of points in the created . + The created geometry will have no more than this number of points, + unless more are needed to create a valid geometry. + + + + + Creates random point sets contained in a + region defined by either a rectangular or a polygonal extent. + + mbdavis + + + + Create a shape factory which will create shapes using the default + . + + + + + Create a shape factory which will create shapes using the given + + + The factory to use + + + + Sets a polygonal mask. + + if the mask is not polygonal + + + + Creates random point sets where the points + are constrained to lie in the cells of a grid. + + mbdavis + + + + Create a builder which will create shapes using the default + . + + + + + Create a builder which will create shapes using the given + . + + The factory to use + + + + Gets or sets whether generated points are constrained to lie + within a circle contained within each grid cell. + This provides greater separation between points + in adjacent cells. + + The default is to not be constrained to a circle. + + + + + Gets or sets the fraction of the grid cell side which will be treated as + a gutter, in which no points will be created. + + The provided value is clamped to the range [0.0, 1.0]. + + + + + Gets the containing the generated point + + A MultiPoint + + + + Simplifies a line (sequence of points) using + the standard Douglas-Peucker algorithm. + + + + + + + + + + + + + Creates an instance of this class using the provided array of coordinates + + An array of coordinates + + + + The distance tolerance for the simplification. + + + + + + + + + + + Simplifies a using the Douglas-Peucker algorithm. + + + Ensures that any polygonal geometries returned are valid. + Simple lines are not guaranteed to remain simple after simplification. + All geometry types are handled. + Empty and point geometries are returned unchanged. + Empty geometry components are deleted. + + Note that in general D-P does not preserve topology - + e.g. polygons can be split, collapse to lines or disappear + holes can be created or disappear, + and lines can cross. + To simplify point while preserving topology use TopologySafeSimplifier. + (However, using D-P is significantly faster). + + KNOWN BUGS: + In some cases the approach used to clean invalid simplified polygons + can distort the output geometry severely. + + + + + + Simplifies a geometry using a given tolerance. + + The geometry to simplify. + The tolerance to use. + A simplified version of the geometry. + + + + Creates a simplifier for a given geometry. + + The geometry to simplify. + + + + The distance tolerance for the simplification. + + + All vertices in the simplified geometry will be within this + distance of the original geometry. + The tolerance value must be non-negative. + + + + + Controls whether simplified polygons will be "fixed" + to have valid topology. + + + The caller may choose to disable this because: + + valid topology is not required + fixing topology is a relative expensive operation + in some pathological cases the topology fixing operation may either fail or run for too long + + The default is to fix polygon topology. + + + + + Gets the simplified geometry. + + The simplified geometry. + + + + The transformer class + + + + + + + + Simplifies a polygon, fixing it if required. + + The geometry to transform + The parent geometry + + + + + Simplifies a LinearRing. If the simplification results in a degenerate ring, remove the component. + + null if the simplification results in a degenerate ring + + + + + + + Creates a valid area point from one that possibly has + bad topology (i.e. self-intersections). + Since buffer can handle invalid topology, but always returns + valid point, constructing a 0-width buffer "corrects" the + topology. + Note this only works for area geometries, since buffer always returns + areas. This also may return empty geometries, if the input + has no actual area.
+ If the input is empty or is not polygonal, + this ensures that POLYGON EMPTY is returned. +
+ An area point possibly containing self-intersections. + A valid area point. +
+ + + An index of LineSegments. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ItemVisitor subclass to reduce volume of query results. + + + + + + + + + + + + + + + + + + + + + + Simplifies a linestring (sequence of points) using the + Visvalingam-Whyatt algorithm. + The Visvalingam-Whyatt algorithm simplifies geometry + by removing vertices while trying to minimize the area changed. + + 1.7 + + + + A LineSegment which is tagged with its location in a Geometry. + Used to index the segments in a point and recover the segment locations + from the index. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Simplifies a collection of TaggedLineStrings, preserving topology + (in the sense that no new intersections are introduced). + This class is essentially just a container for the common + indexes used by . + + + + + Gets or sets the distance tolerance for the simplification.
+ Points closer than this tolerance to a simplified segment may + be removed. +
+
+ + + Simplifies a collection of TaggedLineStrings. + + The collection of lines to simplify. + + + + Represents a which can be modified to a simplified shape. + This class provides an attribute which specifies the minimum allowable length + for the modified result. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Simplifies a TaggedLineString, preserving topology + (in the sense that no new intersections are introduced). + Uses the recursive Douglas-Peucker algorithm. + + + + + Sets the distance tolerance for the simplification. + All vertices in the simplified geometry will be within this + distance of the original geometry. + + + + + Simplifies the given + using the distance tolerance specified. + + The linestring to simplify. + + + + Flattens a section of the line between + indexes and , + replacing them with a line between the endpoints. + The input and output indexes are updated + to reflect this. + + The start index of the flattened section. + The end index of the flattened section. + The new segment created. + + + + Tests whether a segment is in a section of a . + + + + + + + + + Remove the segs in the section of the line. + + + + + + + + Simplifies a point and ensures that + the result is a valid point having the + same dimension and number of components as the input, + and with the components having the same topological + relationship. + + If the input is a polygonal geometry + ( or ): + + The result has the same number of shells and holes as the input, + with the same topological structure + The result rings touch at no more than the number of touching points in the input + (although they may touch at fewer points). + The key implication of this statement is that if the + input is topologically valid, so is the simplified output. + + For linear geometries, if the input does not contain + any intersecting line segments, this property + will be preserved in the output. + + For all geometry types, the result will contain + enough vertices to ensure validity. For polygons + and closed linear geometries, the result will have at + least 4 vertices; for open LineStrings the result + will have at least 2 vertices. + + All geometry types are handled. + Empty and point geometries are returned unchanged. + Empty geometry components are deleted. + + The simplification uses a maximum-distance difference algorithm + similar to the Douglas-Peucker algorithm. + + +

KNOWN BUGS

+ + May create invalid topology if there are components which are small + relative to the tolerance value. + In particular, if a small hole is very near an edge, + it is possible for the edge to be moved by a relatively large tolerance value + and end up with the hole outside the result shell (or inside another hole). + Similarly, it is possible for a small polygon component to end up inside + a nearby larger polygon. + A workaround is to test for this situation in post-processing and remove + any invalid holes or polygons. + +
+ +
+ + + + + + + + + + + Creates an instance of this class for the provided geometry + + The geometry to simplify + + + + Gets or sets the distance tolerance for the simplification.
+ Points closer than this tolerance to a simplified segment may + be removed. +
+
+ + + + + + + + + A LineString transformer + + + + > + + + + A filter to add linear geometries to the LineString map + with the appropriate minimum size constraint. + Closed s (including s + have a minimum output size constraint of 4, + to ensure the output is valid. + For all other LineStrings, the minimum size is 2 points. + + Martin Davis + + + + Filters linear geometries. + + A geometry of any type + + + + Simplifies a linestring (sequence of points) using the + Visvalingam-Whyatt algorithm. + The Visvalingam-Whyatt algorithm simplifies geometry + by removing vertices while trying to minimize the area changed. + + 1.7 + + + + Simplifies a using the Visvalingam-Whyatt area-based algorithm. + Ensures that any polygonal geometries returned are valid. Simple lines are not + guaranteed to remain simple after simplification. All geometry types are + handled. Empty and point geometries are returned unchanged. Empty geometry + components are deleted. + The simplification tolerance is specified as a distance. + This is converted to an area tolerance by squaring it. + + Known Bugs + * Not yet optimized for performance. + * Does not simplify the endpoint of rings. + To Do + * Allow specifying desired number of vertices in the output. + + + + Note that in general this algorithm does not preserve topology - e.g. polygons can be split, + collapse to lines or disappear holes can be created or disappear, and lines + can cross. + + 1.7 + + + + Simplifies a using a given tolerance. + + The to simplify. + The tolerance to use. + A simplified version of the . + + + + Creates a simplifier for a given . + + The to simplify. + + + + Sets the distance tolerance for the simplification. All vertices in the + simplified will be within this distance of the original geometry. + The tolerance value must be non-negative. + + + + + Controls whether simplified polygons will be "fixed" to have valid + topology. The caller may choose to disable this because: + * valid topology is not required. + * fixing topology is a relative expensive operation. + * in some pathological cases the topology fixing operation may either + fail or run for too long. + + The default is to fix polygon topology. + + + + Gets the simplified . + + The simplified . + + + + Simplifies a , fixing it if required. + + + + + + + + Simplifies a . If the simplification results in a degenerate + ring, remove the component. + + + + null if the simplification results in a degenerate ring. + + + + Simplifies a , fixing it if required. + + + + + + + + Creates a valid area geometry from one that possibly has bad topology + (i.e. self-intersections). Since buffer can handle invalid topology, but + always returns valid geometry, constructing a 0-width buffer "corrects" + the topology. Note this only works for area geometries, since buffer + always returns areas. This also may return empty geometries, if the input + has no actual area. + + An area geometry possibly containing self-intersections. + A valid area geometry. + + + + A utility class which creates Conforming Delaunay Triangulations + from collections of points and linear constraints, and extract the resulting + triangulation edges or triangles as geometries. + + Martin Davis + + + + Sets the sites (point or vertices) which will be triangulated. + All vertices of the given geometry will be used as sites. + The site vertices do not have to contain the constraint + vertices as well; any site vertices which are + identical to a constraint vertex will be removed + from the site vertex set. + + The geometry from which the sites will be extracted. + + + + Sets the linear constraints to be conformed to. + All linear components in the input will be used as constraints. + The constraint vertices do not have to be disjoint from + the site vertices. + The constraints must not contain duplicate segments (up to orientation). + + + + + Sets the snapping tolerance which will be used + to improved the robustness of the triangulation computation. + A tolerance of 0.0 specifies that no snapping will take place. + + + + + Gets the QuadEdgeSubdivision which models the computed triangulation. + + The subdivision containing the triangulation + + + + Gets the edges of the computed triangulation as a . + + The geometry factory to use to create the output + the edges of the triangulation + + + + Gets the faces of the computed triangulation as a + of . + + the geometry factory to use to create the output + the faces of the triangulation + + + + Computes a Conforming Delaunay Triangulation over a set of sites and a set of + linear constraints. + + + + A conforming Delaunay triangulation is a true Delaunay triangulation. In it + each constraint segment is present as a union of one or more triangulation + edges. Constraint segments may be subdivided into two or more triangulation + edges by the insertion of additional sites. The additional sites are called + Steiner points, and are necessary to allow the segments to be faithfully + reflected in the triangulation while maintaining the Delaunay property. + Another way of stating this is that in a conforming Delaunay triangulation + every constraint segment will be the union of a subset of the triangulation + edges (up to tolerance). + + + A Conforming Delaunay triangulation is distinct from a Constrained Delaunay triangulation. + A Constrained Delaunay triangulation is not necessarily fully Delaunay, + and it contains the constraint segments exactly as edges of the triangulation. + + + A typical usage pattern for the triangulator is: + + ConformingDelaunayTriangulator cdt = new ConformingDelaunayTriangulator(sites, tolerance); + + // optional + cdt.SplitPointFinder = splitPointFinder; + cdt.VertexFactory = vertexFactory; + + cdt.SetConstraints(segments, new List<Vertex>(vertexMap.Values)); + cdt.FormInitialDelaunay(); + cdt.EnforceConstraints(); + subdiv = cdt.Subdivision; + + + + David Skea + Martin Davis + + + + Creates a Conforming Delaunay Triangulation based on the given + unconstrained initial vertices. The initial vertex set should not contain + any vertices which appear in the constraint set. + + a collection of + the distance tolerance below which points are considered identical + + + + Sets the constraints to be conformed to by the computed triangulation. + The constraints must not contain duplicate segments (up to orientation). + The unique set of vertices (as es) + forming the constraints must also be supplied. + Supplying it explicitly allows the ConstraintVertexes to be initialized + appropriately (e.g. with external data), and avoids re-computing the unique set + if it is already available. + + list of the constraint s + the set of unique es referenced by the segments + + + + Gets or sets the to be + used during constraint enforcement. + Different splitting strategies may be appropriate + for special situations. + + the ConstraintSplitPointFinder to be used + + + + Gets the tolerance value used to construct the triangulation. + + a tolerance value + + + + Gets and sets the used to create new constraint vertices at split points. + + Allows the setting of a custom to be used + to allow vertices carrying extra information to be created. + + + + + Gets the which represents the triangulation. + + + + + Gets the which contains the vertices of the triangulation. + + + + + Gets the sites (vertices) used to initialize the triangulation. + + + + + Gets the s which represent the constraints. + + + + + Gets the convex hull of all the sites in the triangulation, + including constraint vertices. + Only valid after the constraints have been enforced. + + the convex hull of the sites + + + + Creates a vertex on a constraint segment + + the location of the vertex to create + the constraint segment it lies on + the new constraint vertex + + + + Inserts all sites in a collection + + a collection of ConstraintVertex + + + + Inserts a site into the triangulation, maintaining the conformal Delaunay property. + This can be used to further refine the triangulation if required + (e.g. to approximate the medial axis of the constraints, + or to improve the grading of the triangulation). + + the location of the site to insert + + + + Computes the Delaunay triangulation of the initial sites. + + + + + Enforces the supplied constraints into the triangulation. + + + if the constraints cannot be enforced + + + + Given a set of points stored in the kd-tree and a line segment defined by + two points in this set, finds a in the circumcircle of + the line segment, if one exists. This is called the Gabriel point - if none + exists then the segment is said to have the Gabriel condition. Uses the + heuristic of finding the non-Gabriel point closest to the midpoint of the + segment. + + the line segment + + A point which is non-Gabriel, + or null if no point is non-Gabriel + + + + + Indicates a failure during constraint enforcement. + + Martin Davis + 1.0 + + + + Creates a new instance with a given message. + + a string + + + + Creates a new instance with a given message and approximate location. + + a string + the location of the error + + + + Gets the approximate location of this error. + + a location + + + + A vertex in a Constrained Delaunay Triangulation. + The vertex may or may not lie on a constraint. + If it does it may carry extra information about the original constraint. + + Martin Davis + + + + Creates a new constraint vertex + + the location of the vertex + + + + Gets or sets whether this vertex lies on a constraint. + + true if the vertex lies on a constraint + + + + Gets or sets the external constraint object + + object which carries information about the constraint this vertex lies on + + + + Merges the constraint data in the vertex other into this vertex. + This method is called when an inserted vertex is + very close to an existing vertex in the triangulation. + + the constraint vertex to merge + + + + An interface for factories which create a + + Martin Davis + + + + A utility class which creates Delaunay Triangulations + from collections of points and extract the resulting + triangulation edges or triangles as geometries. + + Martin Davis + + + + Extracts the unique s from the given . + + the geometry to extract from + a List of the unique Coordinates + + + + Converts all s in a collection to es. + + the coordinates to convert + a List of Vertex objects + + + + Computes the of a collection of s. + + a List of Coordinates + the envelope of the set of coordinates + + + + Sets the sites (vertices) which will be triangulated. + All vertices of the given geometry will be used as sites. + + the geometry from which the sites will be extracted. + + + + Sets the sites (vertices) which will be triangulated + from a collection of s. + + a collection of Coordinates. + + + + Sets the snapping tolerance which will be used + to improved the robustness of the triangulation computation. + A tolerance of 0.0 specifies that no snapping will take place. + + + + + Gets the which models the computed triangulation. + + the subdivision containing the triangulation + + + + Gets the edges of the computed triangulation as a . + + the geometry factory to use to create the output + the edges of the triangulation + + + + Gets the faces of the computed triangulation as a + of . + + the geometry factory to use to create the output + the faces of the triangulation + + + + An interface for strategies for determining the location of split points on constraint segments. + The location of split points has a large effect on the performance and robustness of enforcing a + constrained Delaunay triangulation. Poorly chosen split points can cause repeated splitting, + especially at narrow constraint angles, since the split point will end up encroaching on the + segment containing the original encroaching point. With detailed knowledge of the geometry of the + constraints, it is sometimes possible to choose better locations for splitting. + + mbdavis + + + + Finds a point at which to split an encroached segment to allow the original segment to appear + as edges in a constrained Delaunay triangulation. + + the encroached segment + the encroaching point + the point at which to split the encroached segment + + + + Computes a Delaunay Triangulation of a set of es, using an + incremental insertion algorithm. + + Martin Davis + 1.0 + + + + Creates a new triangulator using the given . + The triangulator uses the tolerance of the supplied subdivision. + + a subdivision in which to build the TIN + + + + Inserts all sites in a collection. The inserted vertices MUST be + unique up to the provided tolerance value. (i.e. no two vertices should be + closer than the provided tolerance value). They do not have to be rounded + to the tolerance grid, however. + + a Collection of Vertex + if the location algorithm fails to converge in a reasonable number of iterations + + + + Inserts a new point into a subdivision representing a Delaunay + triangulation, and fixes the affected edges so that the result is still a + Delaunay triangulation. + + a quadedge containing the inserted vertex + + + + A simple split point finder which returns the midpoint of the split segment. This is a default + strategy only. Usually a more sophisticated strategy is required to prevent repeated splitting. + Other points which could be used are: +
    +
  • The projection of the encroaching point on the segment
  • +
  • A point on the segment which will produce two segments which will not be further encroached
  • +
  • The point on the segment which is the same distance from an endpoint as the encroaching
  • + point +
+
+ Martin Davis +
+ + + Gets the midpoint of the split segment + + + + + A strategy for finding constraint split points which attempts to maximise the length of the split + segments while preventing further encroachment. (This is not always possible for narrow angles). + + Martin Davis + + + + A basic strategy for finding split points when nothing extra is known about the geometry of + the situation. + + the encroached segment + the encroaching point + the point at which to split the encroached segment + + + + Computes a split point which is the projection of the encroaching point on the segment + + The segment + The enchroaching point + A split point on the segment + + + + Computes the Constrained Delaunay Triangulation of polygons. + The Constrained Delaunay Triangulation of a polygon is a set of triangles + covering the polygon, with the maximum total interior angle over all + possible triangulations. It provides the "best quality" triangulation + of the polygon. + + Holes are supported. + + Martin Davis + + + + Computes the Constrained Delaunay Triangulation of each polygon element in a geometry. + + The input geometry + A GeometryCollection of the computed triangle polygons + + + + Constructs a new Constrained Delaunay triangulator. + + The input geometry + + + + Gets the triangulation as a of triangular s. + + A collection of the result triangle polygons + + + + Gets the triangulation as a list of s. + + The list of Tris in the triangulation + + + + Computes the triangulation of a single polygon + and returns it as a list of s. + + The input polygon + A list of Tris forming the triangulation + + + + Triangulates a polygon using the Ear-Clipping technique. + The polygon is provided as a closed list of contiguous vertices + defining its boundary. + The vertices must have clockwise orientation. + + The polygon boundary must not self-cross, + but may self-touch at points or along an edge. + It may contain repeated points, which are treated as a single vertex. + By default every vertex is triangulated, + including ones which are "flat" (the adjacent segments are collinear). + These can be removed by setting . + + The polygon representation does not allow holes. + Polygons with holes can be triangulated by preparing them with . + + Martin Davis + + + + Triangulates a polygon via ear-clipping. + + The vertices of the polygon + A list of Tris + + + + The polygon vertices are provided in CW orientation. + Thus for convex interior angles + the vertices forming the angle are in CW orientation. + + + + + Indexing vertices improves ear intersection testing performance. + The polyShell vertices are contiguous, so are suitable for an SPRtree. + Note that a KDtree cannot be used because the vertex indices must be stored + and duplicates must be stored. + + + + + Creates a new instance of this class + + The vertices of the polygon to process + + + + Gets or sets whether flat corners formed by collinear adjacent line segments + are included in the triangulation. + Skipping flat corners reduces the number of triangles in the output. + However, it produces a triangulation which does not include + all input vertices. This may be undesirable for downstream processes + (such as computing a Constrained Delaunay Triangulation for + purposes of computing the medial axis). + + The default is to include all vertices in the result triangulation. + This still produces a valid triangulation, with no zero-area triangles. + + Note that repeated vertices are always skipped. + + A flag indicating if flat corners formed by collinear adjacent line segments + are included in the triangulation + + + + Finds a vertex contained in the corner triangle, if any. + Uses the vertex spatial index for efficiency. + + Also finds any vertex which is a duplicate of the corner apex vertex. + This requires a full scan of the vertices to confirm ear is valid. + This is usually a rare situation, so has little impact on performance. + + The index of the corner apex vertex + The corner vertices + The index of an intersecting or duplicate vertex, or if none + + + + Scan all vertices in current ring to check if any are duplicates + of the corner apex vertex, and if so whether the corner ear + intersects the adjacent segments and thus is invalid. + + The index of the corner apex + The corner vertices + true if the corner ia a valid ear + + + + Remove the corner apex vertex and update the candidate corner location. + + + + + Fetch the corner vertices from the indices. + + An array for the corner vertices + + + + Move to next corner. + + + + + Get the index of the next available shell coordinate starting from the given index. + + Coordinate position + Index of the next available shell coordinate + + + + Detects if a corner has repeated points (AAB or ABB), or is collapsed (ABA). + + The corner points + true if the corner is flat or collapsed + + + + Transforms a polygon with holes into a single self-touching (invalid) ring + by connecting holes to the exterior shell or to another hole. + The holes are added from the lowest upwards. + As the resulting shell develops, a hole might be added to what was + originally another hole. + + There is no attempt to optimize the quality of the join lines. + In particular, a hole which already touches at a vertex may be + joined at a different vertex. + + + + + Computes the joined ring. + + The points in the joined ring + + + + Adds a coordinate to the set and + clears the array. + + A coordinate + + + + Joins a single hole to the current shellRing. + + The hole to join + + + + Get the i'th in that the current should add after + + The coordinate of the shell vertex + The coordinate of the hole vertex + The i'th shellvertex + + + + Find the index of the coordinate in ShellCoords ArrayList, + skipping over some number of matches + + + + + + + + Gets a list of shell vertices that could be used to join with the hole. + This list contains only one item if the chosen vertex does not share the same + x value with + + The hole coordinate + A list of candidate join vertices + + + + Determine if a line segment between a hole vertex + and a shell vertex lies inside the input polygon. + + A hole coordinate + A shell coordinate + true if the line lies inside the polygon + + + + Tests whether a line segment crosses the polygon boundary. + + A vertex + A vertex + true if the line segment crosses the polygon boundary + + + + Add hole at proper position in shell coordinate list. + Also adds hole points to ordered coordinates. + + + + + + + + Sort the holes by minimum X, minimum Y. + + Polygon that contains the holes + A list of ordered hole geometry + + + + Gets a list of indices of the leftmost vertices in a ring. + + The hole ring + Index of the left most vertex + + + + Computes a triangulation of each polygon in a {@link Geometry}. + A polygon triangulation is a non-overlapping set of triangles which + cover the polygon and have the same vertices as the polygon. + The priority is on performance rather than triangulation quality, + so that the output may contain many narrow triangles. + + Holes are handled by joining them to the shell to form a + (self-touching) polygon shell with no holes. + Although invalid, this can be triangulated effectively. + + For better-quality triangulation use . + + + Martin Davis + + + + Computes a triangulation of each polygon in a geometry. + + A geometry containing polygons + A GeometryCollection containing the polygons + + + + Constructs a new triangulator. + + The input geometry + + + + Gets the triangulation as a of triangular s. + + A collection of the result triangle polygons + + + + Gets the triangulation as a list of s. + + The list of Tris in the triangulation + + + + Computes the triangulation of a single polygon + + A list of triangular polygons + + + + Improves the quality of a triangulation of s via + iterated Delaunay flipping. + This produces a Constrained Delaunay Triangulation + with the constraints being the boundary of the input triangulation. + + Martin Davis + + + + Improves the quality of a triangulation of {@link Tri}s via + iterated Delaunay flipping. + The Tris are assumed to be linked into a Triangulation + (e.g. via ). + + The list of Tris to improve + + + Improves a triangulation by examining pairs of adjacent triangles + (forming a quadrilateral) and testing if flipping the diagonal of + the quadrilateral would produce two new triangles with larger minimum + interior angles. + + The number of flips that were made + + + + Does a flip of the common edge of two Tris if the Delaunay condition is not met. + + A Tri + The index of the + true if the triangles were flipped + + + + Tests if the quadrilateral formed by two adjacent triangles is convex. + opp0-adj0-adj1 and opp1-adj1-adj0 are the triangle corners + and hence are known to be convex. + The quadrilateral is convex if the other corners opp0-adj0-opp1 + and opp1-adj1-opp0 have the same orientation (since at least one must be convex). + + The adjacent edge vertex 0 + The adjacent edge vertex 1 + The corner vertex of triangle 0 + The corner vertex of triangle 1 + true if the quadrilateral is convex + + + + Tests if either of a pair of adjacent triangles satisfy the Delaunay condition. + The triangles are opp0-adj0-adj1 and opp1-adj1-adj0. + The Delaunay condition is not met if one opposite vertex + lies is in the circumcircle of the other triangle. + + The adjacent edge vertex 0 + The adjacent edge vertex 1 + The corner vertex of triangle 0 + The corner vertex of triangle 1 + true if the triangles are Delaunay + + + + Tests whether a point p is in the circumcircle of a triangle abc + (oriented clockwise). + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point + true if the point is in the circumcircle + + + + A semi-static spatial index for points which occur + in a spatially-coherent sequence. + In particular, this is suitable for indexing the vertices + of a {@link LineString} or {@link Polygon} ring. + + The index is constructed in a batch fashion on a given sequence of coordinates. + Coordinates can be removed via the {@link #remove(int)} method. + + Note that this index queries only the individual points + of the input coordinate sequence, + not any line segments which might be lie between them. + + Martin Davis + + + + Number of items/nodes in a parent node. + Determined empirically. Performance is not too sensitive to this. + + + + + Creates a new tree over the given sequence of coordinates. + The sequence should be spatially coherent to provide query performance. + + A sequence of points + + + + Computes the level offsets. + This is the position in the bounds array of each level. + The levelOffsets array includes a sentinel value of offset[0] = 0. + The top level is always of size 1, + and so also indicates the total number of bounds. + + The level offsets + + + + Queries the index to find all items which intersect an extent. + The query result is a list of the indices of input coordinates + which intersect the extent. + + The query extent + An array of the indices of the input coordinates + + + + Removes the input item at the given index from the spatial index. + + Index the index of the item in the input + + + + A framework to visit sets of edge-connected s in breadth-first order + + Martin Davis + 1.0 + + + + Called to initialize the traversal queue with a given set of s + + a collection of QuadEdgeTriangle + + + + Subclasses call this method to perform the visiting process. + + + + + An interface for classes which locate an edge in a + which either contains a given V + or is an edge of a triangle which contains V. + Implementors may utilized different strategies for + optimizing locating containing edges/triangles. + + Martin Davis + + + + Interface for classes which process triangles visited during traversals of a + + + Martin Davis + + + + Visits a triangle during a traversal of a . An implementation of + this method may perform processing on the current triangle. It must also decide whether a + neighbouring triangle should be added to the queue so its neighbours are visited. Often it + will perform processing on the neighbour triangle as well, in order to mark it as processed + (visited) and/or to determine if it should be visited. Note that choosing not to + visit the neighbouring triangle is the terminating condition for many traversal algorithms. + In particular, if the neighbour triangle has already been visited, it should not be visited + again. + + the current triangle being processed + the index of the edge in the current triangle being traversed + a neighbouring triangle next in line to visit + true if the neighbour triangle should be visited + + + + An interface for algorithms which process the triangles in a . + + Martin Davis + 1.0 + + + + Visits the s of a triangle. + + an array of the 3 quad edges in a triangle (in CCW order) + + + + Locates s in a , + optimizing the search by starting in the + locality of the last edge found. + + Martin Davis + + + + Locates an edge e, such that either v is on e, or e is an edge of a triangle containing v. + The search starts from the last located edge and proceeds on the general direction of v. + + + + + A class that represents the edge data structure which implements the quadedge algebra. + The quadedge algebra was described in a well-known paper by Guibas and Stolfi, + "Primitives for the manipulation of general subdivisions and the computation of Voronoi diagrams", + ACM Transactions on Graphics, 4(2), 1985, 75-123. + + Each edge object is part of a quartet of 4 edges, + linked via their Rot references. + Any edge in the group may be accessed using a series of operations. + Quadedges in a subdivision are linked together via their Next references. + The linkage between the quadedge quartets determines the topology + of the subdivision. + + + The edge class does not contain separate information for vertices or faces; a vertex is implicitly + defined as a ring of edges (created using the Next field). + + + David Skea + Martin Davis + + + + Creates a new QuadEdge quartet from o to d. + + the origin Vertex + the destination Vertex + the new QuadEdge quartet + + + + Creates a new QuadEdge connecting the destination of a to the origin of + b, in such a way that all three have the same left face after the + connection is complete. Additionally, the data pointers of the new edge + are set. + + the connected edge + + + + Splices two edges together or apart. + Splice affects the two edge rings around the origins of a and b, and, independently, the two + edge rings around the left faces of a and b. + In each case, (i) if the two rings are distinct, + Splice will combine them into one, or (ii) if the two are the same ring, Splice will break it + into two separate pieces. Thus, Splice can be used both to attach the two edges together, and + to break them apart. + + an edge to splice + an edge to splice + + + + Turns an edge counterclockwise inside its enclosing quadrilateral. + + the quadedge to turn + + + + Quadedges must be made using {@link makeEdge}, + to ensure proper construction. + + + + + Gets the primary edge of this quadedge and its sym. + The primary edge is the one for which the origin + and destination coordinates are ordered + according to the standard ordering + + the primary quadedge + + + + Gets or sets the external data value for this edge. + + + an object containing external data + + + + + Marks this quadedge as being deleted. + This does not free the memory used by + this quadedge quartet, but indicates + that this edge no longer participates + in a subdivision. + + + + + Tests whether this edge has been deleted. + + true if this edge has not been deleted. + + + + Sets the connected edge + + edge + + + + Gets the dual of this edge, directed from its right to its left. + + Gets or Sets the rotated edge + + + + Gets the dual of this edge, directed from its left to its right. + + Gets the inverse rotated edge. + + + + Gets the edge from the destination to the origin of this edge. + + Gets the sym of the edge. + + + + Gets the next CCW edge around the origin of this edge. + + Gets the next linked edge. + + + + Gets the next CW edge around (from) the origin of this edge. + + Gets the previous edge. + + + + Gets the next CCW edge around (into) the destination of this edge. + + Get the next destination edge. + + + + Gets the next CW edge around (into) the destination of this edge. + + Get the previous destination edge. + + + + Gets the CCW edge around the left face following this edge. + + Gets the next left face edge. + + + + Gets the CCW edge around the left face before this edge. + + Get the previous left face edge. + + + + Gets the edge around the right face ccw following this edge. + + Gets the next right face edge. + + + + Gets the edge around the right face ccw before this edge. + + Gets the previous right face edge. + + + + Gets or sets the vertex for the edge's origin + + Gets the origin vertex + + + + Gets or sets the vertex for the edge's destination + + Gets the destination vertex + + + + Gets the length of the geometry of this quadedge. + + Gets the length of the quadedge + + + + Tests if this quadedge and another have the same line segment geometry, + regardless of orientation. + + a quadedge + true if the quadedges are based on the same line segment regardless of orientation + + + + Tests if this quadedge and another have the same line segment geometry + with the same orientation. + + a quadedge + true if the quadedges are based on the same line segment + + + + Creates a representing the + geometry of this edge. + + a LineSegment + + + + Converts this edge to a WKT two-point LINESTRING indicating + the geometry of this edge. + + a String representing this edge's geometry + + + + A class that contains the s representing a planar + subdivision that models a triangulation. + The subdivision is constructed using the + quadedge algebra defined in the class . + All metric calculations + are done in the class. + In addition to a triangulation, subdivisions + support extraction of Voronoi diagrams. + This is easily accomplished, since the Voronoi diagram is the dual + of the Delaunay triangulation. + + Subdivisions can be provided with a tolerance value. Inserted vertices which + are closer than this value to vertices already in the subdivision will be + ignored. Using a suitable tolerance value can prevent robustness failures + from happening during Delaunay triangulation. + + + Subdivisions maintain a frame triangle around the client-created + edges. The frame is used to provide a bounded "container" for all edges + within a TIN. Normally the frame edges, frame connecting edges, and frame + triangles are not included in client processing. + + + David Skea + Martin Davis + + + + Gets the edges for the triangle to the left of the given . + + + + if the edges do not form a triangle + + + + Creates a new instance of a quad-edge subdivision based on a frame triangle + that encloses a supplied bounding box. A new super-bounding box that + contains the triangle is computed and stored. + + the bounding box to surround + the tolerance value for determining if two sites are equal + + + + Gets the vertex-equality tolerance value + used in this subdivision + + Gets the tolerance value + + + + Gets the envelope of the Subdivision (including the frame). + + Gets the envelope + + + + Gets the collection of base s (one for every pair of + vertices which is connected). + + a collection of QuadEdges + + + + Sets the to use for locating containing triangles + in this subdivision. + + a QuadEdgeLocator + + + + Creates a new quadedge, recording it in the edges list. + + The origin vertex + The destination vertex + A new quadedge + + + + Creates a new QuadEdge connecting the destination of a to the origin of b, + in such a way that all three have the same left face after the connection + is complete. The quadedge is recorded in the edges list. + + A quadedge + A quadedge + A quadedge + + + + Deletes a quadedge from the subdivision. Linked quadedges are updated to + reflect the deletion. + + the quadedge to delete + + + + Locates an edge of a triangle which contains a location + specified by a Vertex v. + The edge returned has the + property that either v is on e, or e is an edge of a triangle containing v. + The search starts from startEdge amd proceeds on the general direction of v. + + + This locate algorithm relies on the subdivision being Delaunay. For + non-Delaunay subdivisions, this may loop for ever. + + the location to search for + an edge of the subdivision to start searching at + a QuadEdge which contains v, or is on the edge of a triangle containing v + + if the location algorithm fails to converge in a reasonable + number of iterations + + + + + Finds a quadedge of a triangle containing a location + specified by a , if one exists. + + the vertex to locate + a quadedge on the edge of a triangle which touches or contains the location
+ or null if no such triangle exists +
+
+ + + Finds a quadedge of a triangle containing a location + specified by a , if one exists. + + the Coordinate to locate + a quadedge on the edge of a triangle which touches or contains the location, + or null if no such triangle exists + + + + + Locates the edge between the given vertices, if it exists in the + subdivision. + + a coordinate + another coordinate + the edge joining the coordinates, if present, + or null if no such edge exists + + + + + Inserts a new site into the Subdivision, connecting it to the vertices of + the containing triangle (or quadrilateral, if the split point falls on an + existing edge). + + + + This method does NOT maintain the Delaunay condition. If desired, this must + be checked and enforced by the caller. + + + This method does NOT check if the inserted vertex falls on an edge. This + must be checked by the caller, since this situation may cause erroneous + triangulation + + + the vertex to insert + a new quad edge terminating in v + + + + Tests whether a QuadEdge is an edge incident on a frame triangle vertex. + + the edge to test + true if the edge is connected to the frame triangle + + + + Tests whether a QuadEdge is an edge on the border of the frame facets and + the internal facets. E.g. an edge which does not itself touch a frame + vertex, but which touches an edge which does. + + the edge to test + true if the edge is on the border of the frame + + + + Tests whether a vertex is a vertex of the outer triangle. + + the vertex to test + true if the vertex is an outer triangle vertex + + + + Tests whether a {@link Coordinate} lies on a {@link QuadEdge}, up to a + tolerance determined by the subdivision tolerance. + + a QuadEdge + a point + true if the vertex lies on the edge + + + + Tests whether a is the start or end vertex of a + , up to the subdivision tolerance distance. + + + + true if the vertex is a endpoint of the edge + + + + Gets the unique es in the subdivision, + including the frame vertices if desired. + + true if the frame vertices should be included + a collection of the subdivision vertices + + + + + Gets a collection of s whose origin + vertices are a unique set which includes + all vertices in the subdivision. + The frame vertices can be included if required. + + + This is useful for algorithms which require traversing the + subdivision starting at all vertices. + Returning a quadedge for each vertex + is more efficient than + the alternative of finding the actual vertices + using and then locating + quadedges attached to them. + + true if the frame vertices should be included + a collection of QuadEdge with the vertices of the subdivision as their origins + + + + Gets all primary quadedges in the subdivision. + A primary edge is a + which occupies the 0'th position in its array of associated quadedges. + These provide the unique geometric edges of the triangulation. + + true if the frame edges are to be included + a List of QuadEdges + + + + A TriangleVisitor which computes and sets the + circumcentre as the origin of the dual + edges originating in each triangle. + + mbdavis + + + + The quadedges forming a single triangle. + Only one visitor is allowed to be active at a + time, so this is safe. + + + + + Stores the edges for a visited triangle. Also pushes sym (neighbour) edges + on stack to visit later. + + + + + + the visited triangle edges,
+ or null if the triangle should not be visited (for instance, if it is outer) +
+
+ + + Gets a list of the triangles + in the subdivision, specified as + an array of the primary quadedges around the triangle. + + true if the frame triangles should be included + a List of QuadEdge[3] arrays + + + + Gets a list of the triangles in the subdivision, + specified as an array of the triangle es. + + true if the frame triangles should be included + a List of Vertex[3] arrays + + + + Gets the coordinates for each triangle in the subdivision as an array. + + true if the frame triangles should be included + a list of Coordinate[4] representing each triangle + + + + Gets the geometry for the edges in the subdivision as a + containing 2-point lines. + + the GeometryFactory to use + a MultiLineString + + + + Gets the geometry for the triangles in a triangulated subdivision as a + of triangular s. + + the GeometryFactory to use + a GeometryCollection of triangular Polygons + + + + Gets the cells in the Voronoi diagram for this triangulation. + The cells are returned as a of s + + + The userData of each polygon is set to be the + of the cell site. This allows easily associating external + data associated with the sites to the cells. + + a geometry factory + a GeometryCollection of Polygons + + + + Gets a List of s for the Voronoi cells + of this triangulation. + + + The UserData of each polygon is set to be the + of the cell site. This allows easily associating external + data associated with the sites to the cells. + + a geometry factory + a List of Polygons + + + + Gets the Voronoi cell around a site specified + by the origin of a QuadEdge. + + + The userData of the polygon is set to be the + of the site. This allows attaching external + data associated with the site to this cell polygon. + + a quadedge originating at the cell site + a factory for building the polygon + a polygon indicating the cell extent + + + + Models a triangle formed from s in a + which forms a triangulation. The class provides methods to access the + topological and geometric properties of the triangle and its neighbours in + the triangulation. Triangle vertices are ordered in CCW orientation in the + structure. + + + QuadEdgeTriangles support having an external data attribute attached to them. + Alternatively, this class can be subclassed and attributes can + be defined in the subclass. Subclasses will need to define + their own BuilderVisitor class + and CreateOn method. + + Martin Davis + 1.0 + + + + Creates s for all facets of a + representing a triangulation. + The data attributes of the s in the subdivision + will be set to point to the triangle which contains that edge. + This allows tracing the neighbour triangles of any given triangle. + + The QuadEdgeSubdivision to create the triangles on. + A List of the created QuadEdgeTriangles + + + + Tests whether the point pt is contained in the triangle defined by 3 es. + + an array containing at least 3 Vertexes + the point to test + true if the point is contained in the triangle + + + + Tests whether the point pt is contained in the triangle defined by 3 es. + + an array containing at least 3 QuadEdges + the point to test + true if the point is contained in the triangle + + + + Creates a new triangle from the given edges. + + An array of the edges of the triangle in CCW order + + + + Gets or sets the external data value for this triangle. + + + + + Gets the vertices for this triangle. + + a new array containing the triangle vertices + + + + Gets the index for the given edge of this triangle + + a QuadEdge + the index of the edge in this triangle,
+ or -1 if the edge is not an edge of this triangle +
+
+ + + Gets the index for the edge that starts at vertex v. + + the vertex to find the edge for + the index of the edge starting at the vertex,
+ or -1 if the vertex is not in the triangle +
+
+ + + + + + Tests whether this triangle is adjacent to the outside of the subdivision. + + true if the triangle is adjacent to the subdivision exterior + + + + Gets the triangles which are adjacent (include) to a + given vertex of this triangle. + + The vertex to query + A list of the vertex-adjacent triangles + + + + Gets the neighbours of this triangle. If there is no neighbour triangle, the array element is + null + + an array containing the 3 neighbours of this triangle + + + + Gets all edges which are incident on the origin of the given edge. + + the edge to start at + a List of edges which have their origin at the origin of the given + edge + + + + Algorithms for computing values and predicates + associated with triangles. + + + For some algorithms extended-precision + implementations are provided, which are more robust + (i.e. they produce correct answers in more cases). + Also, some more robust formulations of + some algorithms are provided, which utilize + normalization to the origin. + + Martin Davis + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + This test uses simple + double-precision arithmetic, and thus is not 100% robust. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + + + This test uses simple + double-precision arithmetic, and thus is not 100% robust. + However, by using normalization to the origin + it provides improved robustness and increased performance. + Based on code by J.R.Shewchuk. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Computes twice the area of the oriented triangle (a, b, c), i.e., the area is positive if the + triangle is oriented counterclockwise. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The area of the triangle defined by the points a, b, c + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + + + This method uses more robust computation. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Tests if a point is inside the circle defined by + the triangle with vertices a, b, c (oriented counter-clockwise). + + + The computation uses arithmetic for robustness, but a faster approach. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + true if this point is inside the circle defined by the points a, b, c + + + + Computes twice the area of the oriented triangle (a, b, c), i.e., the area + is positive if the triangle is oriented counterclockwise. + + + The computation uses {@link DD} arithmetic for robustness. + + a vertex of the triangle + a vertex of the triangle + a vertex of the triangle + The area of a triangle defined by the points a, b and c + + + + + + + + + + + + + + Computes the inCircle test using distance from the circumcentre. + Uses standard double-precision arithmetic. + + + In general this doesn't + appear to be any more robust than the standard calculation. However, there + is at least one case where the test point is far enough from the + circumcircle that this test gives the correct answer. +
+            LINESTRING (1507029.9878 518325.7547, 1507022.1120341457 518332.8225183258,
+            1507029.9833 518325.7458, 1507029.9896965567 518325.744909031)
+            
+
+ A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + The point to test + The area of a triangle defined by the points a, b and c +
+ + + Models a site (node) in a . + The sites can be points on a line string representing a + linear site. + The vertex can be considered as a vector with a norm, length, inner product, cross + product, etc. Additionally, point relations (e.g., is a point to the left of a line, the circle + defined by this point and two others, etc.) are also defined in this class. + + It is common to want to attach user-defined data to + the vertices of a subdivision. + One way to do this is to subclass Vertex + to carry any desired information. + + David Skea + Martin Davis + + + + Creates an instance of this class using the given x- and y-ordinate valuse + + x-ordinate value + y-ordinate value + + + + Creates an instance of this class using the given x-, y- and z-ordinate values + + x-ordinate value + y-ordinate value + z-ordinate value + + + + Creates an instance of this class using a clone of the given . + + The coordinate + + + + Gets the x-ordinate value + + + + + Gets the y-ordinate value + + + + + Gets the z-ordinate value + + + + + Gets the coordinate + + + + + + + + Computes the cross product k = u X v. + + a vertex + returns the magnitude of u X v + + + + Computes the inner or dot product + + A vertex + The dot product u.v + + + + Computes the scalar product c(v) + + A vertex + The scaled vector + + + + Tests if this is inside the circle defined by the points a, b, c. This test uses simple + double-precision arithmetic, and thus may not be robust. + + A vertex of the triangle + A vertex of the triangle + A vertex of the triangle + true if this vertex is inside the circumcircle (a, b, c) + + + + Tests whether the triangle formed by this vertex and two + other vertices is in CCW orientation. + + a vertex + a vertex + true if the triangle is oriented CCW + + + + Computes the value of the ratio of the circumradius to shortest edge. If smaller than some + given tolerance B, the associated triangle is considered skinny. For an equal lateral + triangle this value is 0.57735. The ratio is related to the minimum triangle angle theta by: + circumRadius/shortestEdge = 1/(2sin(theta)). + + second vertex of the triangle + third vertex of the triangle + ratio of circumradius to shortest edge. + + + + returns a new vertex that is mid-way between this vertex and another end point. + + the other end point. + the point mid-way between this and that. + + + + Computes the centre of the circumcircle of this vertex and two others. + + + + the Coordinate which is the circumcircle of the 3 points. + + + + For this vertex enclosed in a triangle defined by three vertices v0, v1 and v2, interpolate + a z value from the surrounding vertices. + + + + + Interpolates the Z-value (height) of a point enclosed in a triangle + whose vertices all have Z values. + The containing triangle must not be degenerate + (in other words, the three vertices must enclose a + non-zero area). + + The point to interpolate the Z value of + A vertex of a triangle containing the + A vertex of a triangle containing the + A vertex of a triangle containing the + The interpolated Z-value (height) of the point + + + + Computes the interpolated Z-value for a point p lying on the segment p0-p1 + + The point to interpolate the Z value of + A vertex of the segment is lying on + A vertex of the segment is lying on + The interpolated Z-value (height) of the point + + + + Models a constraint segment in a triangulation. + A constraint segment is an oriented straight line segment between a start point + and an end point. + + David Skea + Martin Davis + + + + + Creates a new instance for the given ordinates. + + + + + Creates a new instance for the given ordinates, with associated external data. + + + + + Creates a new instance for the given points, with associated external data. + + the start point + the end point + an external data object + + + + Creates a new instance for the given points. + + the start point + the end point + + + + Gets the start coordinate of the segment + + a Coordinate + + + + Gets the end coordinate of the segment + + a Coordinate + + + + Gets the start X ordinate of the segment + + the X ordinate value + + + + Gets the start Y ordinate of the segment + + the Y ordinate value + + + + Gets the start Z ordinate of the segment + + the Z ordinate value + + + + Gets the end X ordinate of the segment + + the X ordinate value + + + + Gets the end Y ordinate of the segment + + he Y ordinate value + + + + Gets the end Z ordinate of the segment + + the Z ordinate value + + + + Gets a LineSegment modelling this segment. + + a LineSegment + + + + Gets or sets the external data associated with this segment + + a data object + + + + Determines whether two segments are topologically equal. + I.e. equal up to orientation. + + a segment + true if the segments are topologically equal + + + + Computes the intersection point between this segment and another one. + + a segment + the intersection point, or null if there is none + + + + Computes a string representation of this segment. + + a string + + + + Models a constraint segment which can be split in two in various ways, + according to certain geometric constraints. + + Martin Davis + + + + Computes the {@link Coordinate} that lies a given fraction along the line defined by the + reverse of the given segment. A fraction of 0.0 returns the end point of the + segment; a fraction of 1.0 returns the start point of the segment. + + the LineSegment + the fraction of the segment length along the line + the point at that distance + + + + A memory-efficient representation of a triangle in a triangulation. + Contains three vertices, and links to adjacent Tris for each edge. + Tris are constructed independently, and if needed linked + into a triangulation using . + + An edge of a Tri in a triangulation is called a boundary edge + if it has no adjacent triangle.
+ The set of Tris containing boundary edges are called the triangulation border. +
+ Martin Davis +
+ + + Creates a of s + representing the triangles in a list. + + A list of Tris + The GeometryFactory to use + The Polygons for the triangles + + + + Computes the area of a set of Tris. + + A set of tris + The total area of the triangles + + + + Validates a list of Tris. + + The list of Tris to validate + + + + Creates a triangle with the given vertices. + The vertices should be oriented clockwise. + + The first triangle vertex + The second triangle vertex + The third triangle vertex + The created trianlge + + + + Creates a triangle from an array with three vertex coordinates. + The vertices should be oriented clockwise. + + The array of vertex coordinates + The created triangle + + + + Creates a triangle with the given vertices. + The vertices should be oriented clockwise. + + The first triangle vertex + The second triangle vertex + The third triangle vertex + + + + Sets the adjacent triangles.
+ The vertices of the adjacent triangles are + assumed to match the appropriate vertices in this triangle. +
+ The triangle adjacent to edge 0 + The triangle adjacent to edge 1 + The triangle adjacent to edge 2 +
+ + + Sets the triangle adjacent to the edge originating + at a given vertex.
+ The vertices of the adjacent triangles are + assumed to match the appropriate vertices in this triangle. +
+ The edge start point + The adjacent triangle +
+ + + Sets the triangle adjacent to an edge.
+ The vertices of the adjacent triangle are + assumed to match the appropriate vertices in this triangle. +
+ The edge triangle is adjacent to + The adjacent triangle +
+ + + Splits a triangle by a point located inside the triangle. + Creates the three new resulting triangles with adjacent links + set correctly. + Returns the new triangle whose 0'th vertex is the splitting point. + + The point to insert + The new triangle whose 0'th vertex is + + + + Interchanges the vertices of this triangle and a neighbor + so that their common edge + becomes the the other diagonal of the quadrilateral they form. + Neighbour triangle links are modified accordingly. + + The index of the adjacent tri to flip with + + + + Replaces an adjacent triangle with a different one. + + An adjacent triangle + The triangle to replace with + + + + Computes the degree of a Tri vertex, which is the number of tris containing it. + This must be done by searching the entire triangulation, + since the containing tris may not be adjacent or edge-connected. + + The vertex index + The triangulation + The degree of the vertex + + + + Removes this tri from the triangulation containing it. + All links between the tri and adjacent ones are nulled. + + The triangulation + + + + Removes this triangle from a triangulation. + All adjacent references and the references to this + Tri in the adjacent Tris are set to null. + + + + + Gets the triangles adjacent to the quadrilateral + formed by this triangle and an adjacent one. + The triangles are returned in the following order: + + Order: + + opp0-adj0 edge + opp0-adj1 edge + opp1-adj0 edge + opp1-adj1 edge + + + An adjacent triangle + The index of the common edge in this triangle + The index of the common edge in the adjacent triangle + + + + + Validates that a is correct. + Currently just checks that orientation is CW. + + Thrown if is not valid + + + + Validates that the vertices of an adjacent linked triangle are correct. + + The index of the adjacent triangle + + + + Gets the coordinate for a vertex. + This is the start vertex of the edge. + + The vertex (edge) index + The vertex coordinate + + + + Gets the index of the triangle vertex which has a given coordinate (if any). + This is also the index of the edge which originates at the vertex. + + The coordinate to find + The vertex index, or -1 if it is not in the triangle + + + + Gets the edge index which a triangle is adjacent to (if any), + based on the adjacent triangle link. + + The Tri to find + The index of the edge adjacent to the triangle, or -1 if not found + + + + Gets the triangle adjacent to an edge. + + The edge index + The adjacent triangle (may be null) + + + + Tests if this tri has any adjacent tris. + + true if there is at least one adjacent tri + + + + Tests if there is an adjacent triangle to an edge. + + The edge index + true if there is a triangle adjacent to edge + + + + Tests if a triangle is adjacent to some edge of this triangle. + + The triangle to test + true if the triangle is adjacent + + + + + Computes the number of triangle adjacent to this triangle. + This is a number in the range [0,2]. + The number of adjacent triangles + + + + Tests if a tri vertex is interior. + A vertex of a triangle is interior if it + is fully surrounded by other triangles. + + The vertex index + true if the vertex is interior + + + + Tests if a tri contains a boundary edge, + and thus on the border of the triangulation containing it. + + true if the tri is on the border of the triangulation + + + + Tests if an edge is on the boundary of a triangulation. + + The index of an edge + true if the edge is on the boundary + + + + Computes the vertex or edge index which is the next one + (counter-clockwise) around the triangle. + + The index + The next index value + + + + Computes the vertex or edge index which is the previous one + (counter-clockwise) around the triangle. + + The index + The previous index value + + + + Gets the index of the vertex opposite an edge. + + The edge index + The index of the opposite vertex + + + + Gets the index of the edge opposite a vertex. + + The index of the vertex + The index of the opposite edge + + + + Computes a coordinate for the midpoint of a triangle edge. + + The edge index + the midpoint of the triangle edge + + + Gets the area of the triangle. + The area of the triangle + + + + Gets the length of the perimeter of the triangle. + + + + + Creates a representing this triangle. + + The geometry factory + A polygon + + + + + + + Builds a triangulation from a set of s + by populating the links to adjacent triangles. + + Martin Davis + + + + Computes the triangulation of a set of s. + + An enumeration of s + + + + Creates an instance of this class and computes the triangulation of a set of s. + + An enumeration of s + + + + Represents an edge in a , + to be used as a key for looking up Tris + while building a triangulation. + The edge value is normalized to allow lookup + of adjacent triangles. + + Martin Davis + + + + Gets or sets a value indicating the start point of this + + + + + Gets or sets a value indicating the end point of this + + + + + Creates an instance of this class + + A coordinate + A coordinate + + + + Creates a map between the vertex s of a + set of s, + and the parent geometry, and transfers the source geometry + data objects to geometry components tagged with the coordinates. + + + This class can be used in conjunction with + to transfer data objects from the input site geometries + to the constructed Voronoi polygons. + + Martin Davis + + + + + Loads the vertices of a geometry and maps them with th the . + + A geometry + + + + Loads the vertices of a collection of geometries and maps them with the . + + A collection of geometry + + + + Loads the vertices of the geometries of a GeometryCollection and maps them with the . + + A GeometryCollection + + + + Gets a value indicating the coordinates. + + A list of Coordinates. + + + + Input is assumed to be a multiGeometry + in which every component has its userData + set to be a Coordinate which is the key to the output data. + The Coordinate is used to determine + the output data object to be written back into the component. + + + + + + A utility class which creates Voronoi Diagrams + from collections of points. + The diagram is returned as a of s, + representing the faces of the Voronoi diagram. + /// The faces are clipped to the larger of: + + + an envelope supplied by . + + + an envelope determined by the input sites. + + + The userData attribute of each face Polygon is set to + the Coordinate of the corresponding input site. + This allows using a Map to link faces to data associated with sites. + + Martin Davis + + + + Sets the sites (point or vertices) which will be diagrammed. + All vertices of the given geometry will be used as sites. + + geom the geometry from which the sites will be extracted. + + + + Sets the sites (point or vertices) which will be diagrammed + from a collection of s. + + a collection of Coordinates. + + + + Sets the envelope to clip the diagram to. + The diagram will be clipped to the larger + of this envelope or an envelope surrounding the sites. + + the clip envelope. + + + + Sets the snapping tolerance which will be used + to improved the robustness of the triangulation computation. + A tolerance of 0.0 specifies that no snapping will take place. + + tolerance the tolerance distance to use + + + + Gets the which models the computed diagram. + + the subdivision containing the triangulation + + + + Gets the faces of the computed diagram as a + of s, clipped as specified. + + The attribute of each face is set to + the Coordinate of the corresponding input site. + This allows using a to link faces to data associated with sites. + + the geometry factory to use to create the output + a containing the face s of the diagram + + + + An alternative implementation of the priority queue abstract data type. + This allows us to do more than , which we + got from JTS. Ultimately, this queue enables scenarios that have more + favorable execution speed characteristics at the cost of less favorable + memory and usability characteristics. + + + The type of the priority for each queue node. + + + The type of data stored in the queue. + + + When enumerating over the queue, note that the elements will not be in + sorted order. To get at the elements in sorted order, use the copy + constructor and repeatedly elements from it. + + + + + Initializes a new instance of the + class. + + + + + Initializes a new instance of the + class. + + + The initial queue capacity. + + + is less than 1. + + + + + Initializes a new instance of the + class. + + + The to use to compare priority values, + or to use the default comparer for the type. + + + + + Initializes a new instance of the + class. + + + The initial queue capacity. + + + The to use to compare priority values, + or to use the default comparer for the type. + + + is less than 1. + + + + + Initializes a new instance of the + class. + + + The to + copy from. + + + is . + + + + + Gets the number of nodes currently stored in this queue. + + + + + Gets the node at the head of the queue. + This is the node whose compares + less than or equal to the priority of all other nodes in the queue. + + + + + Removes all nodes from this queue. + + + + + Determines whether the given node is contained within this queue. + + + The node to locate in the queue. + + + if is found in the + queue, otherwise . + + + + + Adds a given node to the queue with the given priority. + + + The node to add to the queue. + + + The priority for the node. + + + is . + + + + + Removes and returns the head of the queue. + + + The removed element. + + + + + Changes the priority of the given node. + + + The node whose priority to change. + + + The new priority for the node. + + + is . + + + + + Removes the given node from this queue if it is present. + + + The node to remove if present. + + + A value indicating whether the node was removed. + + + + + + + + + + + A utility for making programming assertions. + + + + + Tests if is true + + If the test fails, with no message is thrown. + + The assertion value + + + + Tests if is true + + If the test fails, with is thrown. + + The assertion value + A message describing the failure condition. + + + + Tests if two values are equal. + + If the test fails, with no specific message is thrown. + + The expected value + The actual value + + + + Tests if two values are equal. + + If the test fails, with is thrown. + + The expected value + The actual value + A message describing the failure condition. + + + + Throws an with no specific message text. + + + + + Throws an with as specific message text. + + A text describing the failure condition + + + + + + + + + + + + + + + + + + + + A CoordinateFilter that creates an array containing every coordinate in a Geometry. + + + + + Constructs a CoordinateArrayFilter. + + The number of points that the CoordinateArrayFilter will collect. + + + + Returns the Coordinates collected by this CoordinateArrayFilter. + + + + + + + + + + + CoordinateCompare is used in the sorting of arrays of Coordinate objects. + Implements a lexicographic comparison. + + + + + Compares two object and returns a value indicating whether one is less than, equal to or greater + than the other. + + First Coordinate object to compare. + Second Coordinate object to compare. + + <table cellspacing="0" class="dtTABLE"> + <TR VALIGN="top"> + <TH width=50%>Value</TH> + <TH width=50%>Condition</TH> + </TR> + <TR VALIGN="top"> + <TD width=50%>Less than zero</TD> + <TD width=50%><I>a</I> is less than <I>b</I>.</TD> + </TR> + <TR VALIGN="top"> + <TD width=50%>Zero</TD> + <TD width=50%><I>a</I> equals <I>b</I>.</TD> + </TR> + <TR VALIGN="top"> + <TD width=50%>Greater than zero</TD> + <TD width=50%><I>a</I> is greater than <I>b</I>.</TD> + </TR> + </table> + + If a implements IComparable, then a. CompareTo (b) is returned; otherwise, if b + implements IComparable, then b. CompareTo (a) is returned. + Comparing a null reference (Nothing in Visual Basic) with any type is allowed and does not + generate an exception when using IComparable. When sorting, a null reference (Nothing) is + considered to be less than any other object. + + + + + A CoordinateFilter that counts the total number of coordinates + in a Geometry. + + + + + Returns the result of the filtering. + + + + + + + + + + + Converts degrees to radians. + + + + + Converts degrees to radians. + + The angle in degrees. + The angle in radians. + + + + A utility class to get s, s + off of s or to build aggregate geometries. + + + + + Gets a default envelope + + + + + Gets the envelope of a geometry. + + A geometry + The envelope of or if g == null. + + + + Function to get the geometry factory of a geometry. If + is null, a default geometry + factory is returned. + + A geometry + A geometry factory + + + + Function to get the geometry factory of the first + geometry in a series of geometries. + If no geometry is provided in , + a default geometry factory is returned. + + An enumeration of geometries + A geometry factory + + + + Builds a geometry from a list of geometries. + + The function returns + + nullif the list is null or empty + [0]if the list contains one single item. + a if is a GeometryCollection. + a Multi-geometry in all other cases. + + + A list of geometries. + A parent geometry + A geometry. + + + + Builds a geometry from a list of geometries. + + The function returns + + nullif the list is null or empty + [0]if the list contains one single item. + a if is a GeometryCollection. + a Multi-geometry in all other cases. + + + A list of geometries. + A parent geometry + A geometry. + + + + Method to build a geometry. + + An array of geometries + A GEOMETRYCOLLECTION containing . + + + + Method to build a geometry. + + A geometry + A geometry + A GEOMETRYCOLLECTION containing and . + + + + Computes various kinds of common geometric shapes. + Allows various ways of specifying the location and extent of the shapes, + as well as number of line segments used to form them. + + + + + A geometry factory + + + + + A precision model + + + + + + Create a shape factory which will create shapes using the default GeometryFactory. + + + + + Create a shape factory which will create shapes using the given GeometryFactory. + + The factory to use. + + + + Gets/Sets the location of the shape by specifying the base coordinate + (which in most cases is the + lower left point of the envelope containing the shape). + + + + + Gets/Sets the location of the shape by specifying the centre of + the shape's bounding box. + + + + + Gets or sets the envelope of the shape + + + + + Gets/Sets the total number of points in the created Geometry. + + + + + Gets/Sets the size of the extent of the shape in both x and y directions. + + + + + Gets/Sets the width of the shape. + + + + + Gets/Sets the height of the shape. + + + + + Gets/Sets the rotation angle, in radians, to use for the shape. + The rotation is applied relative to the centre of the shape. + + + + + Rotates a geometry by angle + + The geometry to rotate + A rotated geometry + + + + Creates a coordinate at (, ) + + The x-ordinate value + The y-ordinate value + A coordinate + + + + Creates a translated coordinate at ( + , + ) + + The x-ordinate value + The y-ordinate value + A translation vector (coordinate) + A coordinate + + + + Creates a rectangular Polygon. + + A rectangular polygon. + + + + Creates a circular Polygon. + + A circular polygon. + + + + Creates an elliptical Polygon. + If the supplied envelope is square the + result will be a circle. + + An an ellipse or circle. + + + + Creates a squircular . + + a squircle + + + + Creates a supercircular + of a given positive power. + + a supercircle + + + + Creates a elliptical arc, as a LineString. + + The arc is always created in a counter-clockwise direction. + + Start angle in radians + Size of angle in radians + + + + + Creates an elliptical arc polygon. + + + The polygon is formed from the specified arc of an ellipse + and the two radii connecting the endpoints to the centre of the ellipse. + + Start angle in radians + Size of angle in radians + An elliptical arc polygon + + + + A dimension class for s + + + + + Gets or sets a value indicating the base of the shapes to be created + + + + + Gets or sets a value indicating the centre of the shapes to be created + + + + + Gets or sets a value indicating the width of the . + + + + + Gets or sets a value indicating the height of the . + + + + + Sets and to the same value + + + + + Gets a value indicating the minimum size of the shape's + + + + + Gets or sets a value indicating the bounds of the shape to be created + + + + + + + + + + + + + + + + + + + + + + + + + + A guard class + + + + + Checks if a value is not null. + + The value to check for null + The name of the property that belongs to. + + + + + + + + + Only static methods! + + + + + Convert the given numeric value (passed as string) of the base specified by baseIn + to the value specified by baseOut. + + Numeric value to be converted, as string. + Base of input value. + Base to use for conversion. + Converted value, as string. + + + + Utility functions to report memory usage. + + mbdavis + + + + Gets a value indicating the total memory used. + + + + + Gets a string describing the total memory used + + + + + Number of bytes in a kilo-byte + + + + + Number of bytes in mega-byte + + + + + Number of bytes in a giga-byte + + + + + Formats a number of bytes + + The number of bytes + A string describing a number of bytes + + + + Rounds a double to 2 decimal places + + The number to round + The rounded number + + + + A priority queue over a set of objects. + + Objects to add + Martin Davis + + + + Creates an instance of this class + + + + + Creates an instance of this class + + The capacity of the queue + The comparer to use for computing priority values + + + Insert into the priority queue. Duplicates are allowed. + + The item to insert. + + + + Test if the priority queue is logically empty. + + true if empty, false otherwise. + + + + Returns size. + + + + + Make the priority queue logically empty. + + + + + Remove the smallest item from the priority queue. + + The smallest item, or default(T) if empty. + + + + Gets the smallest item without removing it from the queue + + + + + > + + + + A container for a prioritized node that sites in an + . + + + The type to use for the priority of the node in the queue. + + + The type to use for the data stored by the node in the queue. + + + + + Initializes a new instance of the class. + + + The to store in this node. + + + + + Gets the that is stored in this node. + + + + + Gets the of this node in the queue. + + + The queue may update this priority while the node is still in the queue. + + + + + Gets or sets the index of this node in the queue. + + + This should only be read and written by the queue itself. + It has no "real" meaning to anyone else. + + + + + Converts radians to degress. + + + + + Converts radians to degress. + + Angle in radians. + The angle in degrees. + + + + + + + + + + + + + + + + + A + that extracts a unique array ofCoordinate s. + The array of coordinates contains no duplicate points. + + It preserves the order of the input points. + + + + + Convenience method which allows running the filter over an array of s. + + an array of coordinates + an array of the unique coordinates + + + + Returns the gathered s. + + The Coordinates collected by this ICoordinateArrayFilter + + + + + + + Buffer for characters. This approximates StringBuilder + but is designed to be faster for specific operations. + This is about 30% faster for the operations I'm interested in + (Append, Clear, Length, ToString). + This trades off memory for speed. + + + To make Remove from the head fast, this is implemented + as a ring buffer. + This uses head and tail indices into a fixed-size + array. This will grow the array as necessary. + + + + + Gets/Sets the number of characters in the character buffer. + Increasing the length this way provides indeterminate results. + + + + + Returns the capacity of this character buffer. + + + + + Default constructor. + + + + + Construct with a specific capacity. + + + + + + Reallocate the buffer to be larger. For the new size, this + uses the max of the requested length and double the current + capacity. + This does not shift, meaning it does not change the head or + tail indices. + + The new requested length. + + + + Ensure that we're set for the requested length by + potentially growing or shifting contents. + + + + + + Move the buffer contents such that headIndex becomes 0. + + + + + Overwrite this object's underlying buffer with the specified + buffer. + + The character array. + The number of characters to consider filled + in the input buffer. + + + + Append a character to this buffer. + + + + + + Append a string to this buffer. + + The string to append. + + + + Append a string to this buffer. + + The string to append. + + + + Remove a character at the specified index. + + The index of the character to remove. + + + + + Remove a specified number of characters at the specified index. + + The index of the characters to remove. + The number of characters to remove. + + + + Find the first instance of a character in the buffer, and + return its index. This returns -1 if the character is + not found. + + The character to find. + The index of the specified character, or -1 + for not found. + + + + Empty the buffer. + + + + + Indexer. + + + + + Return the current contents as a string. + + The new string. + + + + Exception class for unterminated tokens. + + + + + Construct with a particular message. + + The message to store in this object. + + + + Exception class for unterminated quotes. + + + + + Construct with a particular message. + + The message to store in this object. + + + + Exception class for unterminated block comments. + + + + + Construct with a particular message. + + The message to store in this object. + + + + Bitwise enumeration for character types. + + + + word characters (usually alpha, digits, and domain specific) + + + # or something for line comments + + + whitespace + + + ' or " type + + + usually 0 to 9 + + + usually 0 to 9, a-f and A-F + + + eof char + + + + This contains the settings that control the behavior of the tokenizer. + This is separated from the StreamTokenizer so that common settings + are easy to package and keep together. + + + + + This is the character type table. Each byte is bitwise encoded + with the character attributes, such as whether that character is + word or whitespace. + + + + + Whether or not to return whitespace tokens. If not, they're ignored. + + + + + Whether or not to return EolTokens on end of line. Eol tokens will not + break up other tokens which can be multi-line. For example block comments + and quotes will not be broken by Eol tokens. Therefore the number of + Eol tokens does not give you the line count of a stream. + + + + + Whether or not to look for // comments + + + + + Whether or not to look for /* */ block comments. + + + + + Whether or not to return comments. + + + + + Whether or not to check for unterminated quotes and block comments. + If true, and one is encoutered, an exception is thrown of the appropriate type. + + + + + Whether or not digits are specified as Digit type in the + character table. + This setting is based on the character types table, so this + setting interacts with character type table manipulation. + This setting may become incorrect if you modify the character + types table directly. + + + + + Whether or not to parse Hex (0xABCD...) numbers. + This setting is based on the character types table, so this + setting interacts with character type table manipulation. + + + + + Default constructor. + + + + + Copy constructor. + + + + + Sets this object to be the same as the specified object. + Note that some settings which are entirely embodied by the character + type table. + + + + + Setup default parse behavior. + This resets to same behavior as on construction. + + bool - true for success. + + + + Apply settings which are commonly used for code parsing + C-endCapStyle code, including C++, C#, and Java. + + + + + + Clear the character type settings. This leaves them unset, + as opposed to the default. Use SetDefaults() for default + settings. + + + + + Specify that a particular character is a word character. + Character table type manipulation method. + This adds the type to the char(s), rather + than overwriting other types. + + The character. + + + + Specify that a range of characters are word characters. + Character table type manipulation method. + This adds the type to the char(s), rather + than overwriting other types. + + First character. + Last character. + + + + Specify that a string of characters are word characters. + Character table type manipulation method. + This adds the type to the char(s), rather + than overwriting other types. + + + + + + Specify that a character is a whitespace character. + Character table type manipulation method. + This type is exclusive with other types. + + The character. + + + + Specify that a range of characters are whitespace characters. + Character table type manipulation method. + This adds the characteristic to the char(s), rather + than overwriting other characteristics. + + First character. + Last character. + + + + Remove other type settings from a range of characters. + Character table type manipulation method. + + + + + + + Remove other type settings from a character. + Character table type manipulation method. + + + + + + Specify that a particular character is a comment-starting character. + Character table type manipulation method. + + + + + + Specify that a particular character is a quote character. + Character table type manipulation method. + + + + + + Return a string representation of a character type setting. + Since the type setting is bitwise encoded, a character + can have more than one type. + + The character type byte. + The string representation of the type flags. + + + + Check whether the specified char type byte has a + particular type flag set. + + The char type byte. + The CharTypeBits entry to compare to. + bool - true or false + + + + Check whether the specified char has a + particular type flag set. + + The character. + The CharTypeBits entry to compare to. + bool - true or false + + + + Check whether the specified char has a + particular type flag set. + + The character. + The CharTypeBits entry to compare to. + bool - true or false + + + + Display the state of this object. + + + + + Display the state of this object, with a per-line prefix. + + The pre-line prefix. + + + + A StreamTokenizer similar to Java's. This breaks an input stream + (coming from a TextReader) into Tokens based on various settings. The settings + are stored in the TokenizerSettings property, which is a + StreamTokenizerSettings instance. + + + + This is configurable in that you can modify TokenizerSettings.CharTypes[] array + to specify which characters are which type, along with other settings + such as whether to look for comments or not. + + + WARNING: This is not internationalized. This treats all characters beyond + the 7-bit ASCII range (decimal 127) as Word characters. + + + There are two main ways to use this: 1) Parse the entire stream at + once and get an ArrayList of Tokens (see the Tokenize* methods), + and 2) call NextToken() successively. + This reads from a TextReader, which you can set directly, and this + also provides some convenient methods to parse files and strings. + This returns an Eof token if the end of the input is reached. + + + Here's an example of the NextToken() endCapStyle of use: + + StreamTokenizer tokenizer = new StreamTokenizer(); + tokenizer.GrabWhitespace = true; + tokenizer.Verbosity = VerbosityLevel.Debug; // just for debugging + tokenizer.TextReader = File.OpenText(fileName); + Token token; + while (tokenizer.NextToken(out token)) log.Info("Token = '{0}'", token); + + + + Here's an example of the Tokenize... endCapStyle of use: + + StreamTokenizer tokenizer = new StreamTokenizer("some string"); + ArrayList tokens = new ArrayList(); + if (!tokenizer.Tokenize(tokens)) + { + // error handling + } + foreach (Token t in tokens) Console.WriteLine("t = {0}", t); + + + + Comment delimiters are hardcoded (// and /*), not affected by char type table. + + + This sets line numbers in the tokens it produces. These numbers are normally + the line on which the token starts. + There is one known caveat, and that is that when GrabWhitespace setting + is true, and a whitespace token contains a newline, that token's line number + will be set to the following line rather than the line on which the token + started. + + + + + + This is the number of characters in the character table. + + + + + This is the TextReader that this object will read from. + Set this to set the input reader for the parse. + + + + + The settings which govern the behavior of the tokenization. + + + + + Default constructor. + + + + + Construct and set this object's TextReader to the one specified. + + The TextReader to read from. + + + + Construct and set this object's TextReader to the one specified. + + The TextReader to read from. + Tokenizer settings. + + + + Construct and set a string to tokenize. + + The string to tokenize. + + + + Utility function, things common to constructors. + + + + + Clear the stream settings. + + + + + Display the state of this object. + + + + + Display the state of this object, with a per-line prefix. + + The pre-line prefix. + + + + The states of the state machine. + + + + + Pick the next state given just a single character. This is used + at the start of a new token. + + The type of the character. + The character. + The state. + + + + Pick the next state given just a single character. This is used + at the start of a new token. + + The type of the character. + The character. + Exclude this state from the possible next state. + The state. + + + + Read the next character from the stream, or from backString + if we backed up. + + The next character. + + + + Get the next token. The last token will be an EofToken unless + there's an unterminated quote or unterminated block comment + and Settings.DoUntermCheck is true, in which case this throws + an exception of type StreamTokenizerUntermException or sub-class. + + The output token. + bool - true for success, false for failure. + + + + Starting from current stream location, scan forward + over an int. Determine whether it's an integer or not. If so, + push the integer characters to the specified CharBuffer. + If not, put them in backString (essentially leave the + stream as it was) and return false. + + If it was an int, the stream is left 1 character after the + end of the int, and that character is output in the thisChar parameter. + + The formats for integers are: 1, +1, and -1 + The + and - signs are included in the output buffer. + + The CharBuffer to append to. + Whether or not to consider + to be part + of an integer. + The last character read by this method. + true for parsed an int, false for not an int + + + + Parse the rest of the stream and put all the tokens + in the input ArrayList. This resets the line number to 1. + + The ArrayList to append to. + bool - true for success + + + + Parse all tokens from the specified TextReader, put + them into the input ArrayList. + + The TextReader to read from. + The ArrayList to append to. + bool - true for success, false for failure. + + + + Parse all tokens from the specified file, put + them into the input ArrayList. + + The file to read. + The ArrayList to put tokens in. + bool - true for success, false for failure. + + + + Tokenize a file completely and return the tokens in a Token[]. + + The file to tokenize. + A Token[] with all tokens. + + + + Parse all tokens from the specified string, put + them into the input ArrayList. + + + The ArrayList to put tokens in. + bool - true for success, false for failure. + + + + Parse all tokens from the specified Stream, put + them into the input ArrayList. + + + The ArrayList to put tokens in. + bool - true for success, false for failure. + + + + Gibt einen Enumerator zurück, der die Auflistung durchläuft. + + + Ein , der zum Durchlaufen der Auflistung verwendet werden kann. + + 1 + + + + Gibt einen Enumerator zurück, der eine Auflistung durchläuft. + + + Ein -Objekt, das zum Durchlaufen der Auflistung verwendet werden kann. + + 2 + + + + Token class used by StreamTokenizer. + This represents a single token in the input stream. + This is subclassed to provide specific token types, + such as CharToken, FloatToken, etc. + + + + + The line number in the input stream where this token originated. + This is base-1. + + + + + The line number where this token was found. This is base-1. + + + + + A storage object for the data of this token. + + + + + The Object stored by this token. This will be + a primitive C# type. + + + + + Backer for UntermError. + + + + + Whether or not there was an unterminated token problem + when creating this token. See UntermErrorMessage for + a message associated with the problem. + + + + An error message associated with unterm error. + + + + The error message if there was an unterminated token error + creating this token. + + + + + Construct a Token with the specified line number. + + The line number where this + token comes from. + + + + Equals override. + + The object to compare to. + bool - true for equals, false otherwise. + + + + Equals overload. + + The string to compare to. + bool + + + + Equals overload. + + The char to compare to. + bool + + + + Operator== overload. Compare a token and an object. + + The token to compare. + The other object. + bool + + + + Operator!= overload. Compare a token and an object. + + The token to compare. + The other object. + bool + + + + Operator== overload. Compare a token and a char. + + The token to compare. + The char. + bool + + + + Operator!= overload. Compare a token and a char. + + The token to compare. + The char. + bool + + + + Operator== overload. Compare a token and a string. + + The token to compare. + The string. + bool + + + + Operator!= overload. Compare a token and a string. + + The token to compare. + The string. + bool + + + + Override. Returns the ToString().GetHashCode(). + + The hash code. + + + + Return this token's value as a string. + + This token's value as a string. + + + + Produce a string which includes the line number. + + + + + + Produce a string which includes the token type. + + + + + + Create an object of the specified type corresponding to + this token. + + The type of object to create. + The new object, or null for error. + + + + Represents end-of-lines (line separator characters). + + + + Default constructor. + + + Constructor that takes line number. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Represents end of file/stream. + + + + Default constructor. + + + Constructor that takes line number. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Abstract base class for string tokens. + + + + Default constructor. + + + Constructor with the specified value + and line number. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Token type for words, meaning sequences of word + characters. + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for Quotes such as "this is a quote". + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for comments, including line and block + comments. + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for whitespace such as spaces and tabs. + + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + + Token type for characters, meaning non-word characters. + + + + Constructor with the specified value + and line number. + + + Constructor with the specified value. + + + Constructor with the specified value. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + Token type for floating point numbers, stored internally as a Double. + + + + + Constructor with the specified value. + + + + + Constructor with the specified value. + + + + + Constructor with the specified value. + + + + + Constructor with the specified value and line number. + + + + + Constructor with the specified value and line number. + + + + + Override, see base + + + + + Override, see base + + + + + Override, see base + + + + + Override, see base + + + + + Override, see base + + + + + Token type for integer tokens. This handles both Int32 and Int64. + + + + Constructor with the specified value. + + + Constructor with the specified value. + + + Constructor with the specified value. + + + Constructor with the specified value + and line number. + + + Constructor with the specified value + and line number. + + + + Constructor for a 64 bit int + + + + + Parse a string known to be a hex string. This is faster + than Parse which doesn't assume the number is Hex. This will + throw an exception if the input number isn't hex. + + The hex number as a string. + The line where this token was found. + A new IntToken set to the value in the input string. + + + + Convert the input string to an integer, if possible + + The string to parse. + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + Override, see base + + + + This enumerates verbosity levels. + + + + For error messages. + + + For warn messages. + + + For info messages. + + + For debug messages. + + + diff --git a/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.deps.json b/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.deps.json new file mode 100644 index 0000000..519f219 --- /dev/null +++ b/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.deps.json @@ -0,0 +1,199 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "NetTopologySuite.IO.ShapeFile/2.0.1-pre.190390564+local": { + "dependencies": { + "Microsoft.SourceLink.GitHub": "1.0.0", + "NETStandard.Library": "2.0.3", + "NetTopologySuite": "2.0.0", + "NetTopologySuite.Features": "2.0.0", + "System.Text.Encoding.CodePages": "4.5.1" + }, + "runtime": { + "NetTopologySuite.IO.ShapeFile.dll": {} + } + }, + "Microsoft.Build.Tasks.Git/1.0.0": {}, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "Microsoft.SourceLink.Common/1.0.0": {}, + "Microsoft.SourceLink.GitHub/1.0.0": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.0.0", + "Microsoft.SourceLink.Common": "1.0.0" + } + }, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "NetTopologySuite/2.0.0": { + "dependencies": { + "System.Memory": "4.5.3" + }, + "runtime": { + "lib/netstandard2.0/NetTopologySuite.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.0.0.0" + } + } + }, + "NetTopologySuite.Features/2.0.0": { + "dependencies": { + "NetTopologySuite": "2.0.0" + }, + "runtime": { + "lib/netstandard2.0/NetTopologySuite.Features.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.0.0.0" + } + } + }, + "System.Buffers/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Memory/4.5.3": { + "dependencies": { + "System.Buffers": "4.4.0", + "System.Numerics.Vectors": "4.4.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.2" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.27617.2" + } + } + }, + "System.Numerics.Vectors/4.4.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.3.0", + "fileVersion": "4.6.25519.3" + } + } + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.4.1", + "fileVersion": "4.6.26919.2" + } + } + }, + "System.Text.Encoding.CodePages/4.5.1": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.5.2" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Encoding.CodePages.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.27129.4" + } + } + } + } + }, + "libraries": { + "NetTopologySuite.IO.ShapeFile/2.0.1-pre.190390564+local": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.Build.Tasks.Git/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-z2fpmmt+1Jfl+ZnBki9nSP08S1/tbEOxFdsK1rSR+LBehIJz1Xv9/6qOOoGNqlwnAGGVGis1Oj6S8Kt9COEYlQ==", + "path": "microsoft.build.tasks.git/1.0.0", + "hashPath": "microsoft.build.tasks.git.1.0.0.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "Microsoft.SourceLink.Common/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-G8DuQY8/DK5NN+3jm5wcMcd9QYD90UV7MiLmdljSJixi3U/vNaeBKmmXUqI4DJCOeWizIUEh4ALhSt58mR+5eg==", + "path": "microsoft.sourcelink.common/1.0.0", + "hashPath": "microsoft.sourcelink.common.1.0.0.nupkg.sha512" + }, + "Microsoft.SourceLink.GitHub/1.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-aZyGyGg2nFSxix+xMkPmlmZSsnGQ3w+mIG23LTxJZHN+GPwTQ5FpPgDo7RMOq+Kcf5D4hFWfXkGhoGstawX13Q==", + "path": "microsoft.sourcelink.github/1.0.0", + "hashPath": "microsoft.sourcelink.github.1.0.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "NetTopologySuite/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3ajBClEI9wx2/DjjGmV52sHW1m52vLg8sdz1pJbTf5ySj1X90qehQs3v1DRwGo0F8UKj/Z2SjNhRN/6LroAkqg==", + "path": "nettopologysuite/2.0.0", + "hashPath": "nettopologysuite.2.0.0.nupkg.sha512" + }, + "NetTopologySuite.Features/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-RDbEpujDL0bsAyTMHlbKj36KIPhUrtSGUaO/jUjMnsLcixrJFwoDJ8p717FdgMHpQDrcEJAKF+QsAlYsSULkew==", + "path": "nettopologysuite.features/2.0.0", + "hashPath": "nettopologysuite.features.2.0.0.nupkg.sha512" + }, + "System.Buffers/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw==", + "path": "system.buffers/4.4.0", + "hashPath": "system.buffers.4.4.0.nupkg.sha512" + }, + "System.Memory/4.5.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==", + "path": "system.memory/4.5.3", + "hashPath": "system.memory.4.5.3.nupkg.sha512" + }, + "System.Numerics.Vectors/4.4.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==", + "path": "system.numerics.vectors/4.4.0", + "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.5.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-wprSFgext8cwqymChhrBLu62LMg/1u92bU+VOwyfBimSPVFXtsNqEWC92Pf9ofzJFlk4IHmJA75EDJn1b2goAQ==", + "path": "system.runtime.compilerservices.unsafe/4.5.2", + "hashPath": "system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512" + }, + "System.Text.Encoding.CodePages/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==", + "path": "system.text.encoding.codepages/4.5.1", + "hashPath": "system.text.encoding.codepages.4.5.1.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.dll b/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.dll new file mode 100644 index 0000000..ea38441 Binary files /dev/null and b/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.dll differ diff --git a/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.xml b/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.xml new file mode 100644 index 0000000..ab5ffb7 --- /dev/null +++ b/PerfApp/nts_shapefile/NetTopologySuite.IO.ShapeFile.xml @@ -0,0 +1,2829 @@ + + + + NetTopologySuite.IO.ShapeFile + + + + + Extends the class to allow reading of integers and doubles + in the Big Endian format. + + + The BinaryReader uses Little Endian format when reading binary streams. + + + + + Initializes a new instance of the BigEndianBinaryReader class + based on the supplied stream and using UTF8Encoding. + + + + + + Initializes a new instance of the BigEndianBinaryReader class + based on the supplied stream and a specific character encoding. + + + + + + + Reads a 4-byte signed integer using the big-endian layout + from the current stream and advances the current position of the stream by four bytes. + + + + + + Reads a 8-byte signed double using the big-endian layout + from the current stream and advances the current position of the stream by eight bytes. + + + + + + Extends the class to allow the writing of integers + and double values in the Big Endian format. + + + + + Initializes a new instance of the BigEndianBinaryWriter class. + + + + + Initializes a new instance of the BigEndianBinaryWriter class + based on the supplied stream and using UTF-8 as the encoding for strings. + + The supplied stream. + + + + Initializes a new instance of the BigEndianBinaryWriter class + based on the supplied stream and a specific character encoding. + + The supplied stream. + The character encoding. + + + + Reads a 4-byte signed integer using the big-endian layout from the current stream + and advances the current position of the stream by two bytes. + + The four-byte signed integer to write. + + + + Reads a 8-byte signed integer using the big-endian layout from the current stream + and advances the current position of the stream by two bytes. + + The four-byte signed integer to write. + + + + This class is used in conjunction with RowStructure. + + + For an explaination of PropertyDescriptor see http://www.devx.com/dotnet/Article/7874 + and the remarks for RowStructure. This class inherits from PropertyDescriptor. + The PropertyDescriptor describes a property - in this case a dynamically generated property. + + + + + Initializes a new instance of the ColumnStructure class. + + + + + + + + + + + + Gets the type of the DBase field. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The Latin1 Encoding + + + + + The default Encoding + + + + + Association of language driver id (ldid) to encoding + + + + + Association of encoding to language driver id (ldid) + + + + + Class for holding the information assicated with a dbase field. + + + + + + + + + + + + + + + + + + + + + + + + Field Name. + + + + + Field Type (C N L D or M). + + + + + Field Data Address offset from the start of the record. + + + + + Length of the data in bytes. + + + + + Field decimal count in Binary, indicating where the decimal is. + + + + + Returns the equivalent CLR type for this field. + + + + + Class for holding the information assicated with a dbase header. + + + + + The encoding + + + + + Initializes a new instance of the DbaseFileHeader class. + + + + + Initializes a new instance of the DbaseFileHeader class. + + The encoding to use for strings + + + + Sets or returns the date this file was last updated. + + + + + + Return the number of fields in the records. + + + + + + Return the number of records in the file. + + + + + + Return the length of the records in bytes. + + + + + + Return the length of the header. + + + + + + Add a column to this DbaseFileHeader. + + The name of the field to add. + The type is one of (C N L or D) character, number, logical(true/false), or date. + The Field length is the total length in bytes reserved for this column. + The decimal count only applies to numbers(N), and floating point values (F), and refers to the number of characters to reserve after the decimal point. + + + + Remove a column from this DbaseFileHeader. + + + return index of the removed column, -1 if no found. + + + + Read the header data from the DBF file. + + BinaryReader containing the header. + Filename + + + + Read the header data from the DBF file. + + BinaryReader containing the header. + A stream provider to read the contents of the CPG Encoding + + + + Function to detect the encoding to use for the data of this shapefile.
+ This function checks the following: + + + Check for a codepage file (CPG) and read the encoding from its content. + + + Try to get an encoding based on the language driver id.
+ This is based on the code pages listed in the ArcGIS v11.5, ArcPad Reference Guide + http://downloads.esri.com/support/documentation/pad_/ArcPad_RefGuide_1105.pdf +
+
+ Use the default encoding. +
+
+ Language driver id + A stream provider for the cpg file + An Encoding +
+ + + Gets or sets a value indicating the default character encoding to use. + + + + + Method to get the language driver id for an encoding + + The encoding + A language driver id + + + + Set the number of records in the file + + + + + + Write the header data to the DBF file. + + + + + + Returns the fields in the dbase file. + + + + + Method to get the encoding from a stream provider + + The stream provider + + An encoding. If is null, + the default ANSI codepage for the system is returned. + + + + + Class that allows records in a dbase file to be enumerated. + + + + + Gets the object that allows iterating through the members of the collection. + + + An object that implements the IEnumerator interface. + + + + + + + + + Sets the enumerator to its initial position, which is + before the first element in the collection. + + + The collection was modified after the enumerator was created. + + + + + Advances the enumerator to the next element of the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Gets the current element in the collection. + + + The current element in the collection. + + The enumerator is positioned before the first element of the collection + or after the last element. + + + + + + + + + Read a single dbase record + + + The read shapefile record, + or null if there are no more records. + + + + + Initializes a new instance of the class. + + + + + + Performs application-defined tasks associated with freeing, releasing, + or resetting unmanaged resources. + + + + + Initializes a new instance of the DbaseFileReader class. + + The path to the Dbase file + + + + Initializes a new instance of the DbaseFileReader class. + + The path to the Dbase file + The encoding to use + + + + Initializes a new instance of the DbaseFileReader class. + + A stream provider registry + + + + Gets the header information for the dbase file. + + DbaseFileHeader contain header and field information. + + + + This class aids in the writing of Dbase IV files. + + + Attribute information of an ESRI Shapefile is written using Dbase IV files. + + + + + Initializes a new instance of the DbaseFileWriter class with standard windows encoding (CP1252, LATIN1) + + The path to the dbase file + + + + Initializes a new instance of the DbaseFileWriter class with the provided encoding. + + The path to the dbase file + The encoding to use + + + + Initializes a new instance of the DbaseFileWriter class using the provided and the default encoding + + The stream provider registry + + + + Initializes a new instance of the DbaseFileWriter class using the provided and the given . + + The stream provider registry + The encoding + + + + Method to write to the dbase stream + + The header to write + + + + Gets a value indicating if the header has been written or not + + + + + Method to write the column values for a dbase record + + The column values + + + + Function to determine if the is a or type. + + The type to test + true if it is either a or type, otherwise false + + + + Function to determine if is a "whole" number type. + + The type to test + true if is one of + , + , + , + , otherwise false + + + + + Write a decimal value to the file. + + The value to write. + The overall width of the column being written to. + The number of decimal places in the column. + + + + + + + + + + + + + + + + + + + + Write a character to the file. + + The character to write. + + The length of the column to write in. Writes + left justified, filling with spaces. + + + + + Write a byte to the file. + + The byte. + + + + Method to close this dbase file writer + + + + + Method to dispose this writers instance + + + + + + + + + + + Finalizer + + + + + Gets a value indicating that this dbase file writer has been disposed + + + + + Method to write the end of dbase file marker (0x1A). + + + + + Implements ICustomTypeDescriptor so we can simulate a row object having a property for every field. + + + For an explaination of ICustomTypeDescriptor see http://www.devx.com/dotnet/Article/7874 + By implementing this interface, we are able to simulate that an object has lots of properties. + These properties are determined dynamically at run-time. When enumerating throught the + ShapefileDataReader, RowStructure is the object that gets returned. + + foreach(object obj in shpDataReader) + { + if (obj.GetType().Name!="RowStructure") + { + // this proves the type returned by shpDataReader + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Possible ways of handling geometry creation issues. + + + + + Let the code run into exception + + + + + Create an empty geometry instead + + + + + Try to fix the geometry + + + Possible fixes are: + + For LineStrings with only one point provided, duplicate that point to have at least two points. + For LinearRings with unclosed coordinate sequence, close the sequence by adding a clone of the first coordinate + ... + For Holes in polygon, use + + + + + Ignore this geometry/feature altogether + + + + + Converts a Shapefile multi-line to a OGIS LineString/MultiLineString. + + + + + Reads a stream and converts the shapefile record to an equilivent geometry object. + + The stream to read. + Total length of the record we are about to read + The geometry factory to use when making the object. + The Geometry object that represents the shape file record. + + + + Writes to the given stream the equilivent shape file record given a Geometry object. + + The geometry object to write. + The stream to write to. + The geometry factory to use. + + + + Gets the length in bytes the Geometry will need when written as a shape file record. + + The Geometry object to use. + The length in bytes the Geometry will use when represented as a shape file record. + + + + Converts a Shapefile point to a OGIS Polygon. + + + + + Reads a stream and converts the shapefile record to an equilivant geometry object. + + The stream to read. + Total length of the record we are about to read + The geometry factory to use when making the object. + The Geometry object that represents the shape file record. + + + + Writes a Geometry to the given binary wirter. + + The geometry to write. + The writer to use. + The geometry factory to use. + + + + Gets the length of the shapefile record using the geometry passed in. + + The geometry to get the length for. + The length in bytes this geometry is going to use when written out as a shapefile record. + + + + Converts a Shapefile point to a OGIS Point. + + + + + Reads a stream and converts the shapefile record to an equilivent geometry object. + + The stream to read. + Total length of the record we are about to read + The geometry factory to use when making the object. + The Geometry object that represents the shape file record. + + + + Writes to the given stream the equilivent shape file record given a Geometry object. + + The geometry object to write. + The stream to write to. + The geometry factory to use. + + + + Gets the length in words (1 word = 2 bytes) the Geometry will need when written as a shape file record. + + The Geometry object to use. + The length in words (1 word = 2 bytes) the Geometry will use when represented as a shape file record. + + + + Converts a Shapefile point to a OGIS Polygon. + + + + + Reads a stream and converts the shapefile record to an equilivent geometry object. + + The stream to read. + Total length of the record we are about to read + The geometry factory to use when making the object. + The Geometry object that represents the shape file record. + + + + Writes a Geometry to the given binary wirter. + + The geometry to write. + The file stream to write to. + The geometry factory to use. + + + + Gets the length of the shapefile record using the geometry passed in. + + The geometry to get the length for. + The length in bytes this geometry is going to use when written out as a shapefile record. + + + + Method to compute the number of parts to write + + The geometry to write + The number of geometry parts + + + + Function to return a coordinate sequence that is ensured to be closed. + + The base sequence + The factory to use in case we need to create a new sequence + A closed coordinate sequence + + + + Serves to probe linear rings + + Bruno.Labrecque@mddep.gouv.qc.ca + + + + Abstract class that defines the interfaces that other 'Shape' handlers must implement. + + + + + Returns the ShapeType the handler handles. + + + + + Reads a stream and converts the shapefile record to an equilivent geometry object. + + The stream to read. + Total number of total bytes in the record to read. + The geometry factory to use when making the object. + The Geometry object that represents the shape file record. + + + + Read an int from the stream.
Tracks how many words (1 word = 2 bytes) we have read and that we do not over read. +
+ The reader to use + The total number of words (1 word = 2 bytes) this record has + A word counter + The value read +
+ + + Read a double from the stream.
Tracks how many words (1 word = 2 bytes) we have read and than we do not over read. +
+ The reader to use + The total number of words (1 word = 2 bytes) this record has + A word counter + The value read +
+ + + Writes to the given stream the equilivent shape file record given a Geometry object. + + The geometry object to write. + The writer to use. + The geometry factory to use. + + + + Gets the length in words (1 word = 2 bytes) the Geometry will need when written as a shape file record. + + The Geometry object to use. + The length in 16bit words the Geometry will use when represented as a shape file record. + + + + Gets the length in words (1 word = 2 bytes) of a multipart geometry needed when written as a shape file record. + + The number of geometry components + The number of points + A value indicating that we have M ordinates + A value indicating that we have Z (and therefore M) ordinates + The length in words (1 word = 2 bytes) the Geometry will use when represented as a shape file record. + + + + + + + + + + + Get Envelope in external coordinates. + + The precision model to use + The envelope to get + + + + + Method to write the bounding box of x- and y- ordinates (aka envelope) + + The writer to use + The precision model to precise + The envelope to write + + + + Function to determine whether or not the shape type might supply an z-ordinate value + + true if is one of + + + + + + + + + + + Function to determine whether or not the shape type might supply an z-ordinate value + + The shape type + true if is one of + + + + + + + + + + + Function to determine whether this handler might supply an m-ordinate value + + true if is one of + + , + , + , + , + + + + + + Function to determine whether or not the shape type might supply an m-ordinate value + + The shape type + true if is one of + + , + , + , + , + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get the z values and populate each one of them in Coordinate.Z + If there are M values, return an array with those. + + The reader + Total number of bytes in this record + How many bytes are read from this record + The coordinate buffer + A list of indices which have not been added to the buffer + + + + + + + + + + Zero based shape index in file. + + + + + Keep reading shapes until we find a non-null one. + + + + + False if reached end of file without finding one, otherwise true. + + + + This class is used to read and write ESRI Shapefiles. + + + + + Here's the logic applied when the flag is enabled: + 1. Considering all rings as a potential shell, + search the valid holes for any possible shell. + 2. Check if the ring is inside any shell: if true, + it can be considered a potential hole for the shell. + 3. Check if the ring is inside any hole of the shell: if true, + this means that is actually a shell of a distinct geometry, + and NOT a valid hole for the shell; a hole inside + another hole is not allowed. + + + Note that the experimental polygon builder is considerably slower + - three to four times slower, in fact - than the standard polygon builder, + especially for complex polygons(i.e.: polygons with a large number of holes). + + Rings order explained. + + + + Given a geomtery object, returns the equivalent shape file type. + + A Geometry object. + The equivalent for the geometry object. + + + + Try to retrieve a not-empty geometry to use asa reference + to use when evaluating the . + + The original geometry. + + The itself if not-empty AND not a collection, + or the first not-empty child if is + a collection,or null. + + + + + Returns the appropriate class to convert a shaperecord to an OGIS geometry given the type of shape. + + The shapefile type. + An instance of the appropriate handler to convert the shape record to a Geometry object. + + + + Returns an ShapefileDataReader representing the data in a shapefile. + + The filename (minus the . and extension) to read. + The geometry factory to use when creating the objects. + An ShapefileDataReader representing the data in the shape file. + + + + Creates a DataTable representing the information in a shape file. + + The filename (minus the . and extension) to read. + The name to give to the table. + The geometry factory to use when creating the objects. + The encoding to use when writing data + DataTable representing the data + + + + Initializes a new instance of the DbaseFileReader class. + + + + + + Gets the header information for the dbase file. + + DbaseFileHeader contain header and field information. + + + + Query shapefile by MBR. + MBR coordinates MUST be in the Shapefile's coordinate system. + + NOTE: If you are using the default ISpatialIndex (which is an instance of the STRtree NTS class), it has some limitations. + Since it works with MBRs rather than the shapes themselves, you can get some shapes that are not actually in the MBR + you provided just because their MBRs are bounded by the given envelope. + If you wish to avoid this behaviour, send true in the second paramter, but be weary of the consequences listed below. + + The envlope to query. + + False by default, true to double-check the returned geometries against given Envelope, to avoid index error margin. + + It is advisable that you implement your own ISpatialIndex with your required precision rather than set this to True. + + ********** + CAUTION: If you choose to set this parameter as True, it will greatly affect performance as it + will cancel any lazy mechanism implemented with reading the geometries from the file. + Do not set this to True unless you either: + A. Do not have any performance restrictions. + Or: + B. Absolutely need that precision in the geographic query. + ********** + + + + + + Check validity of parameters - null values and that all file needed to read shapes exist. + + + + + A class to read from a set of files forming the ESRI-Shapefile + + + + + Creates an instance of this class to read from the Shapefile set of files defined by + + The path to the Shapefile + + + + Finalizer + + + + + Dispose method + + + + + Gets a value indicating the header of the main Shapefile (*.shp) + + + + + Function to read the bounding boxes of all geometries in the Shapefile (*.shp) + + An enumeration of bounding boxes + + + + Read shape at a given offset. + + The offset at which the requested shape metadata begins. + + + + + + Shapefile specific constants + + + + + Every value less that this is considered as not set. + + + + + A value that represents an unset value + + + + + Creates a IDataReader that can be used to enumerate through an ESRI shape file. + + + To create a ShapefileDataReader, use the static methods on the Shapefile class. + + + + + Initializes a new instance of the ShapefileDataReader class. + + The shapefile to read (minus the .shp extension) + The GeometryFactory to use. + + + + Initializes a new instance of the ShapefileDataReader class. + + The shapefile to read (minus the .shp extension) + The GeometryFactory to use. + The encoding to use for reading the attribute data + + + + + + + + + Gets a value indicating whether the data reader is closed. + + true if the data reader is closed; otherwise, false. + IsClosed and RecordsAffected are the only properties that you can call after the IDataReader is closed. + + + + Closes the IDataReader 0bject. + + + + + Return geometry feature of the shapefile. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Advances the data reader to the next result, when reading the shapefile. + + false + + + + Advances the IDataReader to the next record. + + true if there are more rows; otherwise, false. + + + + Returns a DataTable that describes the column metadata of the IDataReader. + + A DataTable that describes the column metadata. + + + + Not applicable for this data reader. + + Always -1 for this data reader. + + RecordsAffected is only applicable to batch statements + that include inserts/updates/deletes.The sample always + returns -1. + + + + + Always return a value of zero since nesting is not supported. + + The level of nesting. + The outermost table has a depth of zero. + + + + Gets the numbers of records in the Shapefile. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the header for the Shapefile. + + + + + Gets the header for the Dbase file. + + + + + Implementation specific methods. + + + + + + + + A simple test class for write a complete (shp, shx and dbf) shapefile structure. + + + + + Gets the stub header. + + The feature. + The count. + + + + + Gets the stub header. + + The feature. + The count. + The encoding. + + + + + Gets the header from a dbf file. + + The DBF file. + + + + + Gets or sets the header of the shapefile. + + The header. + + + + Gets or sets the geometry factory. + + The geometry factory. + + + + Initializes a new instance of the class. + + Name of the file with or without any extension. + + + + Initializes a new instance of the class. + + File path without any extension + + + + + Writes the specified feature collection. + + The feature collection. + + + + The exception that is thrown when a non-fatal application error occurs related to Topology functionality. + + + + + Initializes a new instance of the ShapefileException class. + + + + + Initializes a new instance of the ShapefileException class with a specified error message. + + A message that describes the error. + + + + Initializes a new instance of the ApplicationException class with serialized data. + + The object that holds the serialized object data. + The contextual information about the source or destination. + + + + Initializes a new instance of the ApplicationException class with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception + + + + Class that represents a shape file header record. + + + + + Initializes a new instance of the ShapefileHeader class with values read in from the stream. + + Reads the header information from the stream. + BigEndianBinaryReader stream to the shapefile. + + + + Initializes a new instance of the ShapefileHeader class. + + + + + Gets and sets the bounds of the shape file. + + + + + Gets and sets the shape file type i.e. polygon, point etc... + + + + + Gets and sets the shapefile version. + + + + + Gets and sets the length of the shape file in words. + + + + + Writes a shapefile header to the given stream; + + The binary writer to use. + + + + This class represnts an ESRI Shapefile. + + + + + Initializes a new instance of the Shapefile class with the given parameter + and a standard GeometryFactory. + + The filename of the shape file to read (with .shp). + + + + Gets the bounds of the shape file. + + + + + Returns an enumerator that iterates through a collection. + + + An object + that can be used to iterate through the collection. + + + + + Reads the shapefile and returns a GeometryCollection representing all the records in the shapefile. + + GeometryCollection representing every record in the shapefile. + + + + Summary description for ShapefileEnumerator. + + + Summary description for ShapefileEnumerator. + + + + + Sets the enumerator to its initial position, which is + before the first element in the collection. + + + The collection was modified after the enumerator was created. + + + + + Advances the enumerator to the next element of the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + The collection was modified after the enumerator was created. + + + + Gets the current element in the collection. + + + The current element in the collection. + + The enumerator is positioned before the first element + of the collection or after the last element. + + + + + Initializes a new instance of the class. + + + + + + Performs application-defined tasks associated with freeing, + releasing, or resetting unmanaged resources. + + + + + Initializes a new instance of the Shapefile class with the given parameters. + + The filename of the shape file to read (with .shp). + The GeometryFactory to use when creating Geometry objects. + + + + This class writes ESRI Shapefiles. + + + + + Initializes a buffered writer where you can write shapes individually to the file. + + The filename + The geometry type + + + + Initializes a new instance of the class + with the given . + + + + + + Adds a shape to the shapefile. You must have used the constrcutor with a filename to use this method! + + + + + + Method to write a collection of geometries to a shapefile on disk. + + + Assumes the type given for the first geometry is the same for all subsequent geometries. + For example, is, if the first Geometry is a Multi-polygon/ Polygon, the subsequent geometies are + Muli-polygon/ polygon and not lines or points. + The dbase file for the corresponding shapefile contains one column called row. It contains + the row number. + + The filename to write to (minus the .shp extension). + The GeometryCollection to write. + Set to true to create an empty DBF-file along with the shp-file + + + + Method to write a dummy dbf file + + The dbase filename + The number of records + + + + Method to write a dummy dbase file + + The stream provider registry + The number of records + + + + Method to write a dummy dbase file + + The dbase file writer + The number of records + + + + Write the enumeration of features to shapefile (shp, shx and dbf) + + Filename to create + Enumeration of features to write, features will be enumerated once + Fields that should be written, only those attributes specified here will be mapped from the feature attributetable while writing + Type of geometries shapefile + Optional Encoding to be used when writing the DBF-file (default Windows-1252) + + + + Feature type enumeration + + + + + Null Shape + + + + + Point + + + + + LineString + + + + + Polygon + + + + + MultiPoint + + + + + PointMZ + + + + + PolyLineMZ + + + + + PolygonMZ + + + + + MultiPointMZ + + + + + PointM + + + + + LineStringM + + + + + PolygonM + + + + + MultiPointM + + + + + MultiPatch + + + + + PointZ + + + + + LineStringZ + + + + + PolygonZ + + + + + MultiPointZ + + + + + Contains methods for reading a single Geometry in binary ESRI shapefile format. + + + + + creator. + + + + + Initialize reader with a standard GeometryFactory. + + + + + Initialize reader with the given GeometryFactory. + + + + + + Function to read a from a ShapeFile stream using the specified . + + The reader to use + The ordinates to read + The read point geometry + + + + Function to read a or from a ShapeFile stream using the specified . + + The reader to use + The ordinates to read + The read lineal geometry + + + + Function to read a either a or an from a ShapeFile stream using the specified . + + The reader to use + The ordinates to read + The read polygonal geometry + + + + Function to read a from a ShapeFile stream using the specified . + + The reader to use + The ordinates to read + The read polygonal geometry + + + + Creates a MultiLineString. + + + + + + Creates a single Polygon with holes. + + + + + + + Creates a single Polygon without holes. + + + + + + + Read the x-y Envelope + + The reader to use + + + + Read the ordinate range Envelope + + The reader to use + + + + + + + + + + + + + + + + + + Read the index parts of the shape header + + The reader + The number of parts + The total number of points + An array of integer values + + + + Method to read the coordinates block + + The reader + The total number of points to read + The markers + The ordinates to read + The buffer to add the coordinates to. + + + + Contains methods for writing a single Geometry in binary ESRI Shapefile format. + + + + + Standard byte size for each complex point. + Each complex point (LineString, Polygon, ...) contains + 4 bytes for ShapeTypes and + 32 bytes for bounding box. + + + + + Creates a ShapeWriter that creates objects using a basic GeometryFactory. + + + + + Write the of the using the provided + + The sequence + The writer + The ordinates, and are written in any case. + + + + Evaluates the of the -values in + and writes it using the provided + + The sequence + The ordinate + The writer + + + + Writes to a stream using + + The point to write + The writer to use + + + + Writes to a stream using + + The LineString to write + The writer to use + + + + Writes to a stream using + + The polygon to write + The writer to use + + + + Writes to a stream using + + The multi point to write + The writer to use + + + + Function to determine which ordinates are set in the . + To do that, this function looks for the first geometry that has a property. + Assuming all other geometries have the same ordinates at hand. + + The geometry + The ordinates flag + + + + Writes to a stream using + + The MultiLineString to write + The writer to use + + + + Writes to a stream using + + The multi polygon to write + The writer to use + + + + Writes the 2D using + + The bounding box to write + The writer + + + + Sets correct length for Byte Stream. + + + + + + + Return correct length for Byte Stream. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copies a section of a to another . + The sequences may have different dimensions; + in this case only the common dimensions are copied. + + The sequence to copy coordinates from + The starting index of the coordinates to copy + The sequence to which the coordinates should be copied to + The starting index of the coordinates in + The number of coordinates to copy + + + + Copies a coordinate of a to another . + The sequences may contain different ; in this case only the common ordinates are copied. + + The sequence to copy coordinate from + The index of the coordinate to copy + The sequence to which the coordinate should be copied to + The index of the coordinate in + + + + A stream provider that provides s. + + + + + Creates an instance of this class + + The kind of stream + + + + Creates an instance of this class + + The kind of stream + A text to store + An encoding to get the bytes. + If null, is used + + + + Creates an instance of this class + + The kind of stream + The stream + A value indicating whether the contents are read-only + + + + Creates an instance of this class + + The kind of stream + The array of bytes + The maximum length of the + A value indicating whether the contents are read-only + + + + Gets a value indicating the maximum size of the + + + + + Gets a value indicating the used range of the + + + + + Copy the stream to a byte array + + The stream to copy to a byte array + byte array + + + + Array of bytes + + + + + Gets a value indicating that the underlying stream is read-only + + + + + Function to return a Stream of the bytes + + An opened stream + + + + Function to open the underlying stream for writing purposes + + If is not true + this method shall fail + An opened stream + Thrown if is true + + + + Gets a value indicating the kind of stream + + + + + A stream provider that provides s who are managed by the application. + + + + + Creates an instance of this class + + The kind of stream + A managed by the application + + + + Gets a value indicating that the underlying stream is read-only + + + + + Function to return a Stream of the bytes + + An opened stream + + + + Function to open the underlying stream for writing purposes + + If is not true + this method shall fail + An opened stream + Thrown if is true or the underlying stream doesn't support seeking + + + + Gets a value indicating the kind of stream + + + + + An implementation of that gives acces to file streams + + + + + Creates an instance of this class + + The kind of stream + The path to the stream + A value indicating if the provided path is to be validated + + + + Gets a value indicating the path to the file + + + + + Gets a value indicating that the underlying stream is read-only + + + + + Function to open the underlying stream for reading purposes + + An opened stream + + + + Function to open the underlying stream for writing purposes + + If is true this method shall fail + An opened stream + + + + Gets a value indicating the kind of stream + + + + + Interface for stream provider + + + + + Gets a value indicating that the underlying stream is read-only + + + + + Function to open the underlying stream for reading purposes + + An opened stream + + + + Function to open the underlying stream for writing purposes + + If is true + this method shall fail + An opened stream + + + + Gets a value indicating the kind of stream + + + + + Interface for a registry of stream providers that -altogether- form a spatial dataset. + + + + + Indexer for a stream provider + + The stream type + A stream provider + + If no stream provider for the requested can be provided, null is to be returned.
+ Do not throw an exception! +
+
+ + + An enumeration of stream types + + + + + A shape stream (*.shp) + + + + + An index stream (*.shx) + + + + + A projection string (*.prj) + + + + + A data stream (*.dbf) + + + + + A data encoding stream (*.cpg) + + + + + A spatial index stream (*.sbn) + + + + + A spatial index index stream (*.sbx) + + + + + A stream provider registry for an ESRI Shapefile dataset + + + + + Creates an instance of this class + + The path to the shapefile + A value indicating that the must be validated + A value indicating that the data file modified must be validated + A value indicating that the shape index modified must be validated + + + + Creates an instance of this class + + A stream provider for the shape stream + A stream provider for the data stream + A value indicating that the must be validated + A value indicating that the must be validated + + + + Creates an instance of this class + + A stream provider for the shape stream + A stream provider for the data stream + A stream provider for the shape index stream + A value indicating that the must be validated + A value indicating that the must be validated + A value indicating that the must be validated + + + + + + + + Indexer for a stream provider + + The stream type + A stream provider + + + + Utility class for storing coordinates + + + This class may be useful for other IO classes as well + + + + + Utility to check values for a defined null/no-data-value + + + + + Initializes this structure with a + + The value that is to be treated as null + This optional parameter controls whether a value has to be less than to be considered null + + + + Checks if doesn't satisfy null-check + + The value to check + true if is not equal to + + + + Checks if does satisfy null-check + + The value to check + true if is equal to + + + + Gets the defined null value + + + + + Creates an instance of this class + + + + + Creates an instance of this class with defining the values that should be treated as null. + + The value that should be treated as null. + This optional parameter controls whether a value has to be less than to be considered null + + + + Creates an instance of this class with an initial + + The initial capacity of the buffer. + + + + Creates an instance of this class with an initial + + The initial capacity of the buffer. + The value that should be treated as null. + This optional parameter controls whether a value has to be less than to be considered null + + + + Updates the flags + + The z-Ordinate + The m-Ordinate + + + + Gets or sets the used to create a coordinate sequence from the coordinate data in the buffer. + + + + + Gets the number of coordinates added to the buffer + + + + + Gets the defined ordinates in this buffer + + + + + Gets the number of dimension a coordinate sequence must provide + + + + + Gets a value indicating if this buffer contains any z-ordinate values + + + + + Gets a value indicating if this buffer contains any m-ordinate values + + + + + Gets the (current) capacity of the buffer + + + + + Adds a coordinate made up of the ordinates (x, y, z, m) to the buffer. + + The x-Ordinate + The y-Ordinate + The (optional) z-Ordinate + The (optional) m-Ordinate + Allows repeated coordinates to be added + true if the coordinate was successfully added. + + + + Method to add a marker + + + + + Inserts a coordinate made up of the ordinates (, , , ) at index to the buffer. + + The index at which to insert the ordinate. + The x-Ordinate + The y-Ordinate + The (optional) z-Ordinate + The (optional) m-Ordinate + Allows repeated coordinates to be added + true if the coordinate was successfully inserted. + + + + Clears the contents of this buffer + + + + + Converts the contents of the buffer to an array of s + + An array of s + + + + Converts the contents of this to a coordinate sequence using the provided . + + The converter to use + A coordinate sequence + + + + Converts the contents of this to a coordinate sequence. + + A coordinate sequence + + + + Converts the contents of this to a coordinate sequence. + + A coordinate sequence + + + + Sets a z-value at the provided + + The index + The value + + + + Sets a m-value at the provided + + The index + The value + + + + Converts the contents of this to an array of and values. + + An array of s + + + + Converts the contents of this to an array of and values. + Additionally an array of values is supplied if this instance property is true + + An array of s + + + + Converts the contents of this to an array of and values. + Additionally an array of values is supplied if this instance property is true + + An array of s + + + + Converts the contents of this to an array of and values. + Additionally an array of and one of values is supplied if this instance and or property is true + + An array of s + + + + Converts the contents of this to an array of values. + + The number of dimensions and an array of s + + + + Converts the contents of this to an array of values. + + The number of dimensions and an array of s + + + + Checks of is equal to this. + + The coordinate buffer to test. + true if the coordinates in this buffer match those of other. + + + + Checks a coordinate sequence for equality with this + + The coordinate sequence to test + true if the coordinates in the coordinate sequence are equal to those in this buffer. + + + + + + + + + + + + + Creates a coordinate sequence, that has all possibly repeated points removed + + Controls if z- and m-values are to be considered in the equality check. + A coordinate buffer without repeated points + +
+
diff --git a/src/NetTopologySuite.IO.ShapeFile/Handlers/PolygonBuilder.cs b/src/NetTopologySuite.IO.ShapeFile/Handlers/PolygonBuilder.cs new file mode 100644 index 0000000..876fb11 --- /dev/null +++ b/src/NetTopologySuite.IO.ShapeFile/Handlers/PolygonBuilder.cs @@ -0,0 +1,55 @@ +namespace NetTopologySuite.IO.Handlers +{ + /// + /// Specifies the polygon building algorithm to use. + /// + /// Rings order explained. + public enum PolygonBuilder + { + /// + /// The default polygon builder to use. Defaults to . + /// + Default, + + /// + /// Depends on Shapefile's ring orientation semantics. + /// + /// Ring typeOrientation + /// ShellClockwise, Shapefile's left-hand-rule + /// HoleCounter-Clockwise, Shapefile's right-hand-rule + /// + /// + Legacy = Default, + + /// + /// Here's the logic applied when the flag is enabled: + /// + /// Considering all rings as a potential shell, search the valid holes for any possible shell. + /// Check if the ring is inside any shell: if true, it can be considered a potential hole for the shell. + /// Check if the ring is inside any hole of the shell: if true, this means that is actually a shell of a distinct geometry, + /// and NOT a valid hole for the shell; a hole inside another hole is not allowed. + /// + /// + /// + /// Note that this experimental polygon builder is considerably slower + /// - three to four times slower, in fact - than the polygon builder, + /// especially for complex polygons (i.e.: polygons with a large number of holes). + /// + Extended, + + /// + /// No sorting of rings but assume that polygons are serialized + /// in the following order: Shell[, Holes][, Shell[, Holes][, ...]]. + /// This leads to the conclusion that the first ring that is not + /// contained by the current polygon, is the start of a new polygon. + /// + Sequential, + + /// + /// Uses + /// + UsePolygonizer + + + } +} diff --git a/src/NetTopologySuite.IO.ShapeFile/Handlers/PolygonHandler.cs b/src/NetTopologySuite.IO.ShapeFile/Handlers/PolygonHandler.cs index b8b372a..b2fb788 100644 --- a/src/NetTopologySuite.IO.ShapeFile/Handlers/PolygonHandler.cs +++ b/src/NetTopologySuite.IO.ShapeFile/Handlers/PolygonHandler.cs @@ -1,16 +1,19 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using NetTopologySuite.Algorithm; using NetTopologySuite.Geometries; namespace NetTopologySuite.IO.Handlers { + /// /// Converts a Shapefile point to a OGIS Polygon. /// public class PolygonHandler : ShapeHandler { + //Thanks to Bruno.Labrecque private static readonly ProbeLinearRing ProbeLinearRing = new ProbeLinearRing(); @@ -21,6 +24,7 @@ public PolygonHandler(ShapeGeometryType type) : base(type) { } + /// /// Reads a stream and converts the shapefile record to an equilivent geometry object. /// @@ -33,7 +37,7 @@ public override Geometry Read(BigEndianBinaryReader file, int totalRecordLength, int totalRead = 0; var type = (ShapeGeometryType)ReadInt32(file, totalRecordLength, ref totalRead); if (type == ShapeGeometryType.NullShape) - return factory.CreatePolygon(null, null); + return factory.CreatePolygon(); if (type != ShapeType) throw new ShapefileException(string.Format("Encountered a '{0}' instead of a '{1}'", type, ShapeType)); @@ -84,10 +88,38 @@ public override Geometry Read(BigEndianBinaryReader file, int totalRecordLength, // Geometries via CoordinateSequence further down. GetZMValues(file, totalRecordLength, ref totalRead, buffer, skippedList); + Polygon[] polys; + switch (Shapefile.PolygonBuilder) + { + case PolygonBuilder.Extended: + polys = InternalBuildPolygonsExperimental(factory, buffer); + break; + case PolygonBuilder.Sequential: + polys = InternalBuildPolygonsEx2(factory, buffer); + break; + case PolygonBuilder.UsePolygonizer: + polys = InternalBuildPolygonsEx3(factory, buffer); + break; + default: + polys = InternalBuildPolygons(factory, buffer); + break; + } + + if (polys.Length == 0) + geom = factory.CreatePolygon(); + else if (polys.Length == 1) + geom = polys[0]; + else + geom = factory.CreateMultiPolygon(polys); + return geom; + } + + private static Polygon[] InternalBuildPolygons(GeometryFactory factory, CoordinateBuffer buffer) + { // Get the resulting sequences var sequences = buffer.ToSequences(factory.CoordinateSequenceFactory); - var shells = new List(); - var holes = new List(); + var shells = new List(); + var holes = new List(); for (int i = 0; i < sequences.Length; i++) { //Skip garbage input data with 0 points @@ -97,16 +129,19 @@ public override Geometry Read(BigEndianBinaryReader file, int totalRecordLength, if (tmp == null) continue; var ring = factory.CreateLinearRing(tmp); if (ring.IsCCW) - holes.Add(ring); + holes.Add(factory.CreatePolygon(ring)); else - shells.Add(ring); + shells.Add(factory.CreatePolygon(ring)); } // Ensure the ring is encoded right if (shells.Count == 0 && holes.Count == 1) { - shells.Add(factory.CreateLinearRing(holes[0].CoordinateSequence.Reversed())); + shells.Add((Polygon)((Geometry)holes[0]).Reverse()); holes.Clear(); + + // We have one polygon, we don't have to do anything else + return shells.ToArray(); } // Now we have lists of all shells and all holes @@ -122,7 +157,7 @@ public override Geometry Read(BigEndianBinaryReader file, int totalRecordLength, foreach (var testHole in holes) { var testEnv = testHole.EnvelopeInternal; - var testPt = testHole.GetCoordinateN(0); + var testPt = testHole.ExteriorRing.GetCoordinateN(0); //We have the shells sorted for (int j = 0; j < shells.Count; j++) @@ -138,7 +173,7 @@ public override Geometry Read(BigEndianBinaryReader file, int totalRecordLength, // holes were being found but never added to the holesForShells array // so when converted to geometry by the factory, the inner rings were never created. var holesForThisShell = holesForShells[j]; - holesForThisShell.Add(testHole); + holesForThisShell.Add((LinearRing)testHole.ExteriorRing); //Suggested by Bruno.Labrecque //A LinearRing should only be added to one outer shell @@ -149,16 +184,196 @@ public override Geometry Read(BigEndianBinaryReader file, int totalRecordLength, var polygons = new Polygon[shells.Count]; for (int i = 0; i < shells.Count; i++) - polygons[i] = (factory.CreatePolygon(shells[i], holesForShells[i].ToArray())); + polygons[i] = factory.CreatePolygon((LinearRing)shells[i].ExteriorRing, holesForShells[i].ToArray()); + return polygons; + } - if (polygons.Length == 0) - geom = factory.CreatePolygon(); - else if (polygons.Length == 1) - geom = polygons[0]; - else - geom = factory.CreateMultiPolygon(polygons); + private static Polygon[] InternalBuildPolygonsExperimental(GeometryFactory factory, CoordinateBuffer buffer) + { + // Get the resulting sequences + var sequences = buffer.ToSequences(factory.CoordinateSequenceFactory); + // Read all rings + var rings = new List(); + for (int i = 0; i < sequences.Length; i++) + { + // Skip garbage input data with 0 points + if (sequences[i].Count < 1) continue; - return geom; + var tmp = EnsureClosedSequence(sequences[i], factory.CoordinateSequenceFactory); + if (tmp == null) continue; + var ring = factory.CreateLinearRing(tmp); + rings.Add(factory.CreatePolygon(ring)); + } + + // Utility function to test if a ring is a potential hole for a shell + bool IsHoleContainedInShell(LinearRing shell, LinearRing hole) => + shell.EnvelopeInternal.Contains(hole.EnvelopeInternal) + && PointLocation.IsInRing(hole.GetCoordinateN(0), shell.Coordinates); + + // Sort rings by area, from bigger to smaller + rings = rings.OrderByDescending(r => r.Area).ToList(); + + // Considering all rings as a potential shell, search the valid holes for any shell + // NOTE: rings order explained: https://gis.stackexchange.com/a/147971/26684 + var data = new Stack<(LinearRing shell, List holes)>(); // LIFO + for (int i = 0; i < rings.Count; i++) + { + var ring = (LinearRing)rings[i].ExteriorRing; + if (i == 0) + { + // First ring is "by design" a shell + data.Push((ring, new List())); + continue; + } + + bool isHoleForShell = false; + foreach (var (tryShell, tryHoles) in data) + { + // Check if the ring is inside any shell: if true, + // it can be considered a potential hole for the shell + if (IsHoleContainedInShell(tryShell, ring)) + { + // Check if the ring is inside any hole of the shell: + // if true, this means that is actually a shell of a distinct + // geometry,and NOT a valid hole for the shell; a hole + // inside another hole is not allowed + if (!tryHoles.Any(tryHole => IsHoleContainedInShell(tryHole, ring))) + { + tryHoles.Add(ring); + isHoleForShell = true; + break; + } + } + } + if (!isHoleForShell) + { + data.Push((ring, new List())); + } + } + + return data + .Select(t => factory.CreatePolygon(t.shell, t.holes.ToArray())) + .ToArray(); + } + + private static Polygon[] InternalBuildPolygonsEx2(GeometryFactory factory, CoordinateBuffer buffer) + { + // Get the resulting sequences + var sequences = buffer.ToSequences(factory.CoordinateSequenceFactory); + + // We do not sort the rings but assume that polygons are serialized in the following + // order: Shell[, Holes]. This leads to the conclusion that the first ring that is not + // contained by the current polygon, is the start of a new polygon. + LinearRing shell = null; + var holes = new List(sequences.Length - 1); + + // Utility function to test if a ring is a potential hole for a shell + bool IsRingContainedByShell(LinearRing testShell, LinearRing testRing) => + shell.EnvelopeInternal.Contains(testRing.EnvelopeInternal) + && PointLocation.IsInRing(testRing.GetCoordinateN(0), shell.CoordinateSequence); + + + var res = new List(sequences.Length); + for (int i = 0; i < sequences.Length; i++) + { + // Skip garbage input data with 0 points + if (sequences[i].Count < 1) continue; + + var tmp = EnsureClosedSequence(sequences[i], factory.CoordinateSequenceFactory); + var testRing = factory.CreateLinearRing(tmp); + if (shell == null) + { + shell = testRing; + } + else + { + // Flag indicating if we this ring starts a new polygon + bool newPolygon = false; + + // If the ring is not contained by the shell, we have a new polygon + if (!IsRingContainedByShell(shell, testRing)) + { + newPolygon = true; + } + else + { + // If any hole contains this ring, we have a new polygon + foreach (var hole in holes) + { + if (IsRingContainedByShell((LinearRing)hole, testRing)) + { + newPolygon = true; + break; + } + } + + // Otherwise add this ring to the holes list + holes.Add(testRing); + } + + // If we have to start a new polygon we do it now + if (newPolygon) + { + res.Add(factory.CreatePolygon(shell, holes.ToArray())); + shell = testRing; + holes.Clear(); + } + } + } + + if (shell != null) + res.Add(factory.CreatePolygon(shell, holes.ToArray())); + + return res.ToArray(); + + //// We do not sort the rings but assume that polygons are serialized in the following + //// order: Shell[, Holes]. This leads to the conclusion that the first ring that is not + //// contained by the current polygon, is the start of a new polygon. + //var res = new List(); + //var currentPolygon = factory.CreatePolygon(rings[0]); + //res.Add(currentPolygon); + + //var holes = new List(); + //for (int i = 1; i < rings.Count; i++) + //{ + // if (currentPolygon.Contains(rings[i])) + // { + // holes.Add(rings[i]); + // currentPolygon = factory.CreatePolygon((LinearRing)currentPolygon.ExteriorRing, holes.ToArray()); + // } + // else + // { + // holes.Clear(); + // currentPolygon = factory.CreatePolygon(rings[i]); + // } + //} + + //return res.ToArray(); + } + + private static Polygon[] InternalBuildPolygonsEx3(GeometryFactory factory, CoordinateBuffer buffer) + { + // Get the resulting sequences + var sequences = buffer.ToSequences(factory.CoordinateSequenceFactory); + + // Add rings to polygonizer + var polygonizer = new Operation.Polygonize.Polygonizer(true); + polygonizer.IsCheckingRingsValid = false; + for (int i = 0; i < sequences.Length; i++) + { + // Skip garbage input data with 0 points + if (sequences[i].Count < 1) continue; + + var tmp = EnsureClosedSequence(sequences[i], factory.CoordinateSequenceFactory); + if (tmp == null) continue; + polygonizer.Add(factory.CreateLinearRing(tmp)); + } + + var polygonal = polygonizer.GetGeometry(); + if (polygonal is MultiPolygon mp) + return mp.Geometries.Cast().ToArray(); + + return new [] {(Polygon)polygonal}; } /// @@ -192,10 +407,10 @@ public override void Write(Geometry geometry, BinaryWriter writer, GeometryFacto } // Write the shape type - writer.Write((int) ShapeType); + writer.Write((int)ShapeType); var box = multi.EnvelopeInternal; - var bounds = GetEnvelopeExternal(factory.PrecisionModel, box); + var bounds = GetEnvelopeExternal(factory.PrecisionModel, box); writer.Write(bounds.MinX); writer.Write(bounds.MinY); writer.Write(bounds.MaxX); @@ -211,7 +426,7 @@ public override void Write(Geometry geometry, BinaryWriter writer, GeometryFacto for (int part = 0; part < multi.NumGeometries; part++) { // offset to the shell points - var polygon = (Polygon) multi.Geometries[part]; + var polygon = (Polygon)multi.Geometries[part]; writer.Write(offset); offset = offset + polygon.ExteriorRing.NumPoints; @@ -229,7 +444,7 @@ public override void Write(Geometry geometry, BinaryWriter writer, GeometryFacto // write the points for (int part = 0; part < multi.NumGeometries; part++) { - var poly = (Polygon) multi.Geometries[part]; + var poly = (Polygon)multi.Geometries[part]; var shell = (LinearRing)poly.ExteriorRing; // shells in polygons are written clockwise var points = !shell.IsCCW @@ -237,7 +452,7 @@ public override void Write(Geometry geometry, BinaryWriter writer, GeometryFacto : shell.CoordinateSequence.Reversed(); WriteCoords(points, writer, zList, mList); - foreach(LinearRing hole in poly.InteriorRings) + foreach (LinearRing hole in poly.InteriorRings) { // holes in polygons are written counter-clockwise points = hole.IsCCW diff --git a/src/NetTopologySuite.IO.ShapeFile/Handlers/ProbeLinearRing.cs b/src/NetTopologySuite.IO.ShapeFile/Handlers/ProbeLinearRing.cs index 3718f81..93fc5a8 100644 --- a/src/NetTopologySuite.IO.ShapeFile/Handlers/ProbeLinearRing.cs +++ b/src/NetTopologySuite.IO.ShapeFile/Handlers/ProbeLinearRing.cs @@ -7,7 +7,7 @@ namespace NetTopologySuite.IO.Handlers /// Serves to probe linear rings /// /// Bruno.Labrecque@mddep.gouv.qc.ca - internal class ProbeLinearRing : IComparer + internal class ProbeLinearRing : IComparer, IComparer { internal enum Order @@ -17,7 +17,7 @@ internal enum Order } internal ProbeLinearRing() - :this(Order.Descending) + : this(Order.Descending) { } @@ -40,16 +40,28 @@ internal ProbeLinearRing(Order order) private readonly int _r2; + [System.Obsolete()] public int Compare(LinearRing x, LinearRing y) { var pm = PrecisionModel.MostPrecise(x.PrecisionModel, y.PrecisionModel); - var geometryFactory = new GeometryFactory(pm); + var geometryFactory = NtsGeometryServices.Instance.CreateGeometryFactory(pm, x.SRID); + // If we keep creating new polygons for each comparison + // we can't cache values like Area or Length var p1 = geometryFactory.CreatePolygon(x, null); var p2 = geometryFactory.CreatePolygon(y, null); ; + Compare(p1, p2); + if (p1.Area < p2.Area) return _r1; return p1.Area > p2.Area ? _r2 : 0; } + + public int Compare(Polygon x, Polygon y) + { + if (x.Area < y.Area) + return _r1; + return x.Area > y.Area ? _r2 : 0; + } } } diff --git a/src/NetTopologySuite.IO.ShapeFile/Shapefile.FullFat.cs b/src/NetTopologySuite.IO.ShapeFile/Shapefile.FullFat.cs index 607548b..7d51b17 100644 --- a/src/NetTopologySuite.IO.ShapeFile/Shapefile.FullFat.cs +++ b/src/NetTopologySuite.IO.ShapeFile/Shapefile.FullFat.cs @@ -6,7 +6,7 @@ namespace NetTopologySuite.IO { - public partial class Shapefile + public static partial class Shapefile { /// /// Creates a DataTable representing the information in a shape file. @@ -63,6 +63,5 @@ public static DataTable CreateDataTable(string filename, string tableName, Geome return table; } - } } diff --git a/src/NetTopologySuite.IO.ShapeFile/Shapefile.cs b/src/NetTopologySuite.IO.ShapeFile/Shapefile.cs index 1c4b2cb..d1eddc2 100644 --- a/src/NetTopologySuite.IO.ShapeFile/Shapefile.cs +++ b/src/NetTopologySuite.IO.ShapeFile/Shapefile.cs @@ -8,11 +8,16 @@ namespace NetTopologySuite.IO /// /// This class is used to read and write ESRI Shapefiles. /// - public partial class Shapefile + public static partial class Shapefile { internal const int ShapefileId = 9994; internal const int Version = 1000; + /// + /// Gets or sets a value indicating the polygon building algorithm to use. + /// + public static PolygonBuilder PolygonBuilder { get; set; } + /// /// Given a geomtery object, returns the equivalent shape file type. /// @@ -98,7 +103,7 @@ public static ShapeGeometryType GetShapeType(Geometry geom) /// The itself if not-empty AND not a collection, /// or the first not-empty child if is /// a collection,or null. - /// + /// private static Geometry TryGetNonEmptyGeometry(Geometry geom) { if (geom == null || geom.IsEmpty) diff --git a/test/NetTopologySuite.IO.ShapeFile.Test/Issue70Fixture.cs b/test/NetTopologySuite.IO.ShapeFile.Test/Issue70Fixture.cs new file mode 100644 index 0000000..6df7760 --- /dev/null +++ b/test/NetTopologySuite.IO.ShapeFile.Test/Issue70Fixture.cs @@ -0,0 +1,367 @@ +using NUnit.Framework; +using System.IO; +using NetTopologySuite.Geometries; +using System.Linq; +using System.Collections.Generic; +using NetTopologySuite.IO.ShapeFile.Extended; +using NetTopologySuite.Features; +using System; +using System.Diagnostics; +using NetTopologySuite.IO.Handlers; + +namespace NetTopologySuite.IO.ShapeFile.Test +{ + /// + /// The shell_bad_ccw.shp contains a single polygon, with: + /// - a *shell* CCW-oriented(like a hole from ESRI specs + /// - a *hole* CW-oriented (like a shell from ESRI specs) + /// + /// + [TestFixture] + [ShapeFileIssueNumber(70)] + public class Issue70Fixture + { + [TearDown] + public void AfterEachTestExecution() + { + Shapefile.PolygonBuilder = PolygonBuilder.Default; + } + + private static string GetShapefilePath() + { + string filePath = Path.Combine( + CommonHelpers.TestShapefilesDirectory, + "shell_bad_ccw.shp"); + Assert.That(File.Exists(filePath), Is.True); + return Path.Combine( + Path.GetDirectoryName(filePath), + Path.GetFileNameWithoutExtension(filePath)); + } + + private static Polygon ReadPolyBadlyOriented() + { + string filePathWoExt = GetShapefilePath(); + var shpReader = Shapefile.CreateDataReader(filePathWoExt, GeometryFactory.Default); + bool success = shpReader.Read(); + Assert.That(success, Is.True); + var geom = shpReader.Geometry; + Assert.That(geom, Is.Not.Null); + Assert.That(geom.IsValid, Is.True); + Assert.That(geom.NumGeometries, Is.EqualTo(1)); + Assert.That(geom, Is.InstanceOf()); + return (Polygon)geom.GetGeometryN(0); + } + + private static Polygon ReadPolyBadlyOrientedUsingShapeDataReader() + { + string filePathWoExt = GetShapefilePath(); + using var shpReader = new ShapeDataReader(filePathWoExt); + var features = shpReader.ReadByMBRFilter(shpReader.ShapefileBounds); + return (Polygon)features.Single().Geometry; + } + + /// + /// + /// + [TestCase(PolygonBuilder.Legacy, 0)] + [TestCase(PolygonBuilder.Extended, 1)] + [TestCase(PolygonBuilder.Sequential, 1)] + [TestCase(PolygonBuilder.UsePolygonizer, 1)] + public void TestReadPolygonWithWrongShellOrientation(PolygonBuilder polygonBuilder, int numHoles) + { + Shapefile.PolygonBuilder = polygonBuilder; + var poly = ReadPolyBadlyOriented(); + Assert.That(poly.Shell, Is.Not.Null); + Assert.That(poly.Holes, Is.Not.Null); + Assert.That(poly.Holes.Length, Is.EqualTo(numHoles)); + } + + /// + /// + /// + [Test] + public void TestReadPolygonWithWrongShellOrientationReadsHoleWithFlagEnabled() + { + Shapefile.PolygonBuilder = PolygonBuilder.Extended; + var poly = ReadPolyBadlyOriented(); + Assert.That(poly.Shell, Is.Not.Null); + Assert.That(poly.Holes, Is.Not.Null); + Assert.That(poly.Holes.Length, Is.EqualTo(1)); + } + + [Test] + public void TestReadPolygonWithWrongShellOrientationDoesntReadHoleWithFlagDisabled() + { + var poly = ReadPolyBadlyOriented(); + Assert.That(poly.Shell, Is.Not.Null); + Assert.That(poly.Holes, Is.Not.Null); + Assert.That(poly.Holes.Length, Is.EqualTo(0)); + } + + [Test] + public void TestReadPolygonWithWrongShellOrientationReadsHoleWithFlagEnabledUsingShapeDataReader() + { + Shapefile.PolygonBuilder = PolygonBuilder.Extended; + var poly = ReadPolyBadlyOrientedUsingShapeDataReader(); + Assert.That(poly.Shell, Is.Not.Null); + Assert.That(poly.Holes, Is.Not.Null); + Assert.That(poly.Holes.Length, Is.EqualTo(1)); + } + + [Test] + public void TestReadPolygonWithWrongShellOrientationDoesntReadHoleWithFlagDisabledUsingShapeDataReader() + { + var poly = ReadPolyBadlyOrientedUsingShapeDataReader(); + Assert.That(poly.Shell, Is.Not.Null); + Assert.That(poly.Holes, Is.Not.Null); + Assert.That(poly.Holes.Length, Is.EqualTo(0)); + } + + private const string WktMultiPoly = @" +MULTIPOLYGON (((-124.134 -79.199, -124.141 -79.316, -124.164 -79.431, -124.202 -79.542, -124.254 -79.647, -124.319 -79.745, -124.396 -79.833, -124.484 -79.91, -124.582 -79.975, -124.687 -80.027, -124.798 -80.065, -124.913 -80.088, -125.03 -80.095, -125.147 -80.088, -125.262 -80.065, -125.373 -80.027, -125.478 -79.975, -125.576 -79.91, -125.664 -79.833, -125.741 -79.745, -125.806 -79.647, -125.858 -79.542, -125.896 -79.431, -125.919 -79.316, -125.926 -79.199, -125.919 -79.082, -125.896 -78.967, -125.858 -78.856, -125.806 -78.751, -125.741 -78.653, -125.664 -78.565, -125.576 -78.488, -125.478 -78.423, -125.373 -78.371, -125.262 -78.333, -125.147 -78.31, -125.03 -78.303, -124.913 -78.31, -124.798 -78.333, -124.687 -78.371, -124.582 -78.423, -124.484 -78.488, -124.396 -78.565, -124.319 -78.653, -124.254 -78.751, -124.202 -78.856, -124.164 -78.967, -124.141 -79.082, -124.134 -79.199),(-124.438 -79.199, -124.443 -79.122, -124.459 -79.046, -124.483 -78.973, -124.518 -78.903, -124.561 -78.839, -124.612 -78.781, -124.67 -78.73, -124.734 -78.687, -124.804 -78.652, -124.877 -78.628, -124.953 -78.612, -125.03 -78.607, -125.107 -78.612, -125.183 -78.628, -125.256 -78.652, -125.326 -78.687, -125.39 -78.73, -125.448 -78.781, -125.499 -78.839, -125.542 -78.903, -125.577 -78.973, -125.601 -79.046, -125.617 -79.122, -125.622 -79.199, -125.617 -79.276, -125.601 -79.352, -125.577 -79.425, -125.542 -79.495, -125.499 -79.559, -125.448 -79.617, -125.39 -79.668, -125.326 -79.711, -125.256 -79.746, -125.183 -79.77, -125.107 -79.786, -125.03 -79.791, -124.953 -79.786, -124.877 -79.77, -124.804 -79.746, -124.734 -79.711, -124.67 -79.668, -124.612 -79.617, -124.561 -79.559, -124.518 -79.495, -124.483 -79.425, -124.459 -79.352, -124.443 -79.276, -124.438 -79.199)),((-124.582 -79.199, -124.586 -79.257, -124.597 -79.315, -124.616 -79.371, -124.642 -79.423, -124.674 -79.472, -124.713 -79.516, -124.757 -79.555, -124.806 -79.587, -124.858 -79.613, -124.914 -79.632, -124.972 -79.643, -125.03 -79.647, -125.088 -79.643, -125.146 -79.632, -125.202 -79.613, -125.254 -79.587, -125.303 -79.555, -125.347 -79.516, -125.386 -79.472, -125.418 -79.423, -125.444 -79.371, -125.463 -79.315, -125.474 -79.257, -125.478 -79.199, -125.474 -79.141, -125.463 -79.083, -125.444 -79.027, -125.418 -78.975, -125.386 -78.926, -125.347 -78.882, -125.303 -78.843, -125.254 -78.811, -125.202 -78.785, -125.146 -78.766, -125.088 -78.755, -125.03 -78.751, -124.972 -78.755, -124.914 -78.766, -124.858 -78.785, -124.806 -78.811, -124.757 -78.843, -124.713 -78.882, -124.674 -78.926, -124.642 -78.975, -124.616 -79.027, -124.597 -79.083, -124.586 -79.141, -124.582 -79.199),(-124.896 -79.199, -124.897 -79.181, -124.9 -79.164, -124.906 -79.148, -124.914 -79.132, -124.923 -79.117, -124.935 -79.104, -124.948 -79.092, -124.963 -79.083, -124.979 -79.075, -124.995 -79.069, -125.012 -79.066, -125.03 -79.065, -125.048 -79.066, -125.065 -79.069, -125.081 -79.075, -125.097 -79.083, -125.112 -79.092, -125.125 -79.104, -125.137 -79.117, -125.146 -79.132, -125.154 -79.148, -125.16 -79.164, -125.163 -79.181, -125.164 -79.199, -125.163 -79.217, -125.16 -79.234, -125.154 -79.25, -125.146 -79.266, -125.137 -79.281, -125.125 -79.294, -125.112 -79.306, -125.097 -79.315, -125.081 -79.323, -125.065 -79.329, -125.048 -79.332, -125.03 -79.333, -125.012 -79.332, -124.995 -79.329, -124.979 -79.323, -124.963 -79.315, -124.948 -79.306, -124.935 -79.294, -124.923 -79.281, -124.914 -79.266, -124.906 -79.25, -124.9 -79.234, -124.897 -79.217, -124.896 -79.199))) +"; + + [Test] + public void TestValidMultiPolygonIsWrittenAndReadAsSameGeometry() + { + var fac = GeometryFactory.Default; + var geom = new WKTReader(fac).Read(WktMultiPoly); + Assert.That(geom.IsValid, Is.True); + var coll = fac.CreateGeometryCollection(new[] { geom }); + ShapeFileDataWriterTest.DoTest(coll, Ordinates.XY); + } + + [Test] + public void TestPolygonWithHoleInsideAnotherHoleIsNotValid() + { + var fac = GeometryFactory.Default; + var geom = new WKTReader(fac).Read(WktMultiPoly); + Assert.That(geom.IsValid, Is.True); + Assert.That(geom, Is.InstanceOf()); + var mpoly = (MultiPolygon)geom; + + var rings = CollectRings() + .OrderByDescending(p => fac.CreatePolygon(p).Area) + .ToList(); + IEnumerable CollectRings() + { + foreach (Polygon poly in mpoly.Geometries) + { + yield return poly.Shell; + foreach (var hole in poly.Holes) + yield return hole; + } + } + Assert.That(rings.Count, Is.EqualTo(4)); + for (int i = 1; i < rings.Count; i++) + { + var prev = rings[i - 1]; + var curr = rings[i]; + Assert.That(prev.EnvelopeInternal + .Contains(curr.EnvelopeInternal), Is.True); + } + + var testPoly = fac.CreatePolygon(rings[0], rings.Skip(1).ToArray()); + Assert.That(testPoly.IsValid, Is.False); + Assert.That(testPoly.Holes.Count, Is.EqualTo(3)); + for (int i = 0; i < testPoly.Holes.Length; i++) + { + var prev = i == 0 ? testPoly.Shell : testPoly.Holes[i - 1]; + var curr = testPoly.Holes[i]; + Assert.That(prev.EnvelopeInternal + .Contains(curr.EnvelopeInternal), Is.True); + } + } + + private static IEnumerable CreateFeatures(GeometryFactory fac, uint count, uint step) + { + var list = new List(); + int counter = 0; + int indexer = 0; + for (uint i = 1; i < count * 10; i += step) + { + var shell = fac.CreateLinearRing(new Coordinate[] + { + new Coordinate(1 * i, 1 * i), + new Coordinate(9 * i, 1 * i), + new Coordinate(9 * i, 9* i), + new Coordinate(1 * i, 9* i), + new Coordinate(1 * i, 1* i), + }); + var hole1 = fac.CreateLinearRing(new Coordinate[] + { + new Coordinate(2* i, 2* i), + new Coordinate(3* i, 3* i), + new Coordinate(4* i, 2* i), + new Coordinate(2* i, 2* i), + }); + var hole2 = fac.CreateLinearRing(new Coordinate[] + { + new Coordinate(6* i, 6* i), + new Coordinate(8* i, 8* i), + new Coordinate(7* i, 6* i), + new Coordinate(6* i, 6* i), + }); + var poly = fac.CreatePolygon(shell, new[] { hole1, hole2 }); + list.Add(poly); + if (++counter >= 100) + { + var mpoly = fac.CreateMultiPolygon(list.ToArray()); + var attrs = new AttributesTable { { "id", ++indexer } }; + yield return new Feature(mpoly, attrs); + + list.Clear(); + counter = 0; + } + } + if (list.Count != 0) + { + var mpoly1 = fac.CreateMultiPolygon(list.ToArray()); + var attrs1 = new AttributesTable { { "id", ++indexer } }; + yield return new Feature(mpoly1, attrs1); + } + } + + private static string WriteFeatures(out int featuresCount) + { + var features = CreateFeatures(GeometryFactory.Default, 500000, 50).ToList(); + featuresCount = features.Count; + string fname = Path.ChangeExtension(Path.GetTempFileName(), ".shp"); + var header = ShapefileDataWriter.GetHeader(features[0], features.Count); + var w = Stopwatch.StartNew(); + var writer = new ShapefileDataWriter(fname) { Header = header }; + writer.Write(features); + w.Stop(); + Assert.That(File.Exists(fname), Is.True); + Console.WriteLine($"WRITE => elapsed: '{w.Elapsed}'"); + return fname; + } + + private static void TestReaderPerformances(string fname, + bool shapeReader, int featuresCount) + { + string fnameWoExt = Path.Combine( + Path.GetDirectoryName(fname), + Path.GetFileNameWithoutExtension(fname)); + Console.WriteLine(shapeReader ? "ShapeReader" : "ShapeFileDataReader"); + + Shapefile.PolygonBuilder = PolygonBuilder.Legacy; + Assert.That(Shapefile.PolygonBuilder, Is.EqualTo(PolygonBuilder.Legacy)); + var w = Stopwatch.StartNew(); + int readDisabled = shapeReader + ? ReadDataUsingShapeDataReader(fnameWoExt) + : ReadDataUsingShapeFileDataReader(fnameWoExt); + w.Stop(); + Console.WriteLine($"{Shapefile.PolygonBuilder} => elapsed: '{w.Elapsed}'"); + Assert.That(readDisabled, Is.EqualTo(featuresCount)); + + Shapefile.PolygonBuilder = PolygonBuilder.Extended; + Assert.That(Shapefile.PolygonBuilder, Is.EqualTo(PolygonBuilder.Extended)); + w.Restart(); + int readEnabled = shapeReader + ? ReadDataUsingShapeDataReader(fnameWoExt) + : ReadDataUsingShapeFileDataReader(fnameWoExt); + w.Stop(); + Console.WriteLine($"{Shapefile.PolygonBuilder} => elapsed: '{w.Elapsed}'"); + Assert.That(readEnabled, Is.EqualTo(featuresCount)); + + Shapefile.PolygonBuilder = PolygonBuilder.Sequential; + Assert.That(Shapefile.PolygonBuilder, Is.EqualTo(PolygonBuilder.Sequential)); + w.Restart(); + readEnabled = shapeReader + ? ReadDataUsingShapeDataReader(fnameWoExt) + : ReadDataUsingShapeFileDataReader(fnameWoExt); + w.Stop(); + Console.WriteLine($"{Shapefile.PolygonBuilder} => elapsed: '{w.Elapsed}'"); + Assert.That(readEnabled, Is.EqualTo(featuresCount)); + + Shapefile.PolygonBuilder = PolygonBuilder.UsePolygonizer; + Assert.That(Shapefile.PolygonBuilder, Is.EqualTo(PolygonBuilder.UsePolygonizer)); + w.Restart(); + readEnabled = shapeReader + ? ReadDataUsingShapeDataReader(fnameWoExt) + : ReadDataUsingShapeFileDataReader(fnameWoExt); + w.Stop(); + Console.WriteLine($"{Shapefile.PolygonBuilder} => elapsed: '{w.Elapsed}'"); + Assert.That(readEnabled, Is.EqualTo(featuresCount)); + } + + private static int ReadDataUsingShapeFileDataReader(string fname) + { + int i = 0; + var reader = Shapefile.CreateDataReader(fname, GeometryFactory.Default); + while (reader.Read()) + i++; + return i; + } + + private static int ReadDataUsingShapeDataReader(string fname) + { + using var reader = new ShapeDataReader(fname); + var bounds = reader.ShapefileBounds; + var features = reader.ReadByMBRFilter(bounds); + return features.Count(); + } + + [Test] + [Explicit] + public void TestPerformances() + { + string fname = WriteFeatures(out int featuresCount); + TestReaderPerformances(fname, false, featuresCount); + TestReaderPerformances(fname, true, featuresCount); + } + + private static TimeSpan TestReaderPerformancesSimple(string fname) + { + string fnameWoExt = Path.Combine( + Path.GetDirectoryName(fname), + Path.GetFileNameWithoutExtension(fname)); + var w = Stopwatch.StartNew(); + ReadDataUsingShapeDataReader(fnameWoExt); + w.Stop(); + return w.Elapsed; + } + + private const int PerfTestNum = 20; + + private static void TestReaderPerformancesSimple(PolygonBuilder pb) + { + string fname = WriteFeatures(out int _); + Shapefile.PolygonBuilder = pb; + Assert.That(Shapefile.PolygonBuilder, Is.EqualTo(pb)); + double avg = Enumerable.Range(0, PerfTestNum) + .Select(_ => TestReaderPerformancesSimple(fname)) + .Average(ts => ts.TotalMilliseconds); + Console.WriteLine($"{pb}: n='{PerfTestNum}' => average ms='{avg}'"); + } + + [Test] + [Explicit] + public void TestPerformancesWithDefaultPolygonBuilder() + { + TestReaderPerformancesSimple(PolygonBuilder.Default); + } + + [Test] + [Explicit] + public void TestPerformancesWithExtendedPolygonBuilder() + { + TestReaderPerformancesSimple(PolygonBuilder.Extended); + } + + [Test] + [Explicit] + public void TestPerformancesWithSequentialPolygonBuilder() + { + TestReaderPerformancesSimple(PolygonBuilder.Sequential); + } + + [Test] + [Explicit] + public void TestPerformancesWithUsePolygonizerPolygonBuilder() + { + TestReaderPerformancesSimple(PolygonBuilder.UsePolygonizer); + } + } +} diff --git a/test/NetTopologySuite.IO.ShapeFile.Test/Issue79Fixture.cs b/test/NetTopologySuite.IO.ShapeFile.Test/Issue79Fixture.cs index d85c452..723fa7d 100644 --- a/test/NetTopologySuite.IO.ShapeFile.Test/Issue79Fixture.cs +++ b/test/NetTopologySuite.IO.ShapeFile.Test/Issue79Fixture.cs @@ -18,8 +18,11 @@ public void TestReadEmptyShapefile() CommonHelpers.TestShapefilesDirectory, "__emptyShapefile.shp"); Assert.That(File.Exists(filePath), Is.True); + string filePathWoExt = Path.Combine( + Path.GetDirectoryName(filePath), + Path.GetFileNameWithoutExtension(filePath)); using var shpReader = new ShapefileDataReader( - Path.GetFileNameWithoutExtension(filePath), + filePathWoExt, GeometryFactory.Default); bool success = shpReader.Read(); Assert.That(success, Is.False); diff --git a/test/NetTopologySuite.IO.ShapeFile.Test/ShapeFileDataWriterTest.cs b/test/NetTopologySuite.IO.ShapeFile.Test/ShapeFileDataWriterTest.cs index df6336e..8ea76fa 100644 --- a/test/NetTopologySuite.IO.ShapeFile.Test/ShapeFileDataWriterTest.cs +++ b/test/NetTopologySuite.IO.ShapeFile.Test/ShapeFileDataWriterTest.cs @@ -181,7 +181,7 @@ public void TestReadWritePolygonal() DoTest(geomsWrite, Ordinates.XYZM, false); } - private static void DoTest(GeometryCollection geomsWrite, Ordinates ordinates, bool testGetOrdinate = true) + internal static void DoTest(GeometryCollection geomsWrite, Ordinates ordinates, bool testGetOrdinate = true) { string fileName = string.Empty; diff --git a/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.dbf b/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.dbf new file mode 100644 index 0000000..ee26eca Binary files /dev/null and b/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.dbf differ diff --git a/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.shp b/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.shp new file mode 100644 index 0000000..5809d37 Binary files /dev/null and b/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.shp differ diff --git a/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.shx b/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.shx new file mode 100644 index 0000000..1e00e98 Binary files /dev/null and b/test/NetTopologySuite.IO.ShapeFile.Test/TestShapefiles/shell_bad_ccw.shx differ