tensorbay.geometry.point_list#

The implementation of lists of the TensorBay 2D point.

class tensorbay.geometry.point_list.PointList2D(points=None)[source]#

Bases: tensorbay.utility.user.UserMutableSequence[tensorbay.geometry.point_list._T]

This class defines the concept of PointList2D.

PointList2D contains a list of 2D points.

Parameters

points – A list of 2D points.

classmethod loads(contents)[source]#

Load a PointList2D from a list of dictionaries.

Parameters

contents (Sequence[Mapping[str, float]]) –

A list of dictionaries containing the coordinates of the vertexes of the point list:

[
    {
        "x": ...
        "y": ...
    },
    ...
]

Returns

The loaded PointList2D object.

Return type

tensorbay.geometry.point_list._P

dumps()[source]#

Dumps a PointList2D into a point list.

Returns

A list of dictionaries containing the coordinates of the vertexes of the polygon within the point list.

Return type

List[Dict[str, float]]

bounds()[source]#

Calculate the bounds of point list.

Returns

The bounds of point list.

Return type

tensorbay.geometry.box.Box2D

class tensorbay.geometry.point_list.MultiPointList2D(point_lists=None)[source]#

Bases: tensorbay.utility.user.UserMutableSequence[tensorbay.geometry.point_list._L]

This class defines the concept of MultiPointList2D.

MultiPointList2D contains multiple 2D point lists.

Parameters

point_lists – A list of 2D point list.

classmethod loads(contents)[source]#

Loads a MultiPointList2D from the given contents.

Parameters

contents (Sequence[Sequence[Mapping[str, float]]]) –

A list of dictionary lists containing the coordinates of the vertexes of the multiple point lists:

[
    [
        {
            "x": ...
            "y": ...
        },
        ...
    ]
    ...
]

Returns

The loaded MultiPointList2D object.

Return type

tensorbay.geometry.point_list._P

dumps()[source]#

Dumps all the information of the MultiPointList2D.

Returns

All the information of the MultiPointList2D.

Return type

List[List[Dict[str, float]]]

bounds()[source]#

Calculate the bounds of multiple point lists.

Returns

The bounds of multiple point lists.

Return type

tensorbay.geometry.box.Box2D