/** * Copies a section of a {@link CoordinateSequence} to another {@link CoordinateSequence}. * The sequences must have the same dimension. * * @param src * @param srcPos * @param dest * @param destPos * @param length */ public static void copy(CoordinateSequence src, int srcPos, CoordinateSequence dest, int destPos, int length) { for (int i = 0; i < length; i++) { copyCoord(src, srcPos + i, dest, destPos + i); } }
/** * Copies a section of a {@link CoordinateSequence} to another {@link CoordinateSequence}. * The sequences may have different dimensions; * in this case only the common dimensions are copied. * * @param src the sequence to copy from * @param srcPos the position in the source sequence to start copying at * @param dest the sequence to copy to * @param destPos the position in the destination sequence to copy to * @param length the number of coordinates to copy */ public static void copy(CoordinateSequence src, int srcPos, CoordinateSequence dest, int destPos, int length) { for (int i = 0; i < length; i++) { copyCoord(src, srcPos + i, dest, destPos + i); } }
public LinearRing createLinearRing(CoordinateSequence cs) { if (cs.getCoordinate(0).equals(cs.getCoordinate(cs.size() - 1))) return super.createLinearRing(cs); // add a new coordinate to close the ring CoordinateSequenceFactory csFact = getCoordinateSequenceFactory(); CoordinateSequence csNew = csFact.create(cs.size() + 1, cs.getDimension()); CoordinateSequences.copy(cs, 0, csNew, 0, cs.size()); CoordinateSequences.copyCoord(csNew, 0, csNew, csNew.size() - 1); return super.createLinearRing(csNew); }
public LinearRing createLinearRing(CoordinateSequence cs) { if (cs.getCoordinate(0).equals(cs.getCoordinate(cs.size() - 1))) return super.createLinearRing(cs); // add a new coordinate to close the ring CoordinateSequenceFactory csFact = getCoordinateSequenceFactory(); CoordinateSequence csNew = csFact.create(cs.size() + 1, cs.getDimension()); CoordinateSequences.copy(cs, 0, csNew, 0, cs.size()); CoordinateSequences.copyCoord(csNew, 0, csNew, csNew.size() - 1); return super.createLinearRing(csNew); }