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,294 @@
|
|
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
|
+
* Simplifies a buffer input line to remove concavities with shallow depth.
|
11
|
+
* <p>
|
12
|
+
* The most important benefit of doing this is to reduce the number of points
|
13
|
+
* and the complexity of shape which will be buffered. It also reduces the risk
|
14
|
+
* of gores created by the quantized fillet arcs (although this issue should be
|
15
|
+
* eliminated in any case by the offset curve generation logic).
|
16
|
+
* <p>
|
17
|
+
* A key aspect of the simplification is that it affects inside (concave or
|
18
|
+
* inward) corners only. Convex (outward) corners are preserved, since they are
|
19
|
+
* required to ensure that the generated buffer curve lies at the correct
|
20
|
+
* distance from the input geometry.
|
21
|
+
* <p>
|
22
|
+
* Another important heuristic used is that the end segments of the input are
|
23
|
+
* never simplified. This ensures that the client buffer code is able to
|
24
|
+
* generate end caps faithfully.
|
25
|
+
* <p>
|
26
|
+
* No attempt is made to avoid self-intersections in the output. This is
|
27
|
+
* acceptable for use for generating a buffer offset curve, since the buffer
|
28
|
+
* algorithm is insensitive to invalid polygonal geometry. However, this means
|
29
|
+
* that this algorithm cannot be used as a general-purpose polygon
|
30
|
+
* simplification technique.
|
31
|
+
*
|
32
|
+
* @constructor
|
33
|
+
*/
|
34
|
+
jsts.operation.buffer.BufferInputLineSimplifier = function(inputLine) {
|
35
|
+
this.inputLine = inputLine;
|
36
|
+
};
|
37
|
+
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Simplify the input coordinate list. If the distance tolerance is positive,
|
41
|
+
* concavities on the LEFT side of the line are simplified. If the supplied
|
42
|
+
* distance tolerance is negative, concavities on the RIGHT side of the line are
|
43
|
+
* simplified.
|
44
|
+
*
|
45
|
+
* @param inputLine
|
46
|
+
* the coordinate list to simplify.
|
47
|
+
* @param distanceTol
|
48
|
+
* simplification distance tolerance to use.
|
49
|
+
* @return the simplified coordinate list.
|
50
|
+
*/
|
51
|
+
jsts.operation.buffer.BufferInputLineSimplifier.simplify = function(inputLine,
|
52
|
+
distanceTol) {
|
53
|
+
var simp = new jsts.operation.buffer.BufferInputLineSimplifier(inputLine);
|
54
|
+
return simp.simplify(distanceTol);
|
55
|
+
};
|
56
|
+
|
57
|
+
|
58
|
+
/**
|
59
|
+
* @private
|
60
|
+
*/
|
61
|
+
jsts.operation.buffer.BufferInputLineSimplifier.INIT = 0;
|
62
|
+
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @private
|
66
|
+
*/
|
67
|
+
jsts.operation.buffer.BufferInputLineSimplifier.DELETE = 1;
|
68
|
+
|
69
|
+
|
70
|
+
/**
|
71
|
+
* @private
|
72
|
+
*/
|
73
|
+
jsts.operation.buffer.BufferInputLineSimplifier.KEEP = 1;
|
74
|
+
|
75
|
+
|
76
|
+
/**
|
77
|
+
* @private
|
78
|
+
*/
|
79
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.inputLine = null;
|
80
|
+
|
81
|
+
|
82
|
+
/**
|
83
|
+
* @private
|
84
|
+
*/
|
85
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.distanceTol = null;
|
86
|
+
|
87
|
+
|
88
|
+
/**
|
89
|
+
* @type {Array}
|
90
|
+
* @private
|
91
|
+
*/
|
92
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.isDeleted = null;
|
93
|
+
|
94
|
+
|
95
|
+
/**
|
96
|
+
* @private
|
97
|
+
*/
|
98
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.angleOrientation = jsts.algorithm.CGAlgorithms.COUNTERCLOCKWISE;
|
99
|
+
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Simplify the input coordinate list. If the distance tolerance is positive,
|
103
|
+
* concavities on the LEFT side of the line are simplified. If the supplied
|
104
|
+
* distance tolerance is negative, concavities on the RIGHT side of the line are
|
105
|
+
* simplified.
|
106
|
+
*
|
107
|
+
* @param distanceTol
|
108
|
+
* simplification distance tolerance to use.
|
109
|
+
* @return the simplified coordinate list.
|
110
|
+
*/
|
111
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.simplify = function(
|
112
|
+
distanceTol) {
|
113
|
+
this.distanceTol = Math.abs(distanceTol);
|
114
|
+
if (distanceTol < 0)
|
115
|
+
this.angleOrientation = jsts.algorithm.CGAlgorithms.CLOCKWISE;
|
116
|
+
|
117
|
+
// rely on fact that boolean array is filled with false value
|
118
|
+
this.isDeleted = [];
|
119
|
+
this.isDeleted.length = this.inputLine.length;
|
120
|
+
|
121
|
+
var isChanged = false;
|
122
|
+
do {
|
123
|
+
isChanged = this.deleteShallowConcavities();
|
124
|
+
} while (isChanged);
|
125
|
+
|
126
|
+
return this.collapseLine();
|
127
|
+
};
|
128
|
+
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Uses a sliding window containing 3 vertices to detect shallow angles in which
|
132
|
+
* the middle vertex can be deleted, since it does not affect the shape of the
|
133
|
+
* resulting buffer in a significant way.
|
134
|
+
*
|
135
|
+
* @return
|
136
|
+
* @private
|
137
|
+
*/
|
138
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.deleteShallowConcavities = function() {
|
139
|
+
/**
|
140
|
+
* Do not simplify end line segments of the line string. This ensures that end
|
141
|
+
* caps are generated consistently.
|
142
|
+
*/
|
143
|
+
var index = 1;
|
144
|
+
var maxIndex = this.inputLine.length - 1;
|
145
|
+
|
146
|
+
var midIndex = this.findNextNonDeletedIndex(index);
|
147
|
+
var lastIndex = this.findNextNonDeletedIndex(midIndex);
|
148
|
+
|
149
|
+
var isChanged = false;
|
150
|
+
while (lastIndex < this.inputLine.length) {
|
151
|
+
// test triple for shallow concavity
|
152
|
+
var isMiddleVertexDeleted = false;
|
153
|
+
if (this.isDeletable(index, midIndex, lastIndex, this.distanceTol)) {
|
154
|
+
this.isDeleted[midIndex] = jsts.operation.buffer.BufferInputLineSimplifier.DELETE;
|
155
|
+
isMiddleVertexDeleted = true;
|
156
|
+
isChanged = true;
|
157
|
+
}
|
158
|
+
// move simplification window forward
|
159
|
+
if (isMiddleVertexDeleted)
|
160
|
+
index = lastIndex;
|
161
|
+
else
|
162
|
+
index = midIndex;
|
163
|
+
|
164
|
+
midIndex = this.findNextNonDeletedIndex(index);
|
165
|
+
lastIndex = this.findNextNonDeletedIndex(midIndex);
|
166
|
+
}
|
167
|
+
return isChanged;
|
168
|
+
};
|
169
|
+
|
170
|
+
|
171
|
+
/**
|
172
|
+
* Finds the next non-deleted index, or the end of the point array if none
|
173
|
+
*
|
174
|
+
* @param index
|
175
|
+
* @return the next non-deleted index, if any.
|
176
|
+
* @return inputLine.length if there are no more non-deleted indices.
|
177
|
+
* @private
|
178
|
+
*/
|
179
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.findNextNonDeletedIndex = function(
|
180
|
+
index) {
|
181
|
+
var next = index + 1;
|
182
|
+
while (next < this.inputLine.length &&
|
183
|
+
this.isDeleted[next] === jsts.operation.buffer.BufferInputLineSimplifier.DELETE)
|
184
|
+
next++;
|
185
|
+
return next;
|
186
|
+
};
|
187
|
+
|
188
|
+
|
189
|
+
/**
|
190
|
+
* @private
|
191
|
+
*/
|
192
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.collapseLine = function() {
|
193
|
+
var coordList = [];
|
194
|
+
for (var i = 0; i < this.inputLine.length; i++) {
|
195
|
+
if (this.isDeleted[i] !== jsts.operation.buffer.BufferInputLineSimplifier.DELETE)
|
196
|
+
coordList.push(this.inputLine[i]);
|
197
|
+
}
|
198
|
+
|
199
|
+
return coordList;
|
200
|
+
};
|
201
|
+
|
202
|
+
|
203
|
+
/**
|
204
|
+
* @private
|
205
|
+
*/
|
206
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.isDeletable = function(
|
207
|
+
i0, i1, i2, distanceTol) {
|
208
|
+
var p0 = this.inputLine[i0];
|
209
|
+
var p1 = this.inputLine[i1];
|
210
|
+
var p2 = this.inputLine[i2];
|
211
|
+
|
212
|
+
if (!this.isConcave(p0, p1, p2))
|
213
|
+
return false;
|
214
|
+
if (!this.isShallow(p0, p1, p2, distanceTol))
|
215
|
+
return false;
|
216
|
+
|
217
|
+
return this.isShallowSampled(p0, p1, i0, i2, distanceTol);
|
218
|
+
};
|
219
|
+
|
220
|
+
|
221
|
+
/**
|
222
|
+
* @private
|
223
|
+
*/
|
224
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.isShallowConcavity = function(
|
225
|
+
p0, p1, p2, distanceTol) {
|
226
|
+
var orientation = jsts.algorithm.CGAlgorithms.computeOrientation(p0, p1, p2);
|
227
|
+
var isAngleToSimplify = (orientation === this.angleOrientation);
|
228
|
+
if (!isAngleToSimplify)
|
229
|
+
return false;
|
230
|
+
|
231
|
+
var dist = jsts.algorithm.CGAlgorithms.distancePointLine(p1, p0, p2);
|
232
|
+
return dist < distanceTol;
|
233
|
+
};
|
234
|
+
|
235
|
+
|
236
|
+
/**
|
237
|
+
* @private
|
238
|
+
*/
|
239
|
+
jsts.operation.buffer.BufferInputLineSimplifier.NUM_PTS_TO_CHECK = 10;
|
240
|
+
|
241
|
+
|
242
|
+
/**
|
243
|
+
* Checks for shallowness over a sample of points in the given section. This
|
244
|
+
* helps prevents the siplification from incrementally "skipping" over points
|
245
|
+
* which are in fact non-shallow.
|
246
|
+
*
|
247
|
+
* @param p0
|
248
|
+
* start coordinate of section.
|
249
|
+
* @param p2
|
250
|
+
* end coordinate of section.
|
251
|
+
* @param i0
|
252
|
+
* start index of section.
|
253
|
+
* @param i2
|
254
|
+
* end index of section.
|
255
|
+
* @param distanceTol
|
256
|
+
* distance tolerance.
|
257
|
+
* @return
|
258
|
+
* @private
|
259
|
+
*/
|
260
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.isShallowSampled = function(
|
261
|
+
p0, p2, i0, i2, distanceTol) {
|
262
|
+
// check every n'th point to see if it is within tolerance
|
263
|
+
var inc = parseInt((i2 - i0) /
|
264
|
+
jsts.operation.buffer.BufferInputLineSimplifier.NUM_PTS_TO_CHECK);
|
265
|
+
if (inc <= 0)
|
266
|
+
inc = 1;
|
267
|
+
|
268
|
+
for (var i = i0; i < i2; i += inc) {
|
269
|
+
if (!this.isShallow(p0, p2, this.inputLine[i], distanceTol))
|
270
|
+
return false;
|
271
|
+
}
|
272
|
+
return true;
|
273
|
+
};
|
274
|
+
|
275
|
+
|
276
|
+
/**
|
277
|
+
* @private
|
278
|
+
*/
|
279
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.isShallow = function(
|
280
|
+
p0, p1, p2, distanceTol) {
|
281
|
+
var dist = jsts.algorithm.CGAlgorithms.distancePointLine(p1, p0, p2);
|
282
|
+
return dist < distanceTol;
|
283
|
+
};
|
284
|
+
|
285
|
+
|
286
|
+
/**
|
287
|
+
* @private
|
288
|
+
*/
|
289
|
+
jsts.operation.buffer.BufferInputLineSimplifier.prototype.isConcave = function(
|
290
|
+
p0, p1, p2) {
|
291
|
+
var orientation = jsts.algorithm.CGAlgorithms.computeOrientation(p0, p1, p2);
|
292
|
+
var isConcave = (orientation === this.angleOrientation);
|
293
|
+
return isConcave;
|
294
|
+
};
|
@@ -0,0 +1,340 @@
|
|
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
|
+
* Computes the buffer of a geometry, for both positive and negative buffer
|
9
|
+
* distances.
|
10
|
+
*
|
11
|
+
* In GIS, the positive buffer of a geometry is defined as
|
12
|
+
* the Minkowski sum or difference of the geometry
|
13
|
+
* with a circle of radius equal to the absolute value of the buffer distance.
|
14
|
+
* In the CAD/CAM world buffers are known as </i>offset curves</i>.
|
15
|
+
* In morphological analysis they are known as <i>erosion</i> and
|
16
|
+
* <i>dilation</i>
|
17
|
+
*
|
18
|
+
* The buffer operation always returns a polygonal result.
|
19
|
+
* The negative or zero-distance buffer of lines and points is always an empty
|
20
|
+
* {@link Polygon}.
|
21
|
+
*
|
22
|
+
* Since true buffer curves may contain circular arcs,
|
23
|
+
* computed buffer polygons can only be approximations to the true geometry.
|
24
|
+
* The user can control the accuracy of the curve approximation by specifying
|
25
|
+
* the number of linear segments used to approximate curves.
|
26
|
+
*
|
27
|
+
* The <b>end cap style</b> of a linear buffer may be specified. The
|
28
|
+
* following end cap styles are supported:
|
29
|
+
* <ul
|
30
|
+
* <li>{@link #CAP_ROUND} - the usual round end caps
|
31
|
+
* <li>{@link #CAP_BUTT} - end caps are truncated flat at the line ends
|
32
|
+
* <li>{@link #CAP_SQUARE} - end caps are squared off at the buffer distance
|
33
|
+
* beyond the line ends
|
34
|
+
* </ul>
|
35
|
+
*
|
36
|
+
*/
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Initializes a buffer computation for the given geometry with the given set of
|
42
|
+
* parameters.
|
43
|
+
*
|
44
|
+
* @param {Geometry}
|
45
|
+
* g the geometry to buffer.
|
46
|
+
* @param {BufferParameters}
|
47
|
+
* bufParams the buffer parameters to use.
|
48
|
+
* @constructor
|
49
|
+
*/
|
50
|
+
jsts.operation.buffer.BufferOp = function(g, bufParams) {
|
51
|
+
this.argGeom = g;
|
52
|
+
this.bufParams = bufParams ? bufParams
|
53
|
+
: new jsts.operation.buffer.BufferParameters();
|
54
|
+
};
|
55
|
+
|
56
|
+
|
57
|
+
/**
|
58
|
+
* A number of digits of precision which leaves some computational "headroom"
|
59
|
+
* for floating point operations.
|
60
|
+
*
|
61
|
+
* This value should be less than the decimal precision of double-precision
|
62
|
+
* values (16).
|
63
|
+
*
|
64
|
+
* @type {int}
|
65
|
+
*/
|
66
|
+
jsts.operation.buffer.BufferOp.MAX_PRECISION_DIGITS = 12;
|
67
|
+
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Compute a scale factor to limit the precision of a given combination of
|
71
|
+
* Geometry and buffer distance. The scale factor is determined by a combination
|
72
|
+
* of the number of digits of precision in the (geometry + buffer distance),
|
73
|
+
* limited by the supplied <code>maxPrecisionDigits</code> value.
|
74
|
+
*
|
75
|
+
* @param {Geometry}
|
76
|
+
* g the Geometry being buffered.
|
77
|
+
* @param {double}
|
78
|
+
* distance the buffer distance.
|
79
|
+
* @param {int}
|
80
|
+
* maxPrecisionDigits the max # of digits that should be allowed by the
|
81
|
+
* precision determined by the computed scale factor.
|
82
|
+
*
|
83
|
+
* @return {double} a scale factor for the buffer computation.
|
84
|
+
*/
|
85
|
+
jsts.operation.buffer.BufferOp.precisionScaleFactor = function(g, distance,
|
86
|
+
maxPrecisionDigits) {
|
87
|
+
var env = g.getEnvelopeInternal();
|
88
|
+
var envSize = Math.max(env.getHeight(), env.getWidth());
|
89
|
+
var expandByDistance = distance > 0.0 ? distance : 0.0;
|
90
|
+
var bufEnvSize = envSize + 2 * expandByDistance;
|
91
|
+
|
92
|
+
// the smallest power of 10 greater than the buffer envelope
|
93
|
+
var bufEnvLog10 = (Math.log(bufEnvSize) / Math.log(10) + 1.0);
|
94
|
+
var minUnitLog10 = bufEnvLog10 - maxPrecisionDigits;
|
95
|
+
// scale factor is inverse of min Unit size, so flip sign of exponent
|
96
|
+
var scaleFactor = Math.pow(10.0, -minUnitLog10);
|
97
|
+
return scaleFactor;
|
98
|
+
};
|
99
|
+
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Computes the buffer of a geometry for a given buffer distance.
|
103
|
+
*
|
104
|
+
* @param {Geometry}
|
105
|
+
* g the geometry to buffer.
|
106
|
+
* @param {double}
|
107
|
+
* distance the buffer distance.
|
108
|
+
* @return {Geometry} the buffer of the input geometry.
|
109
|
+
*/
|
110
|
+
jsts.operation.buffer.BufferOp.bufferOp = function(g, distance) {
|
111
|
+
if (arguments.length > 2) {
|
112
|
+
return jsts.operation.buffer.BufferOp.bufferOp2.apply(this, arguments);
|
113
|
+
}
|
114
|
+
|
115
|
+
var gBuf = new jsts.operation.buffer.BufferOp(g);
|
116
|
+
var geomBuf = gBuf.getResultGeometry(distance);
|
117
|
+
return geomBuf;
|
118
|
+
};
|
119
|
+
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Computes the buffer for a geometry for a given buffer distance and accuracy
|
123
|
+
* of approximation.
|
124
|
+
*
|
125
|
+
* @param {Geometry}
|
126
|
+
* g the geometry to buffer.
|
127
|
+
* @param {double}
|
128
|
+
* distance the buffer distance.
|
129
|
+
* @param {BufferParameters}
|
130
|
+
* params the buffer parameters to use.
|
131
|
+
* @return {Geometry} the buffer of the input geometry.
|
132
|
+
*
|
133
|
+
*/
|
134
|
+
jsts.operation.buffer.BufferOp.bufferOp2 = function(g, distance, params) {
|
135
|
+
if (arguments.length > 3) {
|
136
|
+
return jsts.operation.buffer.BufferOp.bufferOp3.apply(this, arguments);
|
137
|
+
}
|
138
|
+
|
139
|
+
var bufOp = new jsts.operation.buffer.BufferOp(g, params);
|
140
|
+
var geomBuf = bufOp.getResultGeometry(distance);
|
141
|
+
return geomBuf;
|
142
|
+
};
|
143
|
+
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Computes the buffer for a geometry for a given buffer distance and accuracy
|
147
|
+
* of approximation.
|
148
|
+
*
|
149
|
+
* @param {Geometry}
|
150
|
+
* g the geometry to buffer.
|
151
|
+
* @param {double}
|
152
|
+
* distance the buffer distance.
|
153
|
+
* @param {int}
|
154
|
+
* quadrantSegments the number of segments used to approximate a
|
155
|
+
* quarter circle.
|
156
|
+
* @return {Geometry} the buffer of the input geometry.
|
157
|
+
*
|
158
|
+
*/
|
159
|
+
jsts.operation.buffer.BufferOp.bufferOp3 = function(g, distance,
|
160
|
+
quadrantSegments) {
|
161
|
+
if (arguments.length > 4) {
|
162
|
+
return jsts.operation.buffer.BufferOp.bufferOp4.apply(this, arguments);
|
163
|
+
}
|
164
|
+
|
165
|
+
var bufOp = new jsts.operation.buffer.BufferOp(g);
|
166
|
+
bufOp.setQuadrantSegments(quadrantSegments);
|
167
|
+
var geomBuf = bufOp.getResultGeometry(distance);
|
168
|
+
return geomBuf;
|
169
|
+
};
|
170
|
+
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Computes the buffer for a geometry for a given buffer distance and accuracy
|
174
|
+
* of approximation.
|
175
|
+
*
|
176
|
+
* @param {Geometry}
|
177
|
+
* g the geometry to buffer.
|
178
|
+
* @param {double}
|
179
|
+
* distance the buffer distance.
|
180
|
+
* @param {int}
|
181
|
+
* quadrantSegments the number of segments used to approximate a
|
182
|
+
* quarter circle.
|
183
|
+
* @param {int}
|
184
|
+
* endCapStyle the end cap style to use.
|
185
|
+
* @return {Geometry} the buffer of the input geometry.
|
186
|
+
*
|
187
|
+
*/
|
188
|
+
jsts.operation.buffer.BufferOp.bufferOp4 = function(g, distance,
|
189
|
+
quadrantSegments, endCapStyle) {
|
190
|
+
var bufOp = new jsts.operation.buffer.BufferOp(g);
|
191
|
+
bufOp.setQuadrantSegments(quadrantSegments);
|
192
|
+
bufOp.setEndCapStyle(endCapStyle);
|
193
|
+
var geomBuf = bufOp.getResultGeometry(distance);
|
194
|
+
return geomBuf;
|
195
|
+
};
|
196
|
+
|
197
|
+
|
198
|
+
/**
|
199
|
+
* @type {Geometry}
|
200
|
+
*/
|
201
|
+
jsts.operation.buffer.BufferOp.prototype.argGeom = null;
|
202
|
+
|
203
|
+
|
204
|
+
/**
|
205
|
+
* @type {double}
|
206
|
+
*/
|
207
|
+
jsts.operation.buffer.BufferOp.prototype.distance = null;
|
208
|
+
|
209
|
+
|
210
|
+
/**
|
211
|
+
* @type {BufferParameters}
|
212
|
+
*/
|
213
|
+
jsts.operation.buffer.BufferOp.prototype.bufParams = null;
|
214
|
+
|
215
|
+
|
216
|
+
/**
|
217
|
+
* @type {Geometry}
|
218
|
+
*/
|
219
|
+
jsts.operation.buffer.BufferOp.prototype.resultGeometry = null;
|
220
|
+
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Specifies the end cap style of the generated buffer. The styles supported are
|
224
|
+
* {@link #CAP_ROUND}, {@link #CAP_BUTT}, and {@link #CAP_SQUARE}. The
|
225
|
+
* default is CAP_ROUND.
|
226
|
+
*
|
227
|
+
* @param {int}
|
228
|
+
* endCapStyle the end cap style to specify.
|
229
|
+
*/
|
230
|
+
jsts.operation.buffer.BufferOp.prototype.setEndCapStyle = function(endCapStyle) {
|
231
|
+
this.bufParams.setEndCapStyle(endCapStyle);
|
232
|
+
};
|
233
|
+
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Sets the number of segments used to approximate a angle fillet
|
237
|
+
*
|
238
|
+
* @param {int}
|
239
|
+
* quadrantSegments the number of segments in a fillet for a quadrant.
|
240
|
+
*/
|
241
|
+
jsts.operation.buffer.BufferOp.prototype.setQuadrantSegments = function(
|
242
|
+
quadrantSegments) {
|
243
|
+
this.bufParams.setQuadrantSegments(quadrantSegments);
|
244
|
+
};
|
245
|
+
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Returns the buffer computed for a geometry for a given buffer distance.
|
249
|
+
*
|
250
|
+
* @param {double}
|
251
|
+
* dist the buffer distance.
|
252
|
+
* @return {Geometry} the buffer of the input geometry.
|
253
|
+
*/
|
254
|
+
jsts.operation.buffer.BufferOp.prototype.getResultGeometry = function(dist) {
|
255
|
+
this.distance = dist;
|
256
|
+
this.computeGeometry();
|
257
|
+
return this.resultGeometry;
|
258
|
+
};
|
259
|
+
|
260
|
+
jsts.operation.buffer.BufferOp.prototype.computeGeometry = function() {
|
261
|
+
this.bufferOriginalPrecision();
|
262
|
+
if (this.resultGeometry !== null) {
|
263
|
+
return;
|
264
|
+
}
|
265
|
+
|
266
|
+
var argPM = this.argGeom.getPrecisionModel();
|
267
|
+
if (argPM.getType() === jsts.geom.PrecisionModel.FIXED) {
|
268
|
+
this.bufferFixedPrecision(argPM);
|
269
|
+
} else {
|
270
|
+
this.bufferReducedPrecision();
|
271
|
+
}
|
272
|
+
};
|
273
|
+
|
274
|
+
|
275
|
+
jsts.operation.buffer.BufferOp.prototype.bufferReducedPrecision = function() {
|
276
|
+
var precDigits;
|
277
|
+
var saveException = null;
|
278
|
+
|
279
|
+
// try and compute with decreasing precision
|
280
|
+
for (precDigits = jsts.operation.buffer.BufferOp.MAX_PRECISION_DIGITS; precDigits >= 0; precDigits--) {
|
281
|
+
try {
|
282
|
+
this.bufferReducedPrecision2(precDigits);
|
283
|
+
} catch (/* TopologyException */ex) {
|
284
|
+
saveException = ex;
|
285
|
+
// don't propagate the exception - it will be detected by fact that
|
286
|
+
// resultGeometry is null
|
287
|
+
}
|
288
|
+
if (this.resultGeometry !== null) {
|
289
|
+
return;
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
// tried everything - have to bail
|
294
|
+
throw saveException;
|
295
|
+
};
|
296
|
+
|
297
|
+
|
298
|
+
jsts.operation.buffer.BufferOp.prototype.bufferOriginalPrecision = function() {
|
299
|
+
try {
|
300
|
+
// use fast noding by default
|
301
|
+
var bufBuilder = new jsts.operation.buffer.BufferBuilder(this.bufParams);
|
302
|
+
this.resultGeometry = bufBuilder.buffer(this.argGeom, this.distance);
|
303
|
+
} catch (e) {
|
304
|
+
// don't propagate the exception - it will be detected by fact that
|
305
|
+
// resultGeometry is null
|
306
|
+
}
|
307
|
+
};
|
308
|
+
|
309
|
+
|
310
|
+
/**
|
311
|
+
* @param {int}
|
312
|
+
* precisionDigits
|
313
|
+
*/
|
314
|
+
jsts.operation.buffer.BufferOp.prototype.bufferReducedPrecision2 = function(
|
315
|
+
precisionDigits) {
|
316
|
+
|
317
|
+
var sizeBasedScaleFactor = jsts.operation.buffer.BufferOp
|
318
|
+
.precisionScaleFactor(this.argGeom, this.distance, precisionDigits);
|
319
|
+
|
320
|
+
var fixedPM = new jsts.geom.PrecisionModel(sizeBasedScaleFactor);
|
321
|
+
this.bufferFixedPrecision(fixedPM);
|
322
|
+
};
|
323
|
+
|
324
|
+
|
325
|
+
/**
|
326
|
+
* @param {PrecisionModel}
|
327
|
+
* fixedPM
|
328
|
+
*/
|
329
|
+
jsts.operation.buffer.BufferOp.prototype.bufferFixedPrecision = function(
|
330
|
+
fixedPM) {
|
331
|
+
var noder = new jsts.noding.ScaledNoder(
|
332
|
+
new jsts.noding.snapround.MCIndexSnapRounder(
|
333
|
+
new jsts.geom.PrecisionModel(1.0)), fixedPM.getScale());
|
334
|
+
|
335
|
+
var bufBuilder = new jsts.operation.buffer.BufferBuilder(this.bufParams);
|
336
|
+
bufBuilder.setWorkingPrecisionModel(fixedPM);
|
337
|
+
bufBuilder.setNoder(noder);
|
338
|
+
// this may throw an exception, if robustness errors are encountered
|
339
|
+
this.resultGeometry = bufBuilder.buffer(this.argGeom, this.distance);
|
340
|
+
};
|