You are here

protected function WktGenerator::generateMultilinestring in Geofield 8

Generates a multilinestring coordinates.

Return value

string The structured multilinestring coordinates.

1 call to WktGenerator::generateMultilinestring()
WktGenerator::wktGenerateMultilinestring in src/WktGenerator.php
Returns a WKT format multilinestring feature.

File

src/WktGenerator.php, line 214

Class

WktGenerator
Helper class that generates WKT format geometries.

Namespace

Drupal\geofield

Code

protected function generateMultilinestring() {
  $start = $this
    ->randomPoint();
  $num = $this
    ->ddGenerate(1, 3, TRUE);
  $lines[] = $this
    ->buildLinestring($this
    ->generateLinestring($start));
  for ($i = 0; $i < $num; $i += 1) {
    $diff = $this
      ->randomPoint();
    $start[0] += $diff[0] / 100;
    $start[1] += $diff[1] / 100;
    $lines[] = $this
      ->buildLinestring($this
      ->generateLinestring($start));
  }
  return $this
    ->buildMultiCoordinates($lines);
}