parses the TMX shape definition and returns a corresponding array of me.Shape object
@name parseTMXShapes
@memberOf me.TMXObject
@private
@function
@return {me.Polygon[]|me.Line[]|me.Ellipse[]} an array of shape objects
179139
function parseTMXShapes() {
         var i = 0;
         var shapes = []; // add an ellipse shape

         if (this.isEllipse === true) {
           // ellipse coordinates are the center position, so set default to the corresonding radius
           shapes.push(new me.Ellipse(this.width / 2, this.height / 2, this.width, this.height).rotate(this.rotation));
         } // add a polygon
         else if (this.isPolygon === true) {
             shapes.push(new me.Polygon(0, 0, this.points).rotate(this.rotation));
           } // add a polyline
           else if (this.isPolyLine === true) {
               var p = this.points;
               var p1, p2;
               var segments = p.length - 1;

               for (i = 0; i < segments; i++) {
                 // clone the value before, as [i + 1]
                 // is reused later by the next segment
                 p1 = new me.Vector2d(p[i].x, p[i].y);
                 p2 = new me.Vector2d(p[i + 1].x, p[i + 1].y);

                 if (this.rotation !== 0) {
                   p1 = p1.rotate(this.rotation);
                   p2 = p2.rotate(this.rotation);
                 }

                 shapes.push(new me.Line(0, 0, [p1, p2]));
               }
             } // it's a rectangle, returns a polygon object anyway
             else {
                 shapes.push(new me.Polygon(0, 0, [new me.Vector2d(), new me.Vector2d(this.width, 0), new me.Vector2d(this.width, this.height), new me.Vector2d(0, this.height)]).rotate(this.rotation));
               } // Apply isometric projection


         if (this.orientation === "isometric") {
           for (i = 0; i < shapes.length; i++) {
             shapes[i].toIso();
           }
         }

         return shapes;
       }
1127613
function readMultiLineStringGeometry_(text) {
  console.assert(text.substring(0, 2) === 'L(');
  console.assert(text[text.length - 1] == ')');
  text = text.substring(2, text.length - 1);
  let flatCoordinates = [];
  const ends = [];
  const lineStrings = text.split('\'');
  for (let i = 0, ii = lineStrings.length; i < ii; ++i) {
    flatCoordinates = this.decodeCoordinates_(lineStrings[i], flatCoordinates);
    ends[i] = flatCoordinates.length;
  }
  return new olGeomMultiLineString(flatCoordinates, olGeomGeometryLayout.XY, ends);
}
1095200
function readMultiPolygonGeometry(object, arcs) {
  const coordinates = [];
  for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {
    // for each polygon
    const polyArray = object['arcs'][i];
    const ringCoords = [];
    for (let j = 0, jj = polyArray.length; j < jj; ++j) {
      // for each ring
      ringCoords[j] = concatenateArcs(polyArray[j], arcs);
    }
    coordinates[i] = ringCoords;
  }
  return new MultiPolygon(coordinates);
}
985541
def shapes(x):
  """"""
  def shape(x):
    try:
      return x.shape
    except Exception:  # pylint: disable=broad-except
      return []
  return nested_map(x, shape)
162826
function _parseVertex(line) {
        var vertex = JSON.parse(line);
        assert.ok(_smellsLikeAnElement(vertex));
        // A vertex is an object, i.e. a key,value map.
        // We don't sort the keys of the object, leaving that to jsonStableStringify below.
        // But a vertex values contain `property containers`, each of which may contain embedded arrays of elements.
        return _.mapValues(vertex, _sortPropertyContainers);
    }
125834
function(t) {

            var segments = this.segments;
            var numSegments = segments.length;
            if (numSegments === 0) return null; // if segments is an empty array

            var segmentIndex = t.segmentIndex;
            if (segmentIndex < 0) return segments[0].pointAtT(0);
            if (segmentIndex >= numSegments) return segments[numSegments - 1].pointAtT(1);

            var tValue = t.value;
            if (tValue < 0) tValue = 0;
            else if (tValue > 1) tValue = 1;

            return segments[segmentIndex].pointAtT(tValue);
        }
852367
function TMXMapInfo (opts) {
    this.tilesets = []
    this.layers = []
    this.objectGroups = []
    this.properties = {}
    this.tileProperties = {}
    this.filename = opts.filename || opts.file || ''

    this.parseXMLFile(opts)
}
34307
function() {

            var step = this.step;

            return {
                x: -step,
                y: -step,
                width: 2 * step,
                height: 2 * step
            };
        }
629254
function () {
    var elementFns = [];
    if (this.peekToken().text !== ']') {
      do {
        if (this.peek(']')) {
          // Support trailing commas per ES5.1.
          break;
        }
        var elementFn = this.expression();
        elementFns.push(elementFn);
      } while (this.expect(','));
    }
    this.consume(']');

    return extend(function $parseArrayLiteral(self, locals) {
      var array = [];
      for (var i = 0, ii = elementFns.length; i < ii; i++) {
        array.push(elementFns[i](self, locals));
      }
      return array;
    }, {
      literal: true,
      constant: elementFns.every(isConstant),
      inputs: elementFns
    });
  }
333556
function () {

		var data = this.data,
			length = data.length,
			lineWidth = this.options.lineWidth + this.borderWidth,
			normalizer = mathRound(lineWidth) % 2 / 2,
			path = [],
			M = 'M',
			L = 'L',
			prevArgs,
			pointArgs,
			i,
			d;

		for (i = 1; i < length; i++) {
			pointArgs = data[i].shapeArgs;
			prevArgs = data[i - 1].shapeArgs;

			d = [
				M,
				prevArgs.x + prevArgs.width, prevArgs.y + normalizer,
				L,
				pointArgs.x, prevArgs.y + normalizer
			];

			if (data[i - 1].y < 0) {
				d[2] += prevArgs.height;
				d[5] += prevArgs.height;
			}

			path = path.concat(d);
		}

		return path;
	}
395256
function() {
      var chunks = [];
      for (var i = 0, len = this.path.length; i < len; i++) {
        chunks.push(this.path[i].join(' '));
      }
      var path = chunks.join(' ');

      return [
        '<g transform="', this.getSvgTransform(), '">',
          '<path ',
            'width="', this.width, '" height="', this.height, '" ',
            'd="', path, '" ',
            'style="', this.getSvgStyles(), '" ',
            'transform="translate(', (-this.width / 2), ' ', (-this.height/2), ')" />',
        '</g>'
      ].join('');
    }
701948
function readMultiPolygonGeometry_(text) {
  console.assert(text.substring(0, 2) === 'A(');
  console.assert(text[text.length - 1] == ')');
  text = text.substring(2, text.length - 1);
  let flatCoordinates = [];
  const endss = [];
  const polygons = text.split(')(');
  for (let i = 0, ii = polygons.length; i < ii; ++i) {
    const rings = polygons[i].split('\'');
    const ends = endss[i] = [];
    for (let j = 0, jj = rings.length; j < jj; ++j) {
      flatCoordinates = this.decodeCoordinates_(rings[j], flatCoordinates);
      let end = flatCoordinates.length;
      if (j === 0) {
        flatCoordinates[end++] = flatCoordinates[0];
        flatCoordinates[end++] = flatCoordinates[1];
      } else {
        flatCoordinates[end++] = flatCoordinates[ends[j - 1]];
        flatCoordinates[end++] = flatCoordinates[ends[j - 1] + 1];
      }
      ends[j] = end;
    }
  }
  return new olGeomMultiPolygon(flatCoordinates, olGeomGeometryLayout.XY, endss);
}
161987
function parseMultiPolygonGeometry(coordinates) {
		var multiPolygonWkt = [];
		for (var i = 0; i < coordinates.length; i++) {
			multiPolygonWkt.push('(' + parsePolygonGeometry(coordinates[i]) + ')');
		}
		return multiPolygonWkt.join(', ');
	}
728034
function(array) {
				array = array || [];
				var i = 0;
				var l = this.vertices.length;
				for (var j=0;j<l;j++) {
					var v = this.vertices[j];
					array[i++] = v.x;
					array[i++] = v.y;
					array[i++] = v.z;
				}
				return array;
			}
238548
function getSnapOffset(event, axis) {
  var context = event.context,
      shape = event.shape,
      gridSnappingContext = context.gridSnappingContext || {},
      snapLocation = gridSnappingContext.snapLocation;

  if (!shape || !snapLocation) {
    return 0;
  }

  if (axis === 'x') {
    if (/left/.test(snapLocation)) {
      return -shape.width / 2;
    }

    if (/right/.test(snapLocation)) {
      return shape.width / 2;
    }
  } else {
    if (/top/.test(snapLocation)) {
      return -shape.height / 2;
    }

    if (/bottom/.test(snapLocation)) {
      return shape.height / 2;
    }
  }

  return 0;
}
1039654
function readPolygonGeometry_(text) {
  console.assert(text.substring(0, 2) === 'a(');
  console.assert(text[text.length - 1] == ')');
  text = text.substring(2, text.length - 1);
  let flatCoordinates = [];
  const ends = [];
  const rings = text.split('\'');
  for (let i = 0, ii = rings.length; i < ii; ++i) {
    flatCoordinates = this.decodeCoordinates_(rings[i], flatCoordinates);
    let end = flatCoordinates.length;
    if (i === 0) {
      flatCoordinates[end++] = flatCoordinates[0];
      flatCoordinates[end++] = flatCoordinates[1];
    } else {
      flatCoordinates[end++] = flatCoordinates[ends[i - 1]];
      flatCoordinates[end++] = flatCoordinates[ends[i - 1] + 1];
    }
    ends[i] = end;
  }
  return new olGeomPolygon(flatCoordinates, olGeomGeometryLayout.XY, ends);
}
854253
private static Point getIntersection(Shape shape,
                                         Line2D.Double line) {
        if (shape instanceof Ellipse2D) {
            return getEllipseIntersection(shape,
                                          line);
        } else if (shape instanceof Rectangle2D || shape instanceof Path2D) {
            return getShapeIntersection(shape,
                                        line);
        } else {
            // something strange
            return null;
        }
    }