/** * Creates a new <code>PositionSequence</code> with positions in reverse order. * * @return */ @Override public PositionSequence<P> reverse() { PositionSequence<P>[] childrenCopy = this.getChildren(); for (int i = 0; i < childrenCopy.length; i++){ childrenCopy[i] = childrenCopy[i].reverse(); } reverseInPlace(childrenCopy); return new NestedPositionSequence<P>(childrenCopy); }
/** * Creates a <code>Geometry</code> having as coordinates the coordinates of the input <code>Geometry</code> in reverse order. * * @param geometry the <code>Geometry</code> to reverse * @return a <code>Geometry</code> with the same coordinates as the specified input <code>Geometry</code> but in reverse order */ @Override public <P extends C2D, G extends Geometry<P>> G reverse(G geometry) { PositionSequence<P> pos = geometry.getPositions().reverse(); if (geometry instanceof Simple) { return (G)Geometries.mkGeometry((Class<? extends Simple>)geometry.getClass(), pos, geometry.getCoordinateReferenceSystem()); } else { Complex<P, ?> complex = (Complex<P, ?>) geometry; Geometry<P>[] geoms = complex.components(); reverseOrder(reverseAll(geoms)); return (G)Geometries.mkGeometry((Class<? extends Complex>)geometry.getClass(), geoms); } }
AddPointsBetweenPolarCoordinates(theta1, theta0, p1, p0, angleIncr, builder); builder.add(p0); return builder.toPositionSequence().reverse();