.. py:module:: vimage The class VImage =============== The class :py:class:`VImage` image represents vectorial images made of rectangles, circles and polygons. .. py:class:: VImage (title) .. rubric:: Class methods .. py:method:: from_dict(name, dic) Returns a vectorial image given its name and a dictionary that describes it. .. py:method:: from_json(filename) Returns a vectorial image stored in the given json file .. rubric:: Instance attributes: .. py:attribute:: name name of the image (:py:class:`str`) .. rubric:: Instance methods: .. py:method:: add(figure) Adds the given figure to the vectorial image and returns its newly created unique identifier .. py:method:: remove(id) Remove the figure with given id from the vectorial image .. py:method:: to_dict() Returns a dictionary describing the scene vectorial image .. py:method:: bounding_box() Returns the bounding box of the VImage (:py:class:`Rectangle`) .. py:rubric:: Supported operations +--------------------------+-------------------------------------------------+ | Operation | Result | +==========================+=================================================+ | ``vima[id]`` | Returns the figure with identifier `id` of | | | the vectorial image | +--------------------------+-------------------------------------------------+ Also supports the operator *in* that indicates if a figure with the given *id* is in the vectorial image. Supported functions: :py:func:`len`, :py:func:`iter` and :py:class:`str` The class :py:class:`VImage` is implemented in the file :download:`vimage.py `. You can pass the tests of the following test files :download:`test-vimage.txt `. You can find an example of json description of an image in :download:`vim1.json `.