本文整理汇总了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)