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,181 @@
|
|
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
|
+
* @requires jsts/util/Assert.js
|
11
|
+
*/
|
12
|
+
|
13
|
+
var Assert = jsts.util.Assert;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* A GraphComponent is the parent class for the objects' that form a graph.
|
17
|
+
* Each GraphComponent can carry a Label.
|
18
|
+
*
|
19
|
+
* @constructor
|
20
|
+
*/
|
21
|
+
jsts.geomgraph.GraphComponent = function(label) {
|
22
|
+
this.label = label;
|
23
|
+
};
|
24
|
+
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @type {Label}
|
28
|
+
* @protected
|
29
|
+
*/
|
30
|
+
jsts.geomgraph.GraphComponent.prototype.label = null;
|
31
|
+
|
32
|
+
|
33
|
+
/**
|
34
|
+
* isInResult indicates if this component has already been included in the
|
35
|
+
* result
|
36
|
+
*
|
37
|
+
* @type {boolean}
|
38
|
+
* @private
|
39
|
+
*/
|
40
|
+
jsts.geomgraph.GraphComponent.prototype._isInResult = false;
|
41
|
+
|
42
|
+
|
43
|
+
/**
|
44
|
+
* @type {boolean}
|
45
|
+
* @private
|
46
|
+
*/
|
47
|
+
jsts.geomgraph.GraphComponent.prototype._isCovered = false;
|
48
|
+
|
49
|
+
|
50
|
+
/**
|
51
|
+
* @type {boolean}
|
52
|
+
* @private
|
53
|
+
*/
|
54
|
+
jsts.geomgraph.GraphComponent.prototype._isCoveredSet = false;
|
55
|
+
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @type {boolean}
|
59
|
+
* @private
|
60
|
+
*/
|
61
|
+
jsts.geomgraph.GraphComponent.prototype._isVisited = false;
|
62
|
+
|
63
|
+
jsts.geomgraph.GraphComponent.prototype.getLabel = function() {
|
64
|
+
return this.label;
|
65
|
+
};
|
66
|
+
jsts.geomgraph.GraphComponent.prototype.setLabel = function(label) {
|
67
|
+
if (arguments.length === 2) {
|
68
|
+
this.setLabel2.apply(this, arguments);
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
|
72
|
+
this.label = label;
|
73
|
+
};
|
74
|
+
|
75
|
+
|
76
|
+
/**
|
77
|
+
* @param {boolean}
|
78
|
+
* isInResult
|
79
|
+
*/
|
80
|
+
jsts.geomgraph.GraphComponent.prototype.setInResult = function(isInResult) {
|
81
|
+
this._isInResult = isInResult;
|
82
|
+
};
|
83
|
+
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @return {boolean}
|
87
|
+
*/
|
88
|
+
jsts.geomgraph.GraphComponent.prototype.isInResult = function() {
|
89
|
+
return this._isInResult;
|
90
|
+
};
|
91
|
+
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @param {boolean}
|
95
|
+
* isCovered
|
96
|
+
*/
|
97
|
+
jsts.geomgraph.GraphComponent.prototype.setCovered = function(isCovered) {
|
98
|
+
this._isCovered = isCovered;
|
99
|
+
this._isCoveredSet = true;
|
100
|
+
};
|
101
|
+
|
102
|
+
|
103
|
+
/**
|
104
|
+
* @return {boolean}
|
105
|
+
*/
|
106
|
+
jsts.geomgraph.GraphComponent.prototype.isCovered = function() {
|
107
|
+
return this._isCovered;
|
108
|
+
};
|
109
|
+
|
110
|
+
|
111
|
+
/**
|
112
|
+
* @return {boolean}
|
113
|
+
*/
|
114
|
+
jsts.geomgraph.GraphComponent.prototype.isCoveredSet = function() {
|
115
|
+
return this._isCoveredSet;
|
116
|
+
};
|
117
|
+
|
118
|
+
|
119
|
+
/**
|
120
|
+
* @return {boolean}
|
121
|
+
*/
|
122
|
+
jsts.geomgraph.GraphComponent.prototype.isVisited = function() {
|
123
|
+
return this._isVisited;
|
124
|
+
};
|
125
|
+
|
126
|
+
|
127
|
+
/**
|
128
|
+
* @param {boolean}
|
129
|
+
* isVisited
|
130
|
+
*/
|
131
|
+
jsts.geomgraph.GraphComponent.prototype.setVisited = function(isVisited) {
|
132
|
+
this._isVisited = isVisited;
|
133
|
+
};
|
134
|
+
|
135
|
+
|
136
|
+
/**
|
137
|
+
* @return {Coordinate} a coordinate in this component (or null, if there are
|
138
|
+
* none).
|
139
|
+
*/
|
140
|
+
jsts.geomgraph.GraphComponent.prototype.getCoordinate = function() {
|
141
|
+
throw new jsts.error.AbstractMethodInvocationError();
|
142
|
+
};
|
143
|
+
|
144
|
+
|
145
|
+
/**
|
146
|
+
* compute the contribution to an IM for this component
|
147
|
+
*
|
148
|
+
* @param {IntersectionMatrix}
|
149
|
+
* im
|
150
|
+
* @protected
|
151
|
+
*/
|
152
|
+
jsts.geomgraph.GraphComponent.prototype.computeIM = function(im) {
|
153
|
+
throw new jsts.error.AbstractMethodInvocationError();
|
154
|
+
};
|
155
|
+
|
156
|
+
|
157
|
+
/**
|
158
|
+
* An isolated component is one that does not intersect or touch any other
|
159
|
+
* component. This is the case if the label has valid locations for only a
|
160
|
+
* single Geometry.
|
161
|
+
*
|
162
|
+
* @return true if this component is isolated.
|
163
|
+
*/
|
164
|
+
jsts.geomgraph.GraphComponent.prototype.isIsolated = function() {
|
165
|
+
throw new jsts.error.AbstractMethodInvocationError();
|
166
|
+
};
|
167
|
+
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Update the IM with the contribution for this component. A component only
|
171
|
+
* contributes if it has a labelling for both parent geometries
|
172
|
+
*
|
173
|
+
* @param {IntersectionMatrix}
|
174
|
+
* im
|
175
|
+
*/
|
176
|
+
jsts.geomgraph.GraphComponent.prototype.updateIM = function(im) {
|
177
|
+
Assert.isTrue(this.label.getGeometryCount() >= 2, 'found partial label');
|
178
|
+
this.computeIM(im);
|
179
|
+
};
|
180
|
+
|
181
|
+
})();
|
@@ -0,0 +1,316 @@
|
|
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
|
+
* @requires jsts/geomgraph/TopologyLocation.js
|
9
|
+
*/
|
10
|
+
|
11
|
+
/**
|
12
|
+
* A <code>Label</code> indicates the topological relationship of a component
|
13
|
+
* of a topology graph to a given <code>Geometry</code>. This class supports
|
14
|
+
* labels for relationships to two <code>Geometry</code>s, which is
|
15
|
+
* sufficient for algorithms for binary operations.
|
16
|
+
* <P>
|
17
|
+
* Topology graphs support the concept of labeling nodes and edges in the graph.
|
18
|
+
* The label of a node or edge specifies its topological relationship to one or
|
19
|
+
* more geometries. (In fact, since JTS operations have only two arguments
|
20
|
+
* labels are required for only two geometries). A label for a node or edge has
|
21
|
+
* one or two elements, depending on whether the node or edge occurs in one or
|
22
|
+
* both of the input <code>Geometry</code>s. Elements contain attributes
|
23
|
+
* which categorize the topological location of the node or edge relative to the
|
24
|
+
* parent <code>Geometry</code>; that is, whether the node or edge is in the
|
25
|
+
* interior, boundary or exterior of the <code>Geometry</code>. Attributes
|
26
|
+
* have a value from the set <code>{Interior, Boundary, Exterior}</code>. In
|
27
|
+
* a node each element has a single attribute <code><On></code>. For an
|
28
|
+
* edge each element has a triplet of attributes
|
29
|
+
* <code><Left, On, Right></code>.
|
30
|
+
* <P>
|
31
|
+
* It is up to the client code to associate the 0 and 1
|
32
|
+
* <code>TopologyLocation</code>s with specific geometries.
|
33
|
+
*
|
34
|
+
* @constructor
|
35
|
+
*/
|
36
|
+
jsts.geomgraph.Label = function() {
|
37
|
+
this.elt = [];
|
38
|
+
|
39
|
+
var geomIndex, onLoc, leftLoc, lbl, rightLoc;
|
40
|
+
if (arguments.length === 4) {
|
41
|
+
geomIndex = arguments[0];
|
42
|
+
onLoc = arguments[1];
|
43
|
+
leftLoc = arguments[2];
|
44
|
+
rightLoc = arguments[3];
|
45
|
+
this.elt[0] = new jsts.geomgraph.TopologyLocation(jsts.geom.Location.NONE,
|
46
|
+
jsts.geom.Location.NONE, jsts.geom.Location.NONE);
|
47
|
+
this.elt[1] = new jsts.geomgraph.TopologyLocation(jsts.geom.Location.NONE,
|
48
|
+
jsts.geom.Location.NONE, jsts.geom.Location.NONE);
|
49
|
+
this.elt[geomIndex].setLocations(onLoc, leftLoc, rightLoc);
|
50
|
+
} else if (arguments.length === 3) {
|
51
|
+
onLoc = arguments[0];
|
52
|
+
leftLoc = arguments[1];
|
53
|
+
rightLoc = arguments[2];
|
54
|
+
this.elt[0] = new jsts.geomgraph.TopologyLocation(onLoc, leftLoc, rightLoc);
|
55
|
+
this.elt[1] = new jsts.geomgraph.TopologyLocation(onLoc, leftLoc, rightLoc);
|
56
|
+
} else if (arguments.length === 2) {
|
57
|
+
geomIndex = arguments[0];
|
58
|
+
onLoc = arguments[1];
|
59
|
+
this.elt[0] = new jsts.geomgraph.TopologyLocation(jsts.geom.Location.NONE);
|
60
|
+
this.elt[1] = new jsts.geomgraph.TopologyLocation(jsts.geom.Location.NONE);
|
61
|
+
this.elt[geomIndex].setLocation(onLoc);
|
62
|
+
} else if (arguments[0] instanceof jsts.geomgraph.Label) {
|
63
|
+
lbl = arguments[0];
|
64
|
+
this.elt[0] = new jsts.geomgraph.TopologyLocation(lbl.elt[0]);
|
65
|
+
this.elt[1] = new jsts.geomgraph.TopologyLocation(lbl.elt[1]);
|
66
|
+
} else if (typeof arguments[0] === 'number') {
|
67
|
+
onLoc = arguments[0];
|
68
|
+
this.elt[0] = new jsts.geomgraph.TopologyLocation(onLoc);
|
69
|
+
this.elt[1] = new jsts.geomgraph.TopologyLocation(onLoc);
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
|
74
|
+
/**
|
75
|
+
* converts a Label to a Line label (that is, one with no side Locations)
|
76
|
+
*
|
77
|
+
* @param {label}
|
78
|
+
* label
|
79
|
+
* @return {Label}
|
80
|
+
*/
|
81
|
+
jsts.geomgraph.Label.toLineLabel = function(label) {
|
82
|
+
var i, lineLabel = new jsts.geomgraph.Label(jsts.geom.Location.NONE);
|
83
|
+
for (i = 0; i < 2; i++) {
|
84
|
+
lineLabel.setLocation(i, label.getLocation(i));
|
85
|
+
}
|
86
|
+
return lineLabel;
|
87
|
+
};
|
88
|
+
|
89
|
+
|
90
|
+
/**
|
91
|
+
* @type {TopologyLocation[]}
|
92
|
+
* @private
|
93
|
+
*/
|
94
|
+
jsts.geomgraph.Label.prototype.elt = null;
|
95
|
+
|
96
|
+
jsts.geomgraph.Label.prototype.flip = function() {
|
97
|
+
this.elt[0].flip();
|
98
|
+
this.elt[1].flip();
|
99
|
+
};
|
100
|
+
|
101
|
+
|
102
|
+
/**
|
103
|
+
* @param {int}
|
104
|
+
* geomIndex
|
105
|
+
* @param {int}
|
106
|
+
* posIndex
|
107
|
+
* @return {int}
|
108
|
+
*/
|
109
|
+
jsts.geomgraph.Label.prototype.getLocation = function(geomIndex, posIndex) {
|
110
|
+
if (arguments.length == 1) {
|
111
|
+
return this.getLocation2.apply(this, arguments);
|
112
|
+
}
|
113
|
+
return this.elt[geomIndex].get(posIndex);
|
114
|
+
};
|
115
|
+
|
116
|
+
|
117
|
+
/**
|
118
|
+
* @param {int}
|
119
|
+
* geomIndex
|
120
|
+
* @return {int}
|
121
|
+
*/
|
122
|
+
jsts.geomgraph.Label.prototype.getLocation2 = function(geomIndex) {
|
123
|
+
return this.elt[geomIndex].get(jsts.geomgraph.Position.ON);
|
124
|
+
};
|
125
|
+
|
126
|
+
|
127
|
+
/**
|
128
|
+
* @param {int}
|
129
|
+
* geomIndex
|
130
|
+
* @param {int}
|
131
|
+
* posIndex
|
132
|
+
* @param {int}
|
133
|
+
* location
|
134
|
+
*/
|
135
|
+
jsts.geomgraph.Label.prototype.setLocation = function(geomIndex, posIndex,
|
136
|
+
location) {
|
137
|
+
if (arguments.length == 2) {
|
138
|
+
this.setLocation2.apply(this, arguments);
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
|
142
|
+
this.elt[geomIndex].setLocation(posIndex, location);
|
143
|
+
};
|
144
|
+
|
145
|
+
|
146
|
+
/**
|
147
|
+
* @param {int}
|
148
|
+
* geomIndex
|
149
|
+
* @param {int}
|
150
|
+
* location
|
151
|
+
*/
|
152
|
+
jsts.geomgraph.Label.prototype.setLocation2 = function(geomIndex, location) {
|
153
|
+
this.elt[geomIndex].setLocation(jsts.geomgraph.Position.ON, location);
|
154
|
+
};
|
155
|
+
|
156
|
+
|
157
|
+
/**
|
158
|
+
* @param {int}
|
159
|
+
* geomIndex
|
160
|
+
* @param {int}
|
161
|
+
* location
|
162
|
+
*/
|
163
|
+
jsts.geomgraph.Label.prototype.setAllLocations = function(geomIndex, location) {
|
164
|
+
this.elt[geomIndex].setAllLocations(location);
|
165
|
+
};
|
166
|
+
|
167
|
+
|
168
|
+
/**
|
169
|
+
* @param {int}
|
170
|
+
* geomIndex
|
171
|
+
* @param {int}
|
172
|
+
* location
|
173
|
+
*/
|
174
|
+
jsts.geomgraph.Label.prototype.setAllLocationsIfNull = function(geomIndex,
|
175
|
+
location) {
|
176
|
+
if (arguments.length == 1) {
|
177
|
+
this.setAllLocationsIfNull2.apply(this, arguments);
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
|
181
|
+
this.elt[geomIndex].setAllLocationsIfNull(location);
|
182
|
+
};
|
183
|
+
|
184
|
+
|
185
|
+
/**
|
186
|
+
* @param {int}
|
187
|
+
* location
|
188
|
+
*/
|
189
|
+
jsts.geomgraph.Label.prototype.setAllLocationsIfNull2 = function(location) {
|
190
|
+
this.setAllLocationsIfNull(0, location);
|
191
|
+
this.setAllLocationsIfNull(1, location);
|
192
|
+
};
|
193
|
+
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Merge this label with another one. Merging updates any null attributes of
|
197
|
+
* this label with the attributes from lbl
|
198
|
+
*
|
199
|
+
* @param {Label}
|
200
|
+
* lbl
|
201
|
+
*/
|
202
|
+
jsts.geomgraph.Label.prototype.merge = function(lbl) {
|
203
|
+
var i;
|
204
|
+
for (i = 0; i < 2; i++) {
|
205
|
+
if (this.elt[i] === null && lbl.elt[i] !== null) {
|
206
|
+
this.elt[i] = new jsts.geomgraph.TopologyLocation(lbl.elt[i]);
|
207
|
+
} else {
|
208
|
+
this.elt[i].merge(lbl.elt[i]);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
};
|
212
|
+
|
213
|
+
|
214
|
+
/**
|
215
|
+
* @return {int}
|
216
|
+
*/
|
217
|
+
jsts.geomgraph.Label.prototype.getGeometryCount = function() {
|
218
|
+
var count = 0;
|
219
|
+
if (!this.elt[0].isNull()) {
|
220
|
+
count++;
|
221
|
+
}
|
222
|
+
if (!this.elt[1].isNull()) {
|
223
|
+
count++;
|
224
|
+
}
|
225
|
+
return count;
|
226
|
+
};
|
227
|
+
|
228
|
+
|
229
|
+
/**
|
230
|
+
* @param {int}
|
231
|
+
* geomIndex
|
232
|
+
* @return {boolean}
|
233
|
+
*/
|
234
|
+
jsts.geomgraph.Label.prototype.isNull = function(geomIndex) {
|
235
|
+
return this.elt[geomIndex].isNull();
|
236
|
+
};
|
237
|
+
|
238
|
+
|
239
|
+
/**
|
240
|
+
* @param {int}
|
241
|
+
* geomIndex
|
242
|
+
* @return {boolean}
|
243
|
+
*/
|
244
|
+
jsts.geomgraph.Label.prototype.isAnyNull = function(geomIndex) {
|
245
|
+
return this.elt[geomIndex].isAnyNull();
|
246
|
+
};
|
247
|
+
|
248
|
+
|
249
|
+
/**
|
250
|
+
* @return {boolean}
|
251
|
+
*/
|
252
|
+
jsts.geomgraph.Label.prototype.isArea = function() {
|
253
|
+
if (arguments.length == 1) {
|
254
|
+
return this.isArea2(arguments[0]);
|
255
|
+
}
|
256
|
+
|
257
|
+
return this.elt[0].isArea() || this.elt[1].isArea();
|
258
|
+
};
|
259
|
+
|
260
|
+
|
261
|
+
/**
|
262
|
+
* @param {int}
|
263
|
+
* geomIndex
|
264
|
+
* @return {boolean}
|
265
|
+
*/
|
266
|
+
jsts.geomgraph.Label.prototype.isArea2 = function(geomIndex) {
|
267
|
+
return this.elt[geomIndex].isArea();
|
268
|
+
};
|
269
|
+
|
270
|
+
|
271
|
+
/**
|
272
|
+
* @param {int}
|
273
|
+
* geomIndex
|
274
|
+
* @return {boolean}
|
275
|
+
*/
|
276
|
+
jsts.geomgraph.Label.prototype.isLine = function(geomIndex) {
|
277
|
+
return this.elt[geomIndex].isLine();
|
278
|
+
};
|
279
|
+
|
280
|
+
|
281
|
+
/**
|
282
|
+
* @param {Label}
|
283
|
+
* lbl
|
284
|
+
* @param {int}
|
285
|
+
* side
|
286
|
+
* @return {boolean}
|
287
|
+
*/
|
288
|
+
jsts.geomgraph.Label.prototype.isEqualOnSide = function(lbl, side) {
|
289
|
+
return this.elt[0].isEqualOnSide(lbl.elt[0], side) &&
|
290
|
+
this.elt[1].isEqualOnSide(lbl.elt[1], side);
|
291
|
+
};
|
292
|
+
|
293
|
+
|
294
|
+
/**
|
295
|
+
* @param {int}
|
296
|
+
* geomIndex
|
297
|
+
* @param {int}
|
298
|
+
* loc
|
299
|
+
* @return {boolean}
|
300
|
+
*/
|
301
|
+
jsts.geomgraph.Label.prototype.allPositionsEqual = function(geomIndex, loc) {
|
302
|
+
return this.elt[geomIndex].allPositionsEqual(loc);
|
303
|
+
};
|
304
|
+
|
305
|
+
|
306
|
+
/**
|
307
|
+
* Converts one GeometryLocation to a Line location
|
308
|
+
*
|
309
|
+
* @param {int}
|
310
|
+
* geomIndex
|
311
|
+
*/
|
312
|
+
jsts.geomgraph.Label.prototype.toLine = function(geomIndex) {
|
313
|
+
if (this.elt[geomIndex].isArea()) {
|
314
|
+
this.elt[geomIndex] = new jsts.geomgraph.TopologyLocation(this.elt[geomIndex].location[0]);
|
315
|
+
}
|
316
|
+
};
|