vkit.element.type

 1# Copyright 2022 vkit-x Administrator. All Rights Reserved.
 2#
 3# This project (vkit-x/vkit) is dual-licensed under commercial and SSPL licenses.
 4#
 5# The commercial license gives you the full rights to create and distribute software
 6# on your own terms without any SSPL license obligations. For more information,
 7# please see the "LICENSE_COMMERCIAL.txt" file.
 8#
 9# This project is also available under Server Side Public License (SSPL).
10# The SSPL licensing is ideal for use cases such as open source projects with
11# SSPL distribution, student/academic purposes, hobby projects, internal research
12# projects without external distribution, or other projects where all SSPL
13# obligations can be met. For more information, please see the "LICENSE_SSPL.txt" file.
14from typing import Tuple
15from enum import Enum, unique
16
17
18class Shapable:
19
20    @property
21    def height(self) -> int:
22        raise NotImplementedError()
23
24    @property
25    def width(self) -> int:
26        raise NotImplementedError()
27
28    @property
29    def area(self) -> int:
30        return self.height * self.width
31
32    @property
33    def shape(self) -> Tuple[int, int]:
34        return self.height, self.width
35
36
37@unique
38class ElementSetOperationMode(Enum):
39    # Active if overlapped with one or more elements.
40    UNION = 'union'
41    # Active if overlapped with one element.
42    DISTINCT = 'distinct'
43    # Active if overlapped with more than one elements.
44    INTERSECT = 'intersect'
class Shapable:
19class Shapable:
20
21    @property
22    def height(self) -> int:
23        raise NotImplementedError()
24
25    @property
26    def width(self) -> int:
27        raise NotImplementedError()
28
29    @property
30    def area(self) -> int:
31        return self.height * self.width
32
33    @property
34    def shape(self) -> Tuple[int, int]:
35        return self.height, self.width
Shapable()
class ElementSetOperationMode(enum.Enum):
39class ElementSetOperationMode(Enum):
40    # Active if overlapped with one or more elements.
41    UNION = 'union'
42    # Active if overlapped with one element.
43    DISTINCT = 'distinct'
44    # Active if overlapped with more than one elements.
45    INTERSECT = 'intersect'

An enumeration.

Inherited Members
enum.Enum
name
value