public CircularArcLinearizer(P p0, P p1, P p2, double threshold) { if (p0 == null || p1 == null | p2 == null) { throw new IllegalArgumentException(); } this.threshold = abs(threshold); this.p0 = p0; this.p1 = p1; this.p2 = p2; this.c = new Circle(p0, p1, p2, false); this.isCounterClockwise = NumericalMethods.isCounterClockwise(p0, p1, p2); this.builder = variableSized((Class<P>) p0.getClass()); }
private void startNewPointSequenceIfNotEmpty() { if (!sequenceIsEmpty) { positionSequences.add(currentBuilder.toPositionSequence()); currentBuilder = PositionSequenceBuilders.variableSized(this.geometry.getPositionClass()); sequenceIsEmpty = true; } }
public CountingPositionSequenceBuilder(CoordinateReferenceSystem<P> crs) { delegate = PositionSequenceBuilders.variableSized(crs.getPositionClass()); dim = crs.getCoordinateDimension(); }
public PositionSequence<P> linearizeCircle() { double angleIncr = acos((c.radius - threshold) / c.radius); PositionSequenceBuilder<P> builder = variableSized((Class<P>) p0.getClass()); double theta0 = angleInDirection(p0); double theta1 = angleInDirection(p1); builder.add(p0); AddPointsBetweenPolarCoordinates(theta0, theta1, p0, p1, angleIncr, builder); builder.add(p1); //TODO -- I'm not sure whether this actually works if the circle defined by the 3 positions is in clockwise direction // AddPointsBetweenPolarCoordinates(theta1, theta0 + 2 * Math.PI, p1, p0, angleIncr, builder, true); AddPointsBetweenPolarCoordinates(theta1, theta0, p1, p0, angleIncr, builder); builder.add(p0); return builder.toPositionSequence(); }
PositionSequenceBuilder<P> builder = variableSized((Class<P>) p0.getClass()); if (isCounterClockwise) { builder.add(p0);
@Override public void visit(LineString<P> lineString) { currentBuilder = PositionSequenceBuilders.variableSized(this.geometry.getPositionClass()); P lastAddedPoint = null; LineSegments<P> segments = new LineSegments<P>(lineString.getPositions());