本文整理汇总了Python中qgis.PyQt.QtCore.QPointF.y方法的典型用法代码示例。如果您正苦于以下问题:Python QPointF.y方法的具体用法?Python QPointF.y怎么用?Python QPointF.y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.PyQt.QtCore.QPointF
的用法示例。
在下文中一共展示了QPointF.y方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: paint
# 需要导入模块: from qgis.PyQt.QtCore import QPointF [as 别名]
# 或者: from qgis.PyQt.QtCore.QPointF import y [as 别名]
def paint(self, painter, option, widget=None):
pt = QPointF(-math.floor(self.WIDTH / 2), -math.floor(self.HEIGHT / 2)) + self.position
rect = QRectF(pt.x(), pt.y(), self.WIDTH, self.HEIGHT)
if self.isIn:
painter.setPen(QPen(Qt.transparent, 1))
painter.setBrush(QBrush(QColor(55, 55, 55, 33),
Qt.SolidPattern))
else:
painter.setPen(QPen(Qt.transparent, 1))
painter.setBrush(QBrush(Qt.transparent,
Qt.SolidPattern))
painter.drawRect(rect)
painter.drawPicture(pt.x(), pt.y(), self.picture)
示例2: foldInput
# 需要导入模块: from qgis.PyQt.QtCore import QPointF [as 别名]
# 或者: from qgis.PyQt.QtCore.QPointF import y [as 别名]
def foldInput(self, folded):
self.element.setParametersCollapsed(folded)
#also need to update the model's stored component
self.model.childAlgorithm(self.element.childId()).setParametersCollapsed(folded)
self.prepareGeometryChange()
if self.element.algorithm().outputDefinitions():
pt = self.getLinkPointForOutput(-1)
pt = QPointF(0, pt.y())
self.outButton.position = pt
for arrow in self.arrows:
arrow.updatePath()
self.update()
示例3: __init__
# 需要导入模块: from qgis.PyQt.QtCore import QPointF [as 别名]
# 或者: from qgis.PyQt.QtCore.QPointF import y [as 别名]
def __init__(self, element, model, controls, scene=None):
super(ModelerGraphicItem, self).__init__(None)
self.controls = controls
self.model = model
self.scene = scene
self.element = element
if isinstance(element, QgsProcessingModelParameter):
svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'input.svg'))
self.picture = QPicture()
painter = QPainter(self.picture)
svg.render(painter)
self.pixmap = None
paramDef = self.model.parameterDefinition(element.parameterName())
if paramDef:
self.text = paramDef.description()
else:
self.text = 'Error ({})'.format(element.parameterName())
elif isinstance(element, QgsProcessingModelOutput):
# Output name
svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'output.svg'))
self.picture = QPicture()
painter = QPainter(self.picture)
svg.render(painter)
self.pixmap = None
self.text = element.name()
else:
if element.algorithm().svgIconPath():
svg = QSvgRenderer(element.algorithm().svgIconPath())
size = svg.defaultSize()
self.picture = QPicture()
painter = QPainter(self.picture)
painter.scale(16 / size.width(), 16 / size.width())
svg.render(painter)
self.pixmap = None
else:
self.pixmap = element.algorithm().icon().pixmap(15, 15)
self.text = element.description()
self.arrows = []
self.setFlag(QGraphicsItem.ItemIsMovable, True)
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)
self.setZValue(1000)
if controls:
svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'edit.svg'))
picture = QPicture()
painter = QPainter(picture)
svg.render(painter)
pt = QPointF(ModelerGraphicItem.BOX_WIDTH / 2 -
FlatButtonGraphicItem.WIDTH / 2,
ModelerGraphicItem.BOX_HEIGHT / 2 -
FlatButtonGraphicItem.HEIGHT / 2)
self.editButton = FlatButtonGraphicItem(picture, pt, self.editElement)
self.editButton.setParentItem(self)
svg = QSvgRenderer(os.path.join(pluginPath, 'images', 'delete.svg'))
picture = QPicture()
painter = QPainter(picture)
svg.render(painter)
pt = QPointF(ModelerGraphicItem.BOX_WIDTH / 2 -
FlatButtonGraphicItem.WIDTH / 2,
FlatButtonGraphicItem.HEIGHT / 2 -
ModelerGraphicItem.BOX_HEIGHT / 2)
self.deleteButton = FlatButtonGraphicItem(picture, pt,
self.removeElement)
self.deleteButton.setParentItem(self)
if isinstance(element, QgsProcessingModelChildAlgorithm):
alg = element.algorithm()
if [a for a in alg.parameterDefinitions() if not a.isDestination()]:
pt = self.getLinkPointForParameter(-1)
pt = QPointF(0, pt.y())
if controls:
self.inButton = FoldButtonGraphicItem(pt, self.foldInput, self.element.parametersCollapsed())
self.inButton.setParentItem(self)
if alg.outputDefinitions():
pt = self.getLinkPointForOutput(-1)
pt = QPointF(0, pt.y())
if controls:
self.outButton = FoldButtonGraphicItem(pt, self.foldOutput, self.element.outputsCollapsed())
self.outButton.setParentItem(self)
示例4: drawHistogram
# 需要导入模块: from qgis.PyQt.QtCore import QPointF [as 别名]
# 或者: from qgis.PyQt.QtCore.QPointF import y [as 别名]
def drawHistogram(self):
#if self.inputlayer is None:
# return
self.showInfo("Drawing histogram...")
viewprect = QRectF(self.histoGraphicsView.viewport().rect())
self.histoGraphicsView.setSceneRect(viewprect)
self.setupScene.clear()
self.setupScene.update()
histbottom = self.histoGraphicsView.sceneRect().bottom()
histtop = self.histoGraphicsView.sceneRect().top()
left = self.histoGraphicsView.sceneRect().left() + self.histopadding
right = self.histoGraphicsView.sceneRect().right() - self.histopadding
histheight = histbottom - histtop
histwidth = right - left
step = 1.0 * histwidth / self.histobins
maxlength = histheight
padding = 1
ll = QPoint(self.histopadding - 1, histheight - padding)
start = QPointF(self.histoGraphicsView.mapToScene(ll))
# Check if there is only one value
#myrange = (self.minValueSpinBox.value(),self.maxValueSpinBox.value())
if self.histogramAvailable:
maxvalue = 0.0
for i in range(len(self.histo[0])):
if self.histo[0][i] > maxvalue:
maxvalue = self.histo[0][i]
if maxvalue == 0:
return
self.maxBinNumber.setText(str(maxvalue))
# Create the histogram:
#self.showInfo("maxvalue: " + str(maxvalue))
#self.showInfo("maxlength: " + str(maxlength))
#self.showInfo("step: " + str(step))
for i in range(self.histobins):
binnumber = self.histo[0][i]
if binnumber == 0:
continue
height = (1.0 * self.histo[0][i] / maxvalue *
(maxlength - padding))
rectangle = QGraphicsRectItem(start.x() + step * i,
start.y(),
step,
-height)
rectangle.setPen(QPen(QColor(102, 102, 102)))
rectangle.setBrush(QBrush(QColor(240, 240, 240)))
self.setupScene.addItem(rectangle)
#self.showInfo(str(i) + ": " + str(height))
#if self.levelsListView.model().rowCount() > 0:
# Add lines for the levels
minvalue = float(self.histMinValue.text())
maxvalue = float(self.histMaxValue.text())
datarange = maxvalue - minvalue
if datarange == 0:
return
i = 0
while self.levelsListView.model().item(i):
#self.showInfo("Element: " +
# str(self.levelsListView.model().item(i).text()))
#continue
value = float(self.levelsListView.model().item(i).text())
xvalue = start.x() + histwidth * (value - minvalue) / datarange
line = QGraphicsLineItem(xvalue, 0, xvalue, histheight)
if i == 0 or i == (self.levelsListView.model().rowCount() - 1):
line.setPen(QPen(QColor(204, 0, 0)))
else:
line.setPen(QPen(QColor(0, 204, 0)))
self.setupScene.addItem(line)
i = i + 1