jsts-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/jsts-rails/version.rb +1 -1
- data/vendor/assets/javascripts/javascript.util.js +33 -1
- data/vendor/assets/javascripts/jsts-original.js +164 -1573
- data/vendor/assets/javascripts/jsts.js +197 -0
- data/vendor/assets/javascripts/jsts/algorithm/Angle.js +387 -0
- data/vendor/assets/javascripts/jsts/algorithm/BoundaryNodeRule.js +67 -0
- data/vendor/assets/javascripts/jsts/algorithm/CGAlgorithms.js +596 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentralEndpointIntersector.js +118 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentroidArea.js +225 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentroidLine.js +85 -0
- data/vendor/assets/javascripts/jsts/algorithm/CentroidPoint.js +77 -0
- data/vendor/assets/javascripts/jsts/algorithm/ConvexHull.js +409 -0
- data/vendor/assets/javascripts/jsts/algorithm/HCoordinate.js +234 -0
- data/vendor/assets/javascripts/jsts/algorithm/LineIntersector.js +502 -0
- data/vendor/assets/javascripts/jsts/algorithm/MCPointInRing.js +124 -0
- data/vendor/assets/javascripts/jsts/algorithm/PointLocator.js +247 -0
- data/vendor/assets/javascripts/jsts/algorithm/RayCrossingCounter.js +215 -0
- data/vendor/assets/javascripts/jsts/algorithm/RobustDeterminant.js +353 -0
- data/vendor/assets/javascripts/jsts/algorithm/RobustLineIntersector.js +477 -0
- data/vendor/assets/javascripts/jsts/algorithm/distance/DiscreteHausdorffDistance.js +228 -0
- data/vendor/assets/javascripts/jsts/algorithm/distance/DistanceToPoint.js +68 -0
- data/vendor/assets/javascripts/jsts/algorithm/distance/PointPairDistance.js +104 -0
- data/vendor/assets/javascripts/jsts/algorithm/locate/PointOnGeometryLocator.js +7 -0
- data/vendor/assets/javascripts/jsts/algorithm/locate/SimplePointInAreaLocator.js +102 -0
- data/vendor/assets/javascripts/jsts/geom/Coordinate.js +158 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateArrays.js +148 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateFilter.js +29 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateList.js +157 -0
- data/vendor/assets/javascripts/jsts/geom/CoordinateSequenceFilter.js +63 -0
- data/vendor/assets/javascripts/jsts/geom/Dimension.js +137 -0
- data/vendor/assets/javascripts/jsts/geom/Envelope.js +833 -0
- data/vendor/assets/javascripts/jsts/geom/Geometry.js +1535 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryCollection.js +230 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryComponentFilter.js +36 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryFactory.js +263 -0
- data/vendor/assets/javascripts/jsts/geom/GeometryFilter.js +29 -0
- data/vendor/assets/javascripts/jsts/geom/IntersectionMatrix.js +650 -0
- data/vendor/assets/javascripts/jsts/geom/LineSegment.js +275 -0
- data/vendor/assets/javascripts/jsts/geom/LineString.js +299 -0
- data/vendor/assets/javascripts/jsts/geom/LinearRing.js +69 -0
- data/vendor/assets/javascripts/jsts/geom/Location.js +83 -0
- data/vendor/assets/javascripts/jsts/geom/MultiLineString.js +47 -0
- data/vendor/assets/javascripts/jsts/geom/MultiPoint.js +64 -0
- data/vendor/assets/javascripts/jsts/geom/MultiPolygon.js +64 -0
- data/vendor/assets/javascripts/jsts/geom/Point.js +197 -0
- data/vendor/assets/javascripts/jsts/geom/Polygon.js +263 -0
- data/vendor/assets/javascripts/jsts/geom/PrecisionModel.js +187 -0
- data/vendor/assets/javascripts/jsts/geom/Triangle.js +313 -0
- data/vendor/assets/javascripts/jsts/geom/util/GeometryCombiner.js +143 -0
- data/vendor/assets/javascripts/jsts/geom/util/GeometryExtracter.js +76 -0
- data/vendor/assets/javascripts/jsts/geom/util/GeometryTransformer.js +295 -0
- data/vendor/assets/javascripts/jsts/geom/util/LinearComponentExtracter.js +207 -0
- data/vendor/assets/javascripts/jsts/geom/util/PointExtracter.js +67 -0
- data/vendor/assets/javascripts/jsts/geom/util/PolygonExtracter.js +71 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Depth.js +145 -0
- data/vendor/assets/javascripts/jsts/geomgraph/DirectedEdge.js +270 -0
- data/vendor/assets/javascripts/jsts/geomgraph/DirectedEdgeStar.js +388 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Edge.js +291 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeEnd.js +188 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeEndStar.js +322 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeIntersection.js +122 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeIntersectionList.js +146 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeList.js +111 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeNodingValidator.js +76 -0
- data/vendor/assets/javascripts/jsts/geomgraph/EdgeRing.js +230 -0
- data/vendor/assets/javascripts/jsts/geomgraph/GeometryGraph.js +469 -0
- data/vendor/assets/javascripts/jsts/geomgraph/GraphComponent.js +181 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Label.js +316 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Node.js +105 -0
- data/vendor/assets/javascripts/jsts/geomgraph/NodeFactory.js +22 -0
- data/vendor/assets/javascripts/jsts/geomgraph/NodeMap.js +128 -0
- data/vendor/assets/javascripts/jsts/geomgraph/PlanarGraph.js +214 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Position.js +63 -0
- data/vendor/assets/javascripts/jsts/geomgraph/Quadrant.js +143 -0
- data/vendor/assets/javascripts/jsts/geomgraph/TopologyLocation.js +251 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/EdgeSetIntersector.js +47 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/SegmentIntersector.js +298 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/SimpleEdgeSetIntersector.js +107 -0
- data/vendor/assets/javascripts/jsts/geomgraph/index/SimpleMCSweepLineIntersector.js +29 -0
- data/vendor/assets/javascripts/jsts/index/ArrayListVisitor.js +37 -0
- data/vendor/assets/javascripts/jsts/index/DoubleBits.js +132 -0
- data/vendor/assets/javascripts/jsts/index/IntervalSize.js +55 -0
- data/vendor/assets/javascripts/jsts/index/ItemVisitor.js +23 -0
- data/vendor/assets/javascripts/jsts/index/SpatialIndex.js +67 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Bintree.js +224 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Interval.js +160 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Key.js +110 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Node.js +204 -0
- data/vendor/assets/javascripts/jsts/index/bintree/NodeBase.js +220 -0
- data/vendor/assets/javascripts/jsts/index/bintree/Root.js +113 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChain.js +244 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChainBuilder.js +106 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChainOverlapAction.js +56 -0
- data/vendor/assets/javascripts/jsts/index/chain/MonotoneChainSelectAction.js +44 -0
- data/vendor/assets/javascripts/jsts/index/kdtree/KdNode.js +171 -0
- data/vendor/assets/javascripts/jsts/index/kdtree/KdTree.js +218 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Key.js +134 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Node.js +220 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/NodeBase.js +330 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Quadtree.js +228 -0
- data/vendor/assets/javascripts/jsts/index/quadtree/Root.js +105 -0
- data/vendor/assets/javascripts/jsts/index/strtree/AbstractNode.js +107 -0
- data/vendor/assets/javascripts/jsts/index/strtree/AbstractSTRtree.js +594 -0
- data/vendor/assets/javascripts/jsts/index/strtree/Boundable.js +37 -0
- data/vendor/assets/javascripts/jsts/index/strtree/BoundablePair.js +0 -0
- data/vendor/assets/javascripts/jsts/index/strtree/Interval.js +94 -0
- data/vendor/assets/javascripts/jsts/index/strtree/ItemBoundable.js +60 -0
- data/vendor/assets/javascripts/jsts/index/strtree/SIRtree.js +122 -0
- data/vendor/assets/javascripts/jsts/index/strtree/STRtree.js +450 -0
- data/vendor/assets/javascripts/jsts/io/GeoJSONParser.js +471 -0
- data/vendor/assets/javascripts/jsts/io/GeoJSONReader.js +58 -0
- data/vendor/assets/javascripts/jsts/io/GeoJSONWriter.js +38 -0
- data/vendor/assets/javascripts/jsts/io/OpenLayersParser.js +245 -0
- data/vendor/assets/javascripts/jsts/io/WKTParser.js +421 -0
- data/vendor/assets/javascripts/jsts/io/WKTReader.js +68 -0
- data/vendor/assets/javascripts/jsts/io/WKTWriter.js +61 -0
- data/vendor/assets/javascripts/jsts/noding/BasicSegmentString.js +87 -0
- data/vendor/assets/javascripts/jsts/noding/FastNodingValidator.js +127 -0
- data/vendor/assets/javascripts/jsts/noding/InteriorIntersectionFinder.js +171 -0
- data/vendor/assets/javascripts/jsts/noding/IntersectionAdder.js +198 -0
- data/vendor/assets/javascripts/jsts/noding/IntersectionFinderAdder.js +79 -0
- data/vendor/assets/javascripts/jsts/noding/MCIndexNoder.js +147 -0
- data/vendor/assets/javascripts/jsts/noding/NodableSegmentString.js +35 -0
- data/vendor/assets/javascripts/jsts/noding/NodedSegmentString.js +235 -0
- data/vendor/assets/javascripts/jsts/noding/Noder.js +41 -0
- data/vendor/assets/javascripts/jsts/noding/NodingValidator.js +5 -0
- data/vendor/assets/javascripts/jsts/noding/Octant.js +84 -0
- data/vendor/assets/javascripts/jsts/noding/OrientedCoordinateArray.js +94 -0
- data/vendor/assets/javascripts/jsts/noding/ScaledNoder.js +105 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentIntersector.js +45 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentNode.js +70 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentNodeList.js +262 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentPointComparator.js +78 -0
- data/vendor/assets/javascripts/jsts/noding/SegmentString.js +61 -0
- data/vendor/assets/javascripts/jsts/noding/SinglePassNoder.js +51 -0
- data/vendor/assets/javascripts/jsts/noding/snapround/HotPixel.js +271 -0
- data/vendor/assets/javascripts/jsts/noding/snapround/MCIndexPointSnapper.js +96 -0
- data/vendor/assets/javascripts/jsts/noding/snapround/MCIndexSnapRounder.js +147 -0
- data/vendor/assets/javascripts/jsts/operation/BoundaryOp.js +166 -0
- data/vendor/assets/javascripts/jsts/operation/GeometryGraphOperation.js +90 -0
- data/vendor/assets/javascripts/jsts/operation/IsSimpleOp.js +293 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferBuilder.js +317 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferInputLineSimplifier.js +294 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferOp.js +340 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferParameters.js +328 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/BufferSubgraph.js +296 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetCurveBuilder.js +369 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetCurveSetBuilder.js +301 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetSegmentGenerator.js +777 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/OffsetSegmentString.js +109 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/RightmostEdgeFinder.js +164 -0
- data/vendor/assets/javascripts/jsts/operation/buffer/SubgraphDepthLocater.js +220 -0
- data/vendor/assets/javascripts/jsts/operation/distance/ConnectedElementLocationFilter.js +67 -0
- data/vendor/assets/javascripts/jsts/operation/distance/DistanceOp.js +506 -0
- data/vendor/assets/javascripts/jsts/operation/distance/GeometryLocation.js +102 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/LineBuilder.js +194 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/MaximalEdgeRing.js +72 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/MinimalEdgeRing.js +33 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/OverlayNodeFactory.js +26 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/OverlayOp.js +584 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/PointBuilder.js +103 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/PolygonBuilder.js +282 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/GeometrySnapper.js +228 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/LineStringSnapper.js +228 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/SnapIfNeededOverlayOp.js +85 -0
- data/vendor/assets/javascripts/jsts/operation/overlay/snap/SnapOverlayOp.js +134 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/EdgeRing.js +259 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/PolygonizeDirectedEdge.js +94 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/PolygonizeEdge.js +31 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/PolygonizeGraph.js +507 -0
- data/vendor/assets/javascripts/jsts/operation/polygonize/Polygonizer.js +259 -0
- data/vendor/assets/javascripts/jsts/operation/relate/EdgeEndBuilder.js +140 -0
- data/vendor/assets/javascripts/jsts/operation/relate/EdgeEndBundle.js +183 -0
- data/vendor/assets/javascripts/jsts/operation/relate/EdgeEndBundleStar.js +48 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateComputer.js +444 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateNode.js +46 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateNodeFactory.js +25 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateNodeGraph.js +118 -0
- data/vendor/assets/javascripts/jsts/operation/relate/RelateOp.js +75 -0
- data/vendor/assets/javascripts/jsts/operation/union/CascadedPolygonUnion.js +319 -0
- data/vendor/assets/javascripts/jsts/operation/union/PointGeometryUnion.js +118 -0
- data/vendor/assets/javascripts/jsts/operation/union/UnaryUnionOp.js +244 -0
- data/vendor/assets/javascripts/jsts/operation/union/UnionInteracting.js +156 -0
- data/vendor/assets/javascripts/jsts/operation/valid/ConnectedInteriorTester.js +259 -0
- data/vendor/assets/javascripts/jsts/operation/valid/ConsistentAreaTester.js +127 -0
- data/vendor/assets/javascripts/jsts/operation/valid/IndexedNestedRingTester.js +89 -0
- data/vendor/assets/javascripts/jsts/operation/valid/IsValidOp.js +619 -0
- data/vendor/assets/javascripts/jsts/operation/valid/TopologyValidationError.js +199 -0
- data/vendor/assets/javascripts/jsts/planargraph/DirectedEdge.js +232 -0
- data/vendor/assets/javascripts/jsts/planargraph/DirectedEdgeStar.js +168 -0
- data/vendor/assets/javascripts/jsts/planargraph/Edge.js +124 -0
- data/vendor/assets/javascripts/jsts/planargraph/GraphComponent.js +182 -0
- data/vendor/assets/javascripts/jsts/planargraph/Node.js +127 -0
- data/vendor/assets/javascripts/jsts/planargraph/NodeMap.js +76 -0
- data/vendor/assets/javascripts/jsts/planargraph/PlanarGraph.js +246 -0
- data/vendor/assets/javascripts/jsts/simplify/LineSegmentIndex.js +101 -0
- data/vendor/assets/javascripts/jsts/triangulate/DelaunayTriangulationBuilder.js +224 -0
- data/vendor/assets/javascripts/jsts/triangulate/IncrementalDelaunayTriangulator.js +111 -0
- data/vendor/assets/javascripts/jsts/triangulate/VoronoiDiagramBuilder.js +172 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/LastFoundQuadEdgeLocator.js +52 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/QuadEdge.js +437 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/QuadEdgeSubdivision.js +1064 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/TrianglePredicate.js +350 -0
- data/vendor/assets/javascripts/jsts/triangulate/quadedge/Vertex.js +496 -0
- data/vendor/assets/javascripts/jsts/util/Assert.js +80 -0
- data/vendor/assets/javascripts/jsts/util/AssertionFailedException.js +23 -0
- data/vendor/assets/javascripts/jsts/util/UniqueCoordinateArrayFilter.js +52 -0
- metadata +204 -1
@@ -0,0 +1,235 @@
|
|
1
|
+
/* Copyright (c) 2011 by The Authors.
|
2
|
+
* Published under the LGPL 2.1 license.
|
3
|
+
* See /license-notice.txt for the full text of the license notice.
|
4
|
+
* See /license.txt for the full text of the license.
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Port source: /jts/jts/java/src/com/vividsolutions/jts/noding/NodedSegmentString.java
|
9
|
+
* Revision: 478
|
10
|
+
*/
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @requires jsts/noding/NodableSegmentString.js
|
14
|
+
*/
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Represents a list of contiguous line segments, and supports noding the
|
18
|
+
* segments. The line segments are represented by an array of {@link Coordinate}s.
|
19
|
+
* Intended to optimize the noding of contiguous segments by reducing the number
|
20
|
+
* of allocated objects. SegmentStrings can carry a context object, which is
|
21
|
+
* useful for preserving topological or parentage information. All noded
|
22
|
+
* substrings are initialized with the same context object.
|
23
|
+
*
|
24
|
+
* Creates a new segment string from a list of vertices.
|
25
|
+
*
|
26
|
+
* @param pts
|
27
|
+
* the vertices of the segment string.
|
28
|
+
* @param data
|
29
|
+
* the user-defined data of this segment string (may be null).
|
30
|
+
*
|
31
|
+
* @constructor
|
32
|
+
*/
|
33
|
+
jsts.noding.NodedSegmentString = function(pts, data) {
|
34
|
+
this.nodeList = new jsts.noding.SegmentNodeList(this);
|
35
|
+
|
36
|
+
this.pts = pts;
|
37
|
+
this.data = data;
|
38
|
+
};
|
39
|
+
jsts.noding.NodedSegmentString.prototype = new jsts.noding.NodableSegmentString();
|
40
|
+
jsts.noding.NodedSegmentString.constructor = jsts.noding.NodedSegmentString;
|
41
|
+
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Gets the {@link SegmentString}s which result from splitting this string at node points.
|
45
|
+
*
|
46
|
+
* @param {javascript.util.Collection}
|
47
|
+
* segStrings a Collection of NodedSegmentStrings.
|
48
|
+
* @param {javascript.util.Collection} resultEdgelist
|
49
|
+
* a List which will collect the NodedSegmentStrings representing the
|
50
|
+
* substrings.
|
51
|
+
* @return {Array} a Collection of NodedSegmentStrings representing the
|
52
|
+
* substrings.
|
53
|
+
*/
|
54
|
+
jsts.noding.NodedSegmentString.getNodedSubstrings = function(segStrings) {
|
55
|
+
if (arguments.length === 2) {
|
56
|
+
jsts.noding.NodedSegmentString.getNodedSubstrings2.apply(this, arguments);
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
|
60
|
+
var resultEdgelist = new javascript.util.ArrayList();
|
61
|
+
jsts.noding.NodedSegmentString.getNodedSubstrings2(segStrings, resultEdgelist);
|
62
|
+
return resultEdgelist;
|
63
|
+
};
|
64
|
+
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Adds the noded {@link SegmentString}s which result from splitting this string at node points.
|
68
|
+
*
|
69
|
+
* @param {javascript.util.Collection} segStrings
|
70
|
+
* a Collection of NodedSegmentStrings.
|
71
|
+
* @param {javascript.util.Collection} resultEdgelist
|
72
|
+
* a List which will collect the NodedSegmentStrings representing the
|
73
|
+
* substrings.
|
74
|
+
*/
|
75
|
+
jsts.noding.NodedSegmentString.getNodedSubstrings2 = function(segStrings,
|
76
|
+
resultEdgelist) {
|
77
|
+
for (var i = segStrings.iterator(); i.hasNext(); ) {
|
78
|
+
var ss = i.next();
|
79
|
+
ss.getNodeList().addSplitEdges(resultEdgelist);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
|
84
|
+
/**
|
85
|
+
* @type {jsts.noding.SegmentNodeList}
|
86
|
+
* @private
|
87
|
+
*/
|
88
|
+
jsts.noding.NodedSegmentString.prototype.nodeList = null;
|
89
|
+
|
90
|
+
|
91
|
+
/**
|
92
|
+
* @type {Array.<jsts.geom.Coordinate>}
|
93
|
+
* @private
|
94
|
+
*/
|
95
|
+
jsts.noding.NodedSegmentString.prototype.pts = null;
|
96
|
+
|
97
|
+
|
98
|
+
/**
|
99
|
+
* @type {Object}
|
100
|
+
* @private
|
101
|
+
*/
|
102
|
+
jsts.noding.NodedSegmentString.prototype.data = null;
|
103
|
+
|
104
|
+
|
105
|
+
jsts.noding.NodedSegmentString.prototype.getData = function() {
|
106
|
+
return this.data;
|
107
|
+
};
|
108
|
+
jsts.noding.NodedSegmentString.prototype.setData = function(data) {
|
109
|
+
this.data = data;
|
110
|
+
};
|
111
|
+
jsts.noding.NodedSegmentString.prototype.getNodeList = function() {
|
112
|
+
return this.nodeList;
|
113
|
+
};
|
114
|
+
jsts.noding.NodedSegmentString.prototype.size = function() {
|
115
|
+
return this.pts.length;
|
116
|
+
};
|
117
|
+
jsts.noding.NodedSegmentString.prototype.getCoordinate = function(i) {
|
118
|
+
return this.pts[i];
|
119
|
+
};
|
120
|
+
jsts.noding.NodedSegmentString.prototype.getCoordinates = function() {
|
121
|
+
return this.pts;
|
122
|
+
};
|
123
|
+
|
124
|
+
jsts.noding.NodedSegmentString.prototype.isClosed = function() {
|
125
|
+
return this.pts[0].equals(this.pts[this.pts.length - 1]);
|
126
|
+
};
|
127
|
+
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Gets the octant of the segment starting at vertex <code>index</code>.
|
131
|
+
*
|
132
|
+
* @param index
|
133
|
+
* the index of the vertex starting the segment. Must not be the last
|
134
|
+
* index in the vertex list.
|
135
|
+
* @return the octant of the segment at the vertex.
|
136
|
+
*/
|
137
|
+
jsts.noding.NodedSegmentString.prototype.getSegmentOctant = function(index) {
|
138
|
+
if (index === this.pts.length - 1)
|
139
|
+
return -1;
|
140
|
+
return this.safeOctant(this.getCoordinate(index), this.getCoordinate(index + 1));
|
141
|
+
};
|
142
|
+
|
143
|
+
|
144
|
+
/**
|
145
|
+
* @private
|
146
|
+
*/
|
147
|
+
jsts.noding.NodedSegmentString.prototype.safeOctant = function(p0, p1) {
|
148
|
+
if (p0.equals2D(p1))
|
149
|
+
return 0;
|
150
|
+
return jsts.noding.Octant.octant(p0, p1);
|
151
|
+
};
|
152
|
+
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Adds EdgeIntersections for one or both intersections found for a segment of
|
156
|
+
* an edge to the edge intersection list.
|
157
|
+
*/
|
158
|
+
jsts.noding.NodedSegmentString.prototype.addIntersections = function(li,
|
159
|
+
segmentIndex, geomIndex) {
|
160
|
+
for (var i = 0; i < li.getIntersectionNum(); i++) {
|
161
|
+
this.addIntersection(li, segmentIndex, geomIndex, i);
|
162
|
+
}
|
163
|
+
};
|
164
|
+
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Add an SegmentNode for intersection intIndex. An intersection that falls
|
168
|
+
* exactly on a vertex of the SegmentString is normalized to use the higher of
|
169
|
+
* the two possible segmentIndexes
|
170
|
+
*/
|
171
|
+
jsts.noding.NodedSegmentString.prototype.addIntersection = function(li,
|
172
|
+
segmentIndex, geomIndex, intIndex) {
|
173
|
+
|
174
|
+
if (li instanceof jsts.geom.Coordinate) {
|
175
|
+
this.addIntersection2.apply(this, arguments);
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
|
179
|
+
var intPt = new jsts.geom.Coordinate(li.getIntersection(intIndex));
|
180
|
+
this.addIntersection2(intPt, segmentIndex);
|
181
|
+
};
|
182
|
+
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Adds an intersection node for a given point and segment to this segment
|
186
|
+
* string.
|
187
|
+
*
|
188
|
+
* @param {jsts.geom.Coordinate} intPt
|
189
|
+
* the location of the intersection.
|
190
|
+
* @param segmentIndex
|
191
|
+
* the index of the segment containing the intersection.
|
192
|
+
*/
|
193
|
+
jsts.noding.NodedSegmentString.prototype.addIntersection2 = function(intPt,
|
194
|
+
segmentIndex) {
|
195
|
+
this.addIntersectionNode(intPt, segmentIndex);
|
196
|
+
};
|
197
|
+
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Adds an intersection node for a given point and segment to this segment
|
201
|
+
* string. If an intersection already exists for this exact location, the
|
202
|
+
* existing node will be returned.
|
203
|
+
*
|
204
|
+
* @param {jsts.geom.Coordinate} intPt
|
205
|
+
* the location of the intersection.
|
206
|
+
* @param segmentIndex
|
207
|
+
* the index of the segment containing the intersection.
|
208
|
+
* @return {SegmentNode} the intersection node for the point.
|
209
|
+
*/
|
210
|
+
jsts.noding.NodedSegmentString.prototype.addIntersectionNode = function(intPt,
|
211
|
+
segmentIndex) {
|
212
|
+
var normalizedSegmentIndex = segmentIndex;
|
213
|
+
// normalize the intersection point location
|
214
|
+
var nextSegIndex = normalizedSegmentIndex + 1;
|
215
|
+
if (nextSegIndex < this.pts.length) {
|
216
|
+
var nextPt = this.pts[nextSegIndex];
|
217
|
+
|
218
|
+
// Normalize segment index if intPt falls on vertex
|
219
|
+
// The check for point equality is 2D only - Z values are ignored
|
220
|
+
if (intPt.equals2D(nextPt)) {
|
221
|
+
// Debug.println("normalized distance");
|
222
|
+
normalizedSegmentIndex = nextSegIndex;
|
223
|
+
}
|
224
|
+
}
|
225
|
+
/**
|
226
|
+
* Add the intersection point to edge intersection list.
|
227
|
+
*/
|
228
|
+
var ei = this.nodeList.add(intPt, normalizedSegmentIndex);
|
229
|
+
return ei;
|
230
|
+
};
|
231
|
+
|
232
|
+
jsts.noding.NodedSegmentString.prototype.toString = function() {
|
233
|
+
var geometryFactory = new jsts.geom.GeometryFactory();
|
234
|
+
return new jsts.io.WKTWriter().write(geometryFactory.createLineString(this.pts));
|
235
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/* Copyright (c) 2011 by The Authors.
|
2
|
+
* Published under the LGPL 2.1 license.
|
3
|
+
* See /license-notice.txt for the full text of the license notice.
|
4
|
+
* See /license.txt for the full text of the license.
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function() {
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Computes all intersections between segments in a set of
|
11
|
+
* {@link SegmentString}s. Intersections found are represented as
|
12
|
+
* {@link SegmentNode}s and added to the {@link SegmentString}s in which
|
13
|
+
* they occur. As a final step in the noding a new set of segment strings
|
14
|
+
* split at the nodes may be returned.
|
15
|
+
*
|
16
|
+
* @interface
|
17
|
+
*/
|
18
|
+
jsts.noding.Noder = function() {
|
19
|
+
|
20
|
+
};
|
21
|
+
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Computes the noding for a collection of {@link SegmentString}s. Some
|
25
|
+
* Noders may add all these nodes to the input SegmentStrings; others may only
|
26
|
+
* add some or none at all.
|
27
|
+
*
|
28
|
+
* @param {Array}
|
29
|
+
* segStrings a collection of {@link SegmentString}s to node.
|
30
|
+
*/
|
31
|
+
jsts.noding.Noder.prototype.computeNodes = jsts.abstractFunc;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Returns a {@link Collection} of fully noded {@link SegmentString}s. The
|
35
|
+
* SegmentStrings have the same context as their parent.
|
36
|
+
*
|
37
|
+
* @return {Array} a Collection of SegmentStrings.
|
38
|
+
*/
|
39
|
+
jsts.noding.Noder.prototype.getNodedSubstrings = jsts.abstractFunc;
|
40
|
+
|
41
|
+
})();
|
@@ -0,0 +1,84 @@
|
|
1
|
+
/* Copyright (c) 2011 by The Authors.
|
2
|
+
* Published under the LGPL 2.1 license.
|
3
|
+
* See /license-notice.txt for the full text of the license notice.
|
4
|
+
* See /license.txt for the full text of the license.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Methods for computing and working with octants of the Cartesian plane
|
11
|
+
* Octants are numbered as follows:
|
12
|
+
* <pre>
|
13
|
+
* \2|1/
|
14
|
+
* 3 \|/ 0
|
15
|
+
* ---+--
|
16
|
+
* 4 /|\ 7
|
17
|
+
* /5|6\
|
18
|
+
* <pre>
|
19
|
+
* If line segments lie along a coordinate axis, the octant is the lower of the two
|
20
|
+
* possible values.
|
21
|
+
*
|
22
|
+
* @constructor
|
23
|
+
*/
|
24
|
+
jsts.noding.Octant = function() {
|
25
|
+
throw jsts.error.AbstractMethodInvocationError();
|
26
|
+
};
|
27
|
+
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Returns the octant of a directed line segment (specified as x and y
|
31
|
+
* displacements, which cannot both be 0).
|
32
|
+
*/
|
33
|
+
jsts.noding.Octant.octant = function(dx, dy) {
|
34
|
+
if (dx instanceof jsts.geom.Coordinate) {
|
35
|
+
return jsts.noding.Octant.octant2.apply(this, arguments);
|
36
|
+
}
|
37
|
+
|
38
|
+
if (dx === 0.0 && dy === 0.0)
|
39
|
+
throw new jsts.error.IllegalArgumentError('Cannot compute the octant for point ( ' + dx + ', ' + dy + ' )');
|
40
|
+
|
41
|
+
var adx = Math.abs(dx);
|
42
|
+
var ady = Math.abs(dy);
|
43
|
+
|
44
|
+
if (dx >= 0) {
|
45
|
+
if (dy >= 0) {
|
46
|
+
if (adx >= ady)
|
47
|
+
return 0;
|
48
|
+
else
|
49
|
+
return 1;
|
50
|
+
}
|
51
|
+
else { // dy < 0
|
52
|
+
if (adx >= ady)
|
53
|
+
return 7;
|
54
|
+
else
|
55
|
+
return 6;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
else { // dx < 0
|
59
|
+
if (dy >= 0) {
|
60
|
+
if (adx >= ady)
|
61
|
+
return 3;
|
62
|
+
else
|
63
|
+
return 2;
|
64
|
+
}
|
65
|
+
else { // dy < 0
|
66
|
+
if (adx >= ady)
|
67
|
+
return 4;
|
68
|
+
else
|
69
|
+
return 5;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Returns the octant of a directed line segment from p0 to p1.
|
77
|
+
*/
|
78
|
+
jsts.noding.Octant.octant2 = function(p0, p1) {
|
79
|
+
var dx = p1.x - p0.x;
|
80
|
+
var dy = p1.y - p0.y;
|
81
|
+
if (dx === 0.0 && dy === 0.0)
|
82
|
+
throw new jsts.error.IllegalArgumentError('Cannot compute the octant for two identical points ' + p0);
|
83
|
+
return jsts.noding.Octant.octant(dx, dy);
|
84
|
+
};
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/* Copyright (c) 2011 by The Authors.
|
2
|
+
* Published under the LGPL 2.1 license.
|
3
|
+
* See /license-notice.txt for the full text of the license notice.
|
4
|
+
* See /license.txt for the full text of the license.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Allows comparing {@link Coordinate} arrays in an orientation-independent way.
|
10
|
+
*
|
11
|
+
* Creates a new {@link OrientedCoordinateArray} for the given
|
12
|
+
* {@link Coordinate} array.
|
13
|
+
*
|
14
|
+
* @param pts
|
15
|
+
* the coordinates to orient.
|
16
|
+
*/
|
17
|
+
jsts.noding.OrientedCoordinateArray = function(pts) {
|
18
|
+
this.pts = pts;
|
19
|
+
this._orientation = jsts.noding.OrientedCoordinateArray.orientation(pts);
|
20
|
+
};
|
21
|
+
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @type {Array.<Coordinate>}
|
25
|
+
* @private
|
26
|
+
*/
|
27
|
+
jsts.noding.OrientedCoordinateArray.prototype.pts = null;
|
28
|
+
|
29
|
+
|
30
|
+
/**
|
31
|
+
* @type {boolean}
|
32
|
+
* @private
|
33
|
+
*/
|
34
|
+
jsts.noding.OrientedCoordinateArray.prototype._orientation = undefined;
|
35
|
+
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Computes the canonical orientation for a coordinate array.
|
39
|
+
*
|
40
|
+
* @param {Array.
|
41
|
+
* <Coordinate>} pts the array to test.
|
42
|
+
* @return <code>true</code> if the points are oriented forwards.
|
43
|
+
* @return <code>false</code if the points are oriented in reverse.
|
44
|
+
* @private
|
45
|
+
*/
|
46
|
+
jsts.noding.OrientedCoordinateArray.orientation = function(pts) {
|
47
|
+
return jsts.geom.CoordinateArrays.increasingDirection(pts) === 1;
|
48
|
+
};
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Compares two {@link OrientedCoordinateArray}s for their relative order
|
52
|
+
*
|
53
|
+
* @return -1 this one is smaller.
|
54
|
+
* @return 0 the two objects are equal.
|
55
|
+
* @return 1 this one is greater.
|
56
|
+
*/
|
57
|
+
|
58
|
+
jsts.noding.OrientedCoordinateArray.prototype.compareTo = function(o1) {
|
59
|
+
var oca = o1;
|
60
|
+
var comp = jsts.noding.OrientedCoordinateArray.compareOriented(this.pts,
|
61
|
+
this._orientation, oca.pts, oca._orientation);
|
62
|
+
return comp;
|
63
|
+
};
|
64
|
+
|
65
|
+
|
66
|
+
/**
|
67
|
+
* @private
|
68
|
+
*/
|
69
|
+
jsts.noding.OrientedCoordinateArray.compareOriented = function(pts1,
|
70
|
+
orientation1, pts2, orientation2) {
|
71
|
+
var dir1 = orientation1 ? 1 : -1;
|
72
|
+
var dir2 = orientation2 ? 1 : -1;
|
73
|
+
var limit1 = orientation1 ? pts1.length : -1;
|
74
|
+
var limit2 = orientation2 ? pts2.length : -1;
|
75
|
+
|
76
|
+
var i1 = orientation1 ? 0 : pts1.length - 1;
|
77
|
+
var i2 = orientation2 ? 0 : pts2.length - 1;
|
78
|
+
var comp = 0;
|
79
|
+
while (true) {
|
80
|
+
var compPt = pts1[i1].compareTo(pts2[i2]);
|
81
|
+
if (compPt !== 0)
|
82
|
+
return compPt;
|
83
|
+
i1 += dir1;
|
84
|
+
i2 += dir2;
|
85
|
+
var done1 = i1 === limit1;
|
86
|
+
var done2 = i2 === limit2;
|
87
|
+
if (done1 && !done2)
|
88
|
+
return -1;
|
89
|
+
if (!done1 && done2)
|
90
|
+
return 1;
|
91
|
+
if (done1 && done2)
|
92
|
+
return 0;
|
93
|
+
}
|
94
|
+
};
|