Example #1
0
    def testFixedColorVaryingWidth(self):
        """ test that rendering a interpolated line with varying width and fixed color"""

        interpolated_width = QgsInterpolatedLineWidth()
        interpolated_color = QgsInterpolatedLineColor()

        interpolated_width.setIsVariableWidth(True)
        interpolated_width.setMinimumValue(1)
        interpolated_width.setMaximumValue(8)
        interpolated_width.setMinimumWidth(1)
        interpolated_width.setMaximumWidth(10)
        interpolated_color.setColor(QColor(0, 255, 0))
        interpolated_color.setColoringMethod(
            QgsInterpolatedLineColor.SingleColor)

        self.renderImage(interpolated_width, interpolated_color,
                         'interpolatedlinesymbollayer_3')
Example #2
0
    def testVaryingColorVaryingWidthExact(self):
        """ test that rendering a interpolated line with varying width and varying color with exact color ramp """

        interpolated_width = QgsInterpolatedLineWidth()
        interpolated_color = QgsInterpolatedLineColor()

        interpolated_width.setIsVariableWidth(True)
        interpolated_width.setMinimumValue(1)
        interpolated_width.setMaximumValue(8)
        interpolated_width.setMinimumWidth(1)
        interpolated_width.setMaximumWidth(10)
        color_ramp = QgsColorRampShader(
            0, 10,
            QgsStyle.defaultStyle().colorRamp('Viridis'),
            QgsColorRampShader.Exact)
        color_ramp.classifyColorRamp(10)
        interpolated_color.setColor(color_ramp)
        interpolated_color.setColoringMethod(
            QgsInterpolatedLineColor.ColorRamp)

        self.renderImage(interpolated_width, interpolated_color,
                         'interpolatedlinesymbollayer_6')
Example #3
0
    def testVaryingColorVaryingWidthDiscrete(self):
        """ test that rendering a interpolated line with varying width and varying color with discrete color ramp """

        interpolated_width = QgsInterpolatedLineWidth()
        interpolated_color = QgsInterpolatedLineColor()

        interpolated_width.setIsVariableWidth(True)
        interpolated_width.setMinimumValue(1)
        interpolated_width.setMaximumValue(8)
        interpolated_width.setMinimumWidth(1)
        interpolated_width.setMaximumWidth(10)
        color_ramp = QgsColorRampShader(
            2, 7,
            QgsStyle.defaultStyle().colorRamp('RdGy'),
            QgsColorRampShader.Discrete)
        color_ramp.classifyColorRamp(5)
        interpolated_color.setColor(color_ramp)
        interpolated_color.setColoringMethod(
            QgsInterpolatedLineColor.ColorRamp)

        self.renderImage(interpolated_width, interpolated_color,
                         'interpolatedlinesymbollayer_5')