Create a multi column line.

@param float $totalWidth
@param array $columns
@param int   $index
@param float $height
@param bool  $autoNewLine
@param int   $maxLines

@return Frame

@throws \Exception
430171
public function create($totalWidth, $columns, $index = 0, $height = 5.0)
    {

        $tooltip = $this->uiFactory->createTooltip();

        $totalCoef
            = ($totalWidth - 1) / array_reduce($columns, function ($carry, $item) {
                return $carry + $item['width'];
            });

        $frame = Frame::create();
        $postX = 1;
        foreach ($columns as $columnData) {
            $action = null;
            if (isset($columnData['action'])) {
                $action = $columnData['action'];
            }

            if (isset($columnData['title'])) {
                $element = $this->createTitleColumn($totalCoef, $columnData, $postX, $height, $action, $tooltip);
            }

            if (!isset($element)) {
                throw new \Exception('Element not found.');
            }

            $frame->addChild($element);
            $postX += $columnData["width"] * $totalCoef;
        }

        $line = $this->uiFactory->createLine(0, -$height);
        $line->setLength($totalWidth)->setStroke(0.33)->setColor("fff");

        $frame->addChild($line);

        return $frame;
    }
1144772
public function chooseLayoutAction(
        $externalNetworkId,
        $line_id,
        $seasonId,
        $externalRouteId
    ) {
        $this->isGranted('BUSINESS_CHOOSE_LAYOUT');
        $perimeterManager = $this->get('nmm.perimeter_manager');
        $perimeter = $perimeterManager->findOneByExternalNetworkId(
            $this->getUser()->getCustomer(),
            $externalNetworkId
        );
        $season = $this->get('canal_tp_mtt.season_manager')->getSeasonWithPerimeterAndSeasonId(
            $perimeter,
            $seasonId
        );
        $layoutConfigs = $this->get('canal_tp_mtt.layout_config')->findLayoutConfigByCustomer();

        $params = array(
            'externalNetworkId' => $externalNetworkId,
            'line_id'           => $line_id,
            'externalRouteId'   => $externalRouteId
        );
        $lineConfig = $this->get('canal_tp_mtt.line_manager')->getLineConfigWithSeasonByExternalLineId(
            $line_id,
            $season
        );

        $form = $this->createForm(
            new LineConfigType($layoutConfigs),
            $lineConfig,
            array(
                'action' => $this->getRequest()->getRequestUri()
            )
        );

        $form->handleRequest($this->getRequest());
        if ($form->isValid()) {
            return ($this->processForm($form, $season, $params, $line_id));
        } else {
            return $this->render(
                'CanalTPMttBundle:Line:chooseLayout.html.twig',
                array(
                    'form' => $form->createView()
                )
            );
        }
    }
1195615
public void setColumns(float leftLine[], float rightLine[]) {
        maxY = -10e20f;
        minY = 10e20f;
        setYLine(Math.max(leftLine[1], leftLine[leftLine.length - 1]));
        rightWall = convertColumn(rightLine);
        leftWall = convertColumn(leftLine);
        rectangularWidth = -1;
        rectangularMode = false;
    }
921808
private function getColumnByIndex(array $columns, int $index):? Column
    {
        $currentIndex = $index;

        if (!array_key_exists($currentIndex, $columns) && $currentIndex > 0) {
            $currentIndex = ($currentIndex % count($columns));
        }

        if (array_key_exists($currentIndex, $columns)) {
            return $columns[$currentIndex];
        }

        return null;
    }
54524
public function breakLine($sColumn, $length, $newNum)
    {
        $newPositions = [];
        foreach ($this->positions as $column => $position) {
            if ($column >= $sColumn) {
                $newColumn = $column + $length;
                $position->generated->line = $newNum;
                $position->generated->column = $newColumn;
                $newPositions[$newColumn] = $position;
                unset($this->positions[$column]);
            }
        }
        if (empty($newPositions)) {
            return null;
        }
        return new self($newNum, $newPositions);
    }
559443
public function setColumnWidths(array $widths)
    {
        $this->columnWidths = [];
        foreach ($widths as $index => $width) {
            $this->setColumnWidth($index, $width);
        }

        return $this;
    }
966286
public function setMultiple(array $columns)
    {
        foreach ($columns as $column => $value) {
            $this->set($column, $value);
        }

        return $this;
    }
274129
public void adjustBeginLineColumn (final int nNewLine, final int newCol)
  {
    int start = m_nTokenBegin;
    int newLine = nNewLine;
    int len;

    if (m_nBufpos >= m_nTokenBegin)
    {
      len = m_nBufpos - m_nTokenBegin + m_nInBuf + 1;
    }
    else
    {
      len = m_nBufsize - m_nTokenBegin + m_nBufpos + 1 + m_nInBuf;
    }

    int nIdx = 0;
    int j = 0;
    int nextColDiff = 0;
    int columnDiff = 0;

    while (true)
    {
      if (nIdx >= len)
        break;
      j = start % m_nBufsize;
      ++start;
      final int k = start % m_nBufsize;
      if (m_aBufLine[j] != m_aBufLine[k])
        break;

      m_aBufLine[j] = newLine;
      nextColDiff = columnDiff + m_aBufColumn[k] - m_aBufColumn[j];
      m_aBufColumn[j] = newCol + columnDiff;
      columnDiff = nextColDiff;
      nIdx++;
    }

    if (nIdx < len)
    {
      m_aBufLine[j] = newLine++;
      m_aBufColumn[j] = newCol + columnDiff;

      while (nIdx++ < len)
      {
        j = start % m_nBufsize;
        ++start;
        final int k = start % m_nBufsize;
        if (m_aBufLine[j] != m_aBufLine[k])
          m_aBufLine[j] = newLine++;
        else
          m_aBufLine[j] = newLine;
      }
    }

    m_nLine = m_aBufLine[j];
    m_nColumn = m_aBufColumn[j];
  }
313731
function animation($column, $columns) {
        let width = 0;
        chain().not($column).each(function () {
            width += $(this).outerWidth(true);
        });
        $columns.stop().animate({
            scrollLeft: width
        }, settings.delay, function () {
            const last = $columns.find(`.${namespace}-column:not(.${namespace}-collapse)`).last();
            // last[0].scrollIntoView(); // Scrolls vertically also unfortunately
            last[0].scrollLeft = width;
            if (settings.scroll) {
                settings.scroll.call(this, $column, $columns);
            }
        });
    }
141792
public function drawCellContainer($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $valign = "T")
    {
        // Add padding
        $padding = end($this->stylestack["padding"]);
        $toppad = $padding[0];
        $bottompad = $padding[2];

        // Add border and bg color
        $fill = end($this->stylestack["isfilling"]);
        $borderwidth = end($this->stylestack["border-width"]);
        $border = end($this->stylestack["border-style"]);
        if ($border != "none") {
            $border = 1;
        } else {
            $borderwidth = "false";
        }

        // Store current position so we can jump back after cell draw
        $x = $this->document->GetX();
        $y = $this->document->GetY();
        $this->document->MultiCell($w, $this->max_line_height, "", $borderwidth, false, $fill);
        $cell_height = $this->document->GetY() - $y;

        // Jump back
        $this->setPosition($x, $y);
    }
1233628
public static TileColumn createColumn(int index, String name,
			GeoPackageDataType type, Long max, boolean notNull,
			Object defaultValue) {
		return new TileColumn(index, name, type, max, notNull, defaultValue,
				false);
	}
1046127
public function setColumnMaxWidth(int $columnIndex, int $width): self
    {
        if (!$this->output->getFormatter() instanceof WrappableOutputFormatterInterface) {
            throw new \LogicException(sprintf('Setting a maximum column width is only supported when using a "%s" formatter, got "%s".', WrappableOutputFormatterInterface::class, \get_class($this->output->getFormatter())));
        }

        $this->columnMaxWidths[$columnIndex] = $width;

        return $this;
    }
76098
function setColumn($index, $params)
	{
		if (isset($this->columns[$index])) $this->columns[$index] = array_merge($this->columns[$index], $params);
		else $this->columns[$index] = $params;
	}
730664
public function write() {
        // Determine the width of the last column.
        $columnWidths = array_sum($this->columnWidths);
        $totalWidth = $this->indent + $columnWidths + $this->padding * (count($this->columnWidths) - 1);

        $lastWidth = end($this->columnWidths) + $this->maxWidth - $totalWidth;
        $lastWidth = max($lastWidth, 10); // min width of 10
        $this->columnWidths[count($this->columnWidths) - 1] = $lastWidth;

        // Loop through each row and write it.
        foreach ($this->rows as $row) {
            $rowLines = [];
            $lineCount = 0;

            // Split the cells into lines.
            foreach ($row as $i => $cell) {
                list($text,) = $cell;
                $width = $this->columnWidths[$i];

                $lines = Cli::breakLines($text, $width, $i < count($this->columnWidths) - 1);
                $rowLines[] = $lines;
                $lineCount = max($lineCount, count($lines));
            }

            // Write all of the lines.
            for ($i = 0; $i < $lineCount; $i++) {
                foreach ($rowLines as $j => $lines) {
                    $padding = $j === 0 ? $this->indent : $this->padding;

                    if (isset($lines[$i])) {
                        if ($this->formatOutput) {
                            if(isset($row[$j])) {
                                $wrap = $row[$j][1];
                            } else {
                                // if we're out of array, use the latest wraps
                                $wrap = $row[count($row)-1][1];
                            }

                            echo str_repeat(' ', $padding).$wrap[0].$lines[$i].$wrap[1];
                        } else {
                            echo str_repeat(' ', $padding).$lines[$i];
                        }
                    } elseif ($j < count($this->columnWidths) - 1) {
                        // This is an empty line. Write the spaces.
                        echo str_repeat(' ', $padding + $this->columnWidths[$j]);
                    }
                }
                echo PHP_EOL;
            }
        }
    }
168359
def splitIntoLines(self, maxWidth, maxHeight, splitted=False):
        
        self.lines = []
        self.height = 0
        self.maxWidth = self.width = maxWidth
        self.maxHeight = maxHeight
        boxStack = []

        style = self.style
        x = 0

        # Start with indent in first line of text
        if not splitted:
            x = style["textIndent"]

        lenText = len(self)
        pos = 0
        while pos < lenText:

            # Reset values for new line
            posBegin = pos
            line = Line(style)

            # Update boxes for next line
            for box in copy.copy(boxStack):
                box["x"] = 0
                line.append(BoxBegin(box))

            while pos < lenText:

                # Get fragment, its width and set X
                frag = self[pos]
                fragWidth = frag["width"]
                frag["x"] = x
                pos += 1

                # Keep in mind boxes for next lines
                if isinstance(frag, BoxBegin):
                    boxStack.append(frag)
                elif isinstance(frag, BoxEnd):
                    boxStack.pop()

                # If space or linebreak handle special way
                if frag.isSoft:
                    if frag.isLF:
                        line.append(frag)
                        break
                        # First element of line should not be a space
                    if x == 0:
                        continue
                        # Keep in mind last possible line break

                # The elements exceed the current line
                elif fragWidth + x > maxWidth:
                    break

                # Add fragment to line and update x
                x += fragWidth
                line.append(frag)

            # Remove trailing white spaces
            while line and line[-1].name in ("space", "br"):
                line.pop()

            # Add line to list
            line.dumpFragments()
            # if line:
            self.height += line.doLayout(self.width)
            self.lines.append(line)

            # If not enough space for current line force to split
            if self.height > maxHeight:
                return posBegin

            # Reset variables
            x = 0

        # Apply alignment
        self.lines[- 1].isLast = True
        for line in self.lines:
            line.doAlignment(maxWidth, style["textAlign"])

        return None
1285554
protected function lexBlockString(int $line, int $column, Token $prev): Token
    {
        $start          = $this->position;
        $this->position = $start + 3; // skip the triple-quote
        $chunkStart     = $this->position;
        $rawValue       = '';

        while ($this->position < $this->bodyLength) {
            $code = $this->readCharCode($this->position);

            // Closing Triple-Quote (""")
            if ($this->isTripleQuote($code)) {
                $rawValue .= sliceString($this->body, $chunkStart, $this->position);
                return new Token(
                    TokenKindEnum::BLOCK_STRING,
                    $start,
                    $this->position + 3,
                    $line,
                    $column,
                    $prev,
                    blockStringValue($rawValue)
                );
            }

            if (isSourceCharacter($code) && !isLineTerminator($code)) {
                throw $this->createSyntaxErrorException(
                    \sprintf('Invalid character within String: %s.', printCharCode($code))
                );
            }

            if ($this->isEscapedTripleQuote($code)) {
                $rawValue       .= sliceString($this->body, $chunkStart, $this->position) . '"""';
                $this->position += 4;
                $chunkStart     = $this->position;
            } else {
                ++$this->position;
            }
        }

        throw $this->createSyntaxErrorException('Unterminated string.');
    }
522436
public static TileColumn createTileRowColumn(int index) {
		return new TileColumn(index, TileTable.COLUMN_TILE_ROW,
				GeoPackageDataType.INTEGER, null, true, 0, false);
	}