Element#

class caf.viz.web.mapping.Element(template=None, template_name=None)#

Bases: object

Basic Element object that does nothing. Other Elements may inherit from this one.

Parameters:
  • template (str, default None) –

    A jinaj2-compatible template string for rendering the element. If None, template will be:

    {% for name, element in this._children.items() %}
    {{element.render(**kwargs)}}
    {% endfor %}
    

    so that all the element’s children are rendered.

  • template_name (str, default None) – If no template is provided, you can also provide a filename.

Methods

__init__([template, template_name])

add_child(child[, name, index])

Add a child.

add_children(child[, name, index])

Add a child.

add_to(parent[, name, index])

Add element to a parent.

get_bounds()

Computes the bounds of the object and all it's children in the form [[lat_min, lon_min], [lat_max, lon_max]].

get_name()

Returns a string representation of the object.

get_root()

Returns the root of the elements tree.

render(**kwargs)

Renders the HTML representation of the element.

save(outfile[, close_file])

Saves an Element into a file.

to_dict([depth, ordered])

Returns a dict representation of the object.

to_json([depth])

Returns a JSON representation of the object.