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

42.86% Statements 3/7
0% Branches 0/5
0% Functions 0/1
42.86% Lines 3/7

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    211×

    1×

    1×

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

    goog.require('ol.geom.flat.area');

    /**
     * Check if the linestring is a boundary.
     * @param {Array.<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @return {boolean} The linestring is a boundary.
     */
    ol.geom.flat.topology.lineStringIsClosed = function(flatCoordinates, offset, end, stride) {
      var lastCoord = end - stride;
      if (flatCoordinates[offset] === flatCoordinates[lastCoord] &&
          flatCoordinates[offset + 1] === flatCoordinates[lastCoord + 1] && (end - offset) / stride > 3) {
        return !!ol.geom.flat.area.linearRing(flatCoordinates, offset, end, stride);
      }
      return false;
    };