Displacement.py 1.3 KB
Newer Older
Jiahang Chen's avatar
Jiahang Chen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from ml.ml40.features.properties.values.value import Value


class Displacement(Value):
    def __init__(self, name="", identifier=""):
        super().__init__(
            name=name,
            identifier=identifier)
        self.__displacement = None
        self.__max_displacement = None
        self.__min_displacement = None

    @property
    def displacement(self):
        return self.__displacement

    @displacement.setter
    def displacement(self, value):
        self.__displacement = value

    @property
    def maxDisplacement(self):
        return self.__max_displacement

    @maxDisplacement.setter
    def maxDisplacement(self, value):
        self.__max_displacement = value

    @property
    def minDisplacement(self):
        return self.__min_displacement

    @minDisplacement.setter
    def minDisplacement(self, value):
        self.__min_displacement = value

    def to_json(self):
        self.__json_out = super().to_json()
        if self.displacement is not None:
            self.__json_out["displacement"] = self.displacement
        if self.minDisplacement is not None:
            self.__json_out["minDisplacement"] = self.minDisplacement
        if self.maxDisplacement is not None:
            self.__json_out["maxDisplacement"] = self.maxDisplacement

        return self.__json_out