Beispiel #1
0
    def createRubberBand(self, geomType, alternativeBand=False):
        '''
        Creates a rubber band with the color/line width from the QGIS settings.
        '''
        settings = QSettings()
        rb = QgsRubberBand(self.canvas, geomType)
        rb.setWidth(settings.value("/Qgis/digitizing/line_width", 1))
        color = QColor(settings.value("/Qgis/digitizing/line_color_red", 255), \
                       settings.value("/Qgis/digitizing/line_color_green", 0), \
                       settings.value("/Qgis/digitizing/line_color_blue", 0))

        myAlpha = settings.value("/Qgis/digitizing/line_color_alpha",
                                 200) / 255.0

        if alternativeBand:
            myAlpha = myAlpha * 0.75
            rb.setLineStyle(Qt.DotLine)

        if geomType == QgsWkbTypes.PolygonGeometry:
            color.setAlphaF(myAlpha)

        rb.setColor(color)
        rb.show()

        return rb
    def prepareRubberBand(self):
        color = QColor("red")
        color.setAlphaF(0.78)

        self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.LineGeometry)
        self.rubberBand.setWidth(1)
        self.rubberBand.setColor(color)
        self.rubberBand.show()
    def prepareTempRubberBand(self):
        color = QColor("red")
        color.setAlphaF(0.78)

        self.tempRubberBand = QgsRubberBand(self.canvas,
                                            QgsWkbTypes.LineGeometry)
        self.tempRubberBand.setWidth(1)
        self.tempRubberBand.setColor(color)
        self.tempRubberBand.setLineStyle(Qt.DotLine)
        self.tempRubberBand.show()
 def start_to_rotate(self, event):
     mapPt,layerPt = self.transformCoordinates(event.pos())
     color = QColor("black")
     color.setAlphaF(0.78)
     self.tempRubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.LineGeometry)
     self.tempRubberBand.setWidth(4)
     self.tempRubberBand.setColor(color)
     self.tempRubberBand.setLineStyle(Qt.DotLine)
     self.tempRubberBand.show()
     self.tempRubberBand.addPoint(mapPt) 
     self.startRotate = True
Beispiel #5
0
    def startCapturing(self):
        #rubberband voor de al vastgelegde punten
        color = QColor("red")
        color.setAlphaF(0.2)
        self.rubberBand = QgsRubberBand(self.canvas, self.bandType())
        self.rubberBand.setWidth(2)
        self.rubberBand.setColor(color)
        self.rubberBand.show()

        #gestippelde rubberband -> voor het tekenen
        self.tempRubberBand = QgsRubberBand(self.canvas, self.bandType())
        self.tempRubberBand.setWidth(2)
        self.tempRubberBand.setColor(color)
        self.tempRubberBand.setLineStyle(Qt.DotLine)
        self.tempRubberBand.show()

        #2x loodrechte hulp tekenlijnen
        self.perpRubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.LineGeometry)
        self.perpRubberBand.setWidth(1)
        self.perpRubberBand.setColor(QColor("blue"))
        self.perpRubberBand.setLineStyle(Qt.DotLine)
        self.perpRubberBand.show()

        self.perpRubberBand2 = QgsRubberBand(self.canvas, QgsWkbTypes.LineGeometry)
        self.perpRubberBand2.setWidth(1)
        self.perpRubberBand2.setColor(QColor("blue"))
        self.perpRubberBand2.setLineStyle(Qt.DotLine)
        self.perpRubberBand2.show()
        
        self.roundRubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.LineGeometry)
        self.roundRubberBand.setWidth(1)
        borderColor = QColor("blue")
        borderColor.setAlphaF(0.5)
        fillColor = QColor("blue")
        fillColor.setAlphaF(0)
        self.roundRubberBand.setFillColor(fillColor)    
        self.roundRubberBand.setStrokeColor(borderColor)        
        self.roundRubberBand.setLineStyle(Qt.DotLine)
        self.roundRubberBand.show() 
        self.parent.straal.valueChanged.connect(self.roundrubberband_change_straal)        
        self.capturing = True