示例#1
0
文件: project.py 项目: pcbre/pcbre
    def __init__(self, project: 'Project') -> None:
        self.__project = project

        self.__imagelayers: List[ImageLayer] = []
        self.__keypoints: List[KeyPoint] = []

        self.imagelayers = ImmutableListProxy(self.__imagelayers)
        self.keypoints = ImmutableListProxy(self.__keypoints)
示例#2
0
    def __init__(self, project):
        super(Stackup, self).__init__()

        self.__project = project
        self.__layers = []
        self.__via_pairs = []

        self.layers = ImmutableListProxy(self.__layers)
        self.via_pairs = ImmutableListProxy(self.__via_pairs)
示例#3
0
    def __init__(self, project):
        self.__project = project

        self.__imagelayers = []
        self.__keypoints = []
        """ :type : list[KeyPointPosition] """

        self.imagelayers = ImmutableListProxy(self.__imagelayers)
        self.keypoints = ImmutableListProxy(self.__keypoints)
示例#4
0
文件: project.py 项目: pcbre/pcbre
    def __init__(self, project: 'Project') -> None:
        super(Stackup, self).__init__()

        self.__project = project
        self.__layers: List[Layer] = []
        self.__via_pairs: List[ViaPair] = []

        self.layers = ImmutableListProxy(self.__layers)
        self.via_pairs = ImmutableListProxy(self.__via_pairs)
示例#5
0
文件: project.py 项目: balr0g/pcbre
    def __init__(self, project):
        self.__project = project

        self.__imagelayers = []
        self.__keypoints = []
        """ :type : list[KeyPointPosition] """

        self.imagelayers = ImmutableListProxy(self.__imagelayers)
        self.keypoints = ImmutableListProxy(self.__keypoints)
示例#6
0
    def __init__(self, project):
        super(Nets, self).__init__()

        self.__project = project

        self.__nets = list()
        self.__max_id = 0

        self.nets = ImmutableListProxy(self.__nets)
示例#7
0
文件: project.py 项目: pcbre/pcbre
    def __init__(self, project: 'Project') -> None:
        super(Nets, self).__init__()

        self.__project: Optional[Project] = project

        self.__nets: List[Net] = list()
        self.__max_id = 0

        self.nets = ImmutableListProxy(self.__nets)
示例#8
0
    def __init__(self):
        self._project = None
        self.__keypoint_positions = set()
        """:type: set[KeyPointPosition]"""

        self.keypoint_positions = ImmutableListProxy(self.__keypoint_positions)
示例#9
0
文件: project.py 项目: balr0g/pcbre
class Imagery:
    def __init__(self, project):
        self.__project = project

        self.__imagelayers = []
        self.__keypoints = []
        """ :type : list[KeyPointPosition] """

        self.imagelayers = ImmutableListProxy(self.__imagelayers)
        self.keypoints = ImmutableListProxy(self.__keypoints)

    def add_imagelayer(self, imagelayer):
        assert not imagelayer._project
        imagelayer._project = self.__project

        if imagelayer.alignment is not None:
            imagelayer.alignment._project = self.__project

        self.__imagelayers.append(imagelayer)

    def _order_for_layer(self, imagelayer):
        return self.__imagelayers.index(imagelayer)

    def _set_layer_order(self, imagelayer, n):
        self.__imagelayers.remove(imagelayer)
        self.__imagelayers.insert(n, imagelayer)

    def add_keypoint(self, kp):
        assert kp._project is None
        kp._project = self.__project
        self.__keypoints.append(kp)

    def del_keypoint(self, kp):
        """
        Remove a keypoint from the project
        :param kp: Keypoint to remove from the project
        :type kp: KeyPoint
        :return:
        """

        assert kp._project is self
        assert len(kp.layer_positions) == 0 # Verify that no layers use the keypoint

        kp._project = None

        self.__keypoints.remove(kp)

    def get_keypoint_index(self, kp):
        return self.keypoints.index(kp)


    def serialize(self):
        imagery = ser.Imagery.new_message()

        imagery.init("imagelayers", len(self.imagelayers))
        for n, i in enumerate(self.imagelayers):
            imagery.imagelayers[n] = i.serialize()

        imagery.init("keypoints", len(self.keypoints))

        for n, i in enumerate(self.keypoints):
            imagery.keypoints[n] = i.serialize()

        return imagery

    def deserialize(self, msg):
        # Keypoints may be used by the imagelayers during deserialize
        # Deserialize first to avoid a finalizer
        for i in msg.keypoints:
            self.__keypoints.append(KeyPoint.deserialize(self.__project, i))

        for i in msg.imagelayers:
            self.__imagelayers.append(ImageLayer.deserialize(self.__project, i))
示例#10
0
class Imagery:
    def __init__(self, project):
        self.__project = project

        self.__imagelayers = []
        self.__keypoints = []
        """ :type : list[KeyPointPosition] """

        self.imagelayers = ImmutableListProxy(self.__imagelayers)
        self.keypoints = ImmutableListProxy(self.__keypoints)

    def add_imagelayer(self, imagelayer):
        assert not imagelayer._project
        imagelayer._project = self.__project

        if imagelayer.alignment is not None:
            imagelayer.alignment._project = self.__project

        self.__imagelayers.append(imagelayer)

    def _order_for_layer(self, imagelayer):
        return self.__imagelayers.index(imagelayer)

    def _set_layer_order(self, imagelayer, n):
        self.__imagelayers.remove(imagelayer)
        self.__imagelayers.insert(n, imagelayer)

    def add_keypoint(self, kp):
        assert kp._project is None
        kp._project = self.__project
        self.__keypoints.append(kp)

    def del_keypoint(self, kp):
        """
        Remove a keypoint from the project
        :param kp: Keypoint to remove from the project
        :type kp: KeyPoint
        :return:
        """

        assert kp._project is self
        assert len(
            kp.layer_positions) == 0  # Verify that no layers use the keypoint

        kp._project = None

        self.__keypoints.remove(kp)

    def get_keypoint_index(self, kp):
        return self.keypoints.index(kp)

    def serialize(self):
        imagery = ser.Imagery.new_message()

        imagery.init("imagelayers", len(self.imagelayers))
        for n, i in enumerate(self.imagelayers):
            imagery.imagelayers[n] = i.serialize()

        imagery.init("keypoints", len(self.keypoints))

        for n, i in enumerate(self.keypoints):
            imagery.keypoints[n] = i.serialize()

        return imagery

    def deserialize(self, msg):
        # Keypoints may be used by the imagelayers during deserialize
        # Deserialize first to avoid a finalizer
        for i in msg.keypoints:
            self.__keypoints.append(KeyPoint.deserialize(self.__project, i))

        for i in msg.imagelayers:
            self.__imagelayers.append(ImageLayer.deserialize(
                self.__project, i))