The RTreeStyle class

A class handling styles for the RTree plotting facility, load it with

from librtree import RTreeStyle
class RTreeStyle

Bases: Deserialise

A Ruby wrapper around RTree styles, used in PostScript plotting.

classmethod from_json(json)

Create a new RTreeStyle instance from JSON string.

Parameters:

json (str) – the JSON string.

Return type:

RTreeStyle

classmethod from_list(levels)

Create a new RtreeStyle instance from list (or tuple) of appropriate dicts.

Parameters:

levels (list[dict[str, Any]]) – a list of dicts, this will be converted to JSON and read by from_json().

Return type:

RTreeStyle

style = RTreeStyle.from_list(
  [
    {
      'fill': {
        'rgb': (0.5, 0.5, 0.5)
      },
      'stroke': {
        'rgb': (0, 0, 1),
        'width': 3
      }
    }
  ]
)
classmethod json_read(io_arg)

Create a new Style instance from JSON.

Parameters:

io_arg (IOBase | Path | str) – the stream or path (string or object) from which to read JSON.

Return type:

RTreeStyle

style = RTreeStyle.json_read('file.style')