src/ol/format/TopoJSON.js
function concatenateArcs(indices, arcs) {
  /** @type {Array<import("../coordinate.js").Coordinate>} */
  const coordinates = [];
  let index, arc;
  for (let i = 0, ii = indices.length; i < ii; ++i) {
    index = indices[i];
    if (i > 0) {
      // splicing together arcs, discard last point
      coordinates.pop();
    }
    if (index >= 0) {
      // forward arc
      arc = arcs[index];
    } else {
      // reverse arc
      arc = arcs[~index].slice().reverse();
    }
    coordinates.push.apply(coordinates, arc);
  }
  // provide fresh copies of coordinate arrays
  for (let j = 0, jj = coordinates.length; j < jj; ++j) {
    coordinates[j] = coordinates[j].slice();
  }
  return coordinates;
}
function concatenateArcs(indices, arcs) {
  /** @type {Array<import("../coordinate.js").Coordinate>} */
  const coordinates = [];
  let index, arc;
  for (let i = 0, ii = indices.length; i < ii; ++i) {
    index = indices[i];
    if (i > 0) {
      // splicing together arcs, discard last point
      coordinates.pop();
    }
    if (index >= 0) {
      // forward arc
      arc = arcs[index];
    } else {
      // reverse arc
      arc = arcs[~index].slice().reverse();
    }
    coordinates.push.apply(coordinates, arc);
  }
  // provide fresh copies of coordinate arrays
  for (let j = 0, jj = coordinates.length; j < jj; ++j) {
    coordinates[j] = coordinates[j].slice();
  }
  return coordinates;
}
function concatenateArcs ( indices , arcs ) { /** @type {Array<import("../coordinate.js").Coordinate>} */ const coordinates = [ ] ; let index , arc ; for ( let i = 0 , ii = indices . length ; i < ii ; ++ i ) { index = indices [ i ] ; if ( i > 0 ) { // splicing together arcs, discard last point coordinates . pop ( ) ; } if ( index >= 0 ) { // forward arc arc = arcs [ index ] ; } else { // reverse arc arc = arcs [ ~ index ] . slice ( ) . reverse ( ) ; } coordinates . push . apply ( coordinates , arc ) ; } // provide fresh copies of coordinate arrays for ( let j = 0 , jj = coordinates . length ; j < jj ; ++ j ) { coordinates [ j ] = coordinates [ j ] . slice ( ) ; } return coordinates ; }
Concatenate arcs into a coordinate array.
@param {Array<number>} indices Indices of arcs to concatenate.  Negative
values indicate arcs need to be reversed.
@param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs (already
transformed).
@return {Array<import("../coordinate.js").Coordinate>} Coordinates array.
Concatenate arcs into a coordinate array .