The class VImage¶
The class VImage image represents vectorial images made of rectangles, circles and polygons.
- class vimage.VImage(title)¶
Class methods
- from_dict(name, dic)¶
Returns a vectorial image given its name and a dictionary that describes it.
- from_json(filename)¶
Returns a vectorial image stored in the given json file
Instance attributes:
Instance methods:
- add(figure)¶
Adds the given figure to the vectorial image and returns its newly created unique identifier
- remove(id)¶
Remove the figure with given id from the vectorial image
- to_dict()¶
Returns a dictionary describing the scene vectorial image
- bounding_box()¶
Returns the bounding box of the VImage (
Rectangle)
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.
The class VImage is implemented in the file vimage.py.
You can pass the tests of the following test files test-vimage.txt. You can find an example of json description of an image in vim1.json.