# all files / ol/geom/flat/ flip.js

11.76% Statements 2/17
0% Branches 0/4
0% Functions 0/1
11.76% Lines 2/17

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    341×

    1×

     goog.provide('ol.geom.flat.flip');

    /**
     * @param {Array.<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @param {Array.<number>=} opt_dest Destination.
     * @param {number=} opt_destOffset Destination offset.
     * @return {Array.<number>} Flat coordinates.
     */
    ol.geom.flat.flip.flipXY = function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
      var dest, destOffset;
      if (opt_dest !== undefined) {
        dest = opt_dest;
        destOffset = opt_destOffset !== undefined ? opt_destOffset : 0;
      } else {
        dest = [];
        destOffset = 0;
      }
      var j = offset;
      while (j < end) {
        var x = flatCoordinates[j++];
        dest[destOffset++] = flatCoordinates[j++];
        dest[destOffset++] = x;
        for (var k = 2; k < stride; ++k) {
          dest[destOffset++] = flatCoordinates[j++];
        }
      }
      dest.length = destOffset;
      return dest;
    };