Esempio n. 1
0
def append_ArrowMarkerSymbolLayer(symbol, layer: ArrowMarkerSymbolLayer):
    """
    Appends a ArrowMarkerSymbolLayer to a symbol
    """
    out = QgsEllipseSymbolLayer()
    out.setSymbolName('triangle')
    out.setStrokeStyle(Qt.NoPen)

    out.setSymbolHeight(layer.size)
    out.setSymbolHeightUnit(QgsUnitTypes.RenderPoints)
    out.setSymbolWidth(layer.width)
    out.setSymbolWidthUnit(QgsUnitTypes.RenderPoints)

    color = symbol_color_to_qcolor(layer.color)
    out.setColor(color)
    out.setStrokeColor(color)  # why not, makes the symbol a bit easier to modify in qgis

    # TODO ArcGIS does not have the same offset/rotation linkages as QGIS does!

    out.setOffset(QPointF(layer.x_offset, layer.y_offset))
    out.setOffsetUnit(QgsUnitTypes.RenderPoints)

    angle = 90 - layer.angle
    if angle <= -180:
        angle += 360
    if angle > 180:
        angle -= 360
    out.setAngle(angle)

    out.setEnabled(layer.enabled)
    out.setLocked(layer.locked)

    symbol.appendSymbolLayer(out)
Esempio n. 2
0
File: qgis.py Progetto: zyxgis/slyr
def append_ArrowMarkerSymbolLayer(symbol, layer: ArrowMarkerSymbolLayer,
                                  context: Context):
    """
    Appends a ArrowMarkerSymbolLayer to a symbol
    """
    out = QgsEllipseSymbolLayer()
    out.setSymbolName('triangle')
    out.setStrokeStyle(Qt.NoPen)

    out.setSymbolHeight(context.convert_size(layer.size))
    out.setSymbolHeightUnit(context.units)
    out.setSymbolWidth(context.convert_size(layer.width))
    out.setSymbolWidthUnit(context.units)

    color = symbol_color_to_qcolor(layer.color)
    out.setColor(color)
    out.setStrokeColor(
        color)  # why not, makes the symbol a bit easier to modify in qgis

    out.setOffset(
        adjust_offset_for_rotation(
            QPointF(context.convert_size(layer.x_offset),
                    -context.convert_size(layer.y_offset)), layer.angle))
    out.setOffsetUnit(context.units)

    angle = 90 - layer.angle
    if angle <= -180:
        angle += 360
    if angle > 180:
        angle -= 360
    out.setAngle(angle)

    out.setEnabled(layer.enabled)
    out.setLocked(layer.locked)

    symbol.appendSymbolLayer(out)