File: rtree-svg2cpp.sh

package info (click to toggle)
mdds 3.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,828 kB
  • sloc: cpp: 21,913; exp: 6,696; makefile: 698; ansic: 616; python: 602; sh: 428; lisp: 8
file content (21 lines) | stat: -rwxr-xr-x 471 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

# SPDX-FileCopyrightText: 2025 Kohei Yoshida
#
# SPDX-License-Identifier: MIT

# Input file must be an svg exported from LibreOffice Draw.
# Each line consists of x, y, width and height in this order.

if [ -z "$1" ]; then
    echo "no input file."
    exit 1
fi

cat "$1" | grep BoundingBox \
    | sed \
    -e 's/.*x\=\"/{\ /g' \
    -e 's/\"\ y\=\"/, /g' \
    -e 's/\"\ width\=\"/, /g' \
    -e 's/\"\ height\=\"/, /g' \
    -e 's/\"\/>/\ },/g'