当前位置: 首页>>代码示例>>Python>>正文


Python Node.calculateBoundingBox方法代码示例

本文整理汇总了Python中KicadModTree.nodes.Node.Node.calculateBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:Python Node.calculateBoundingBox方法的具体用法?Python Node.calculateBoundingBox怎么用?Python Node.calculateBoundingBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KicadModTree.nodes.Node.Node的用法示例。


在下文中一共展示了Node.calculateBoundingBox方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: calculateBoundingBox

# 需要导入模块: from KicadModTree.nodes.Node import Node [as 别名]
# 或者: from KicadModTree.nodes.Node.Node import calculateBoundingBox [as 别名]
    def calculateBoundingBox(self):
        min_x = self.center_pos.x-self.radius
        min_y = self.center_pos.y-self.radius
        max_x = self.center_pos.x+self.radius
        max_y = self.center_pos.y+self.radius

        return Node.calculateBoundingBox({'min': ParseXY(min_x, min_y), 'max': ParseXY(max_x, max_y)})
开发者ID:poeschlr,项目名称:kicad-footprint-generator,代码行数:9,代码来源:Circle.py

示例2: calculateBoundingBox

# 需要导入模块: from KicadModTree.nodes.Node import Node [as 别名]
# 或者: from KicadModTree.nodes.Node.Node import calculateBoundingBox [as 别名]
    def calculateBoundingBox(self):
        render_start_pos = self.getRealPosition(self.start_pos)
        render_end_pos = self.getRealPosition(self.end_pos)

        min_x = min([render_start_pos.x, render_end_pos.x])
        min_y = min([render_start_pos.y, render_end_pos.y])
        max_x = max([render_start_pos.x, render_end_pos.x])
        max_y = max([render_start_pos.y, render_end_pos.y])

        return Node.calculateBoundingBox({'min': Vector2D(min_x, min_y), 'max': Vector2D(max_x, max_y)})
开发者ID:poeschlr,项目名称:kicad-footprint-generator,代码行数:12,代码来源:Line.py

示例3: calculateBoundingBox

# 需要导入模块: from KicadModTree.nodes.Node import Node [as 别名]
# 或者: from KicadModTree.nodes.Node.Node import calculateBoundingBox [as 别名]
    def calculateBoundingBox(self):
        min = max = self.getRealPosition(self.nodes[0])

        for n in self.nodes:
            min.x = min([min.x, n.x])
            min.y = min([min.y, n.y])
            max.x = max([max.x, n.x])
            max.y = max([max.y, n.y])

        return Node.calculateBoundingBox({'min': min, 'max': max})
开发者ID:poeschlr,项目名称:kicad-footprint-generator,代码行数:12,代码来源:PolygonPoints.py

示例4: calculateBoundingBox

# 需要导入模块: from KicadModTree.nodes.Node import Node [as 别名]
# 或者: from KicadModTree.nodes.Node.Node import calculateBoundingBox [as 别名]
    def calculateBoundingBox(self):
        width = len(self.text)*self.size['x']
        height = self.size['y']

        min_x = self.at['x']-width/2.
        min_y = self.at['y']-height/2.
        max_x = self.at['x']+width/2.
        max_y = self.at['y']+height/2.

        return Node.calculateBoundingBox({'min': Vector2D(min_x, min_y), 'max': Vector2D(max_x, max_y)})
开发者ID:poeschlr,项目名称:kicad-footprint-generator,代码行数:12,代码来源:Text.py

示例5: calculateBoundingBox

# 需要导入模块: from KicadModTree.nodes.Node import Node [as 别名]
# 或者: from KicadModTree.nodes.Node.Node import calculateBoundingBox [as 别名]
    def calculateBoundingBox(self):
        render_start_pos = self.getRealPosition(self.start_pos)
        render_end_pos = self.getRealPosition(self.end_pos)

        min_x = min([render_start_pos.x, render_end_pos.x])
        min_y = min([render_start_pos.y, render_end_pos.y])
        max_x = max([render_start_pos.x, render_end_pos.x])
        max_y = max([render_start_pos.y, render_end_pos.y])

        return Node.calculateBoundingBox({"min": Point(min_x, min_y), "max": Point(max_x, max_y)})
开发者ID:SchrodingersGat,项目名称:kicad-footprint-generator,代码行数:12,代码来源:Line.py

示例6: calculateBoundingBox

# 需要导入模块: from KicadModTree.nodes.Node import Node [as 别名]
# 或者: from KicadModTree.nodes.Node.Node import calculateBoundingBox [as 别名]
    def calculateBoundingBox(self):
        # TODO: finish implementation
        min_x = min(self.start_pos.x, self._calulateEndPos().x)
        min_y = min(self.start_pos.x, self._calulateEndPos().y)
        max_x = max(self.start_pos.x, self._calulateEndPos().x)
        max_y = max(self.start_pos.x, self._calulateEndPos().y)

        '''
        for angle in range(4):
            float_angle = angle * math.pi/2.

            start_angle = _calculateStartAngle(self)
            end_angle = start_angle + math.radians(self.angle)

            # TODO: +- pi border
            if float_angle < start_angle:
                continue
            if float_angle > end_angle:
                continue

            print("TODO: add angle side: {1}".format(float_angle))
        '''

        return Node.calculateBoundingBox({'min': Point((min_x, min_y)), 'max': Point((max_x, max_y))})
开发者ID:SchrodingersGat,项目名称:kicad-footprint-generator,代码行数:26,代码来源:Arc.py

示例7: calculateBoundingBox

# 需要导入模块: from KicadModTree.nodes.Node import Node [as 别名]
# 或者: from KicadModTree.nodes.Node.Node import calculateBoundingBox [as 别名]
 def calculateBoundingBox(self):
     return Node.calculateBoundingBox(self)
开发者ID:poeschlr,项目名称:kicad-footprint-generator,代码行数:4,代码来源:Pad.py


注:本文中的KicadModTree.nodes.Node.Node.calculateBoundingBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。