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


Python QgsPointXY.set方法代码示例

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


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

示例1: transformedCornerCoordinates

# 需要导入模块: from qgis.core import QgsPointXY [as 别名]
# 或者: from qgis.core.QgsPointXY import set [as 别名]
    def transformedCornerCoordinates(self, center, rotation, xScale, yScale):
        # scale
        topLeft = QgsPointXY(-self.image.width() / 2.0 * xScale,
                             self.image.height() / 2.0 * yScale)
        topRight = QgsPointXY(self.image.width() / 2.0 * xScale,
                              self.image.height() / 2.0 * yScale)
        bottomLeft = QgsPointXY(-self.image.width() / 2.0 * xScale,
                                - self.image.height() / 2.0 * yScale)
        bottomRight = QgsPointXY(self.image.width() / 2.0 * xScale,
                                 - self.image.height() / 2.0 * yScale)

        # rotate
        # minus sign because rotation is CW in this class and Qt)
        rotationRad = -rotation * math.pi / 180
        cosRot = math.cos(rotationRad)
        sinRot = math.sin(rotationRad)

        topLeft = self._rotate(topLeft, cosRot, sinRot)
        topRight = self._rotate(topRight, cosRot, sinRot)
        bottomRight = self._rotate(bottomRight, cosRot, sinRot)
        bottomLeft = self._rotate(bottomLeft, cosRot, sinRot)

        topLeft.set(topLeft.x() + center.x(), topLeft.y() + center.y())
        topRight.set(topRight.x() + center.x(), topRight.y() + center.y())
        bottomRight.set(bottomRight.x() + center.x(),
                        bottomRight.y() + center.y())
        bottomLeft.set(bottomLeft.x() + center.x(),
                       bottomLeft.y() + center.y())

        return (topLeft, topRight, bottomRight, bottomLeft)
开发者ID:gvellut,项目名称:FreehandRasterGeoreferencer,代码行数:32,代码来源:freehandrastergeoreferencer_layer.py


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