Esempio n. 1
0
    def __init__(self, methodName):
        """Run once on class initialization."""
        unittest.TestCase.__init__(self, methodName)

        self.mapSettings = QgsMapSettings()

        # create composition
        self.mComposition = QgsComposition(self.mapSettings)
        self.mComposition.setPaperSize(297, 210)

        # create
        polygon = QPolygonF()
        polygon.append(QPointF(0.0, 0.0))
        polygon.append(QPointF(100.0, 0.0))
        polygon.append(QPointF(200.0, 100.0))
        polygon.append(QPointF(100.0, 200.0))

        self.mComposerPolygon = QgsComposerPolygon(polygon, self.mComposition)
        self.mComposition.addComposerPolygon(self.mComposerPolygon)

        # style
        props = {}
        props["color"] = "green"
        props["style"] = "solid"
        props["style_border"] = "solid"
        props["color_border"] = "black"
        props["width_border"] = "10.0"
        props["joinstyle"] = "miter"

        style = QgsFillSymbolV2.createSimple(props)
        self.mComposerPolygon.setPolygonStyleSymbol(style)
    def __init__(self, methodName):
        """Run once on class initialization."""
        unittest.TestCase.__init__(self, methodName)

        self.mapSettings = QgsMapSettings()

        # create composition
        self.mComposition = QgsComposition(self.mapSettings)
        self.mComposition.setPaperSize(297, 210)

        # create
        polygon = QPolygonF()
        polygon.append(QPointF(0.0, 0.0))
        polygon.append(QPointF(100.0, 0.0))
        polygon.append(QPointF(200.0, 100.0))
        polygon.append(QPointF(100.0, 200.0))

        self.mComposerPolyline = QgsComposerPolyline(polygon,
                                                     self.mComposition)
        self.mComposition.addComposerPolyline(self.mComposerPolyline)

        # style
        props = {}
        props["color"] = "0,0,0,255"
        props["width"] = "10.0"
        props["capstyle"] = "square"

        style = QgsLineSymbolV2.createSimple(props)
        self.mComposerPolyline.setPolylineStyleSymbol(style)
    def __init__(self, methodName):
        """Run once on class initialization."""
        unittest.TestCase.__init__(self, methodName)

        self.mapSettings = QgsMapSettings()

        # create composition
        self.mComposition = QgsComposition(self.mapSettings)
        self.mComposition.setPaperSize(297, 210)

        # create
        polygon = QPolygonF()
        polygon.append(QPointF(0.0, 0.0))
        polygon.append(QPointF(100.0, 0.0))
        polygon.append(QPointF(200.0, 100.0))
        polygon.append(QPointF(100.0, 200.0))

        self.mComposerPolyline = QgsComposerPolyline(
            polygon, self.mComposition)
        self.mComposition.addComposerPolyline(self.mComposerPolyline)

        # style
        props = {}
        props["color"] = "0,0,0,255"
        props["width"] = "10.0"
        props["capstyle"] = "square"

        style = QgsLineSymbolV2.createSimple(props)
        self.mComposerPolyline.setPolylineStyleSymbol(style)
    def __init__(self, methodName):
        """Run once on class initialization."""
        unittest.TestCase.__init__(self, methodName)

        self.mapSettings = QgsMapSettings()

        # create composition
        self.mComposition = QgsComposition(self.mapSettings)
        self.mComposition.setPaperSize(297, 210)

        # create
        polygon = QPolygonF()
        polygon.append(QPointF(0.0, 0.0))
        polygon.append(QPointF(100.0, 0.0))
        polygon.append(QPointF(200.0, 100.0))
        polygon.append(QPointF(100.0, 200.0))

        self.mComposerPolygon = QgsComposerPolygon(polygon, self.mComposition)
        self.mComposition.addComposerPolygon(self.mComposerPolygon)

        # style
        props = {}
        props["color"] = "green"
        props["style"] = "solid"
        props["style_border"] = "solid"
        props["color_border"] = "black"
        props["width_border"] = "10.0"
        props["joinstyle"] = "miter"

        style = QgsFillSymbolV2.createSimple(props)
        self.mComposerPolygon.setPolygonStyleSymbol(style)
Esempio n. 5
0
 def polygon(self):
     font = QFont('Verdana', 8)
     fm = QFontMetricsF(font)
     hUp = fm.height() * 1.2 * (len(self.element.parameters) + 2)
     hDown = fm.height() * 1.2 * (len(self.element.outputs) + 2)
     pol = QPolygonF([
         QPointF(-(ModelerGraphicItem.BOX_WIDTH + 2) / 2,
                 -(ModelerGraphicItem.BOX_HEIGHT + 2) / 2 - hUp),
         QPointF(-(ModelerGraphicItem.BOX_WIDTH + 2) / 2,
                 (ModelerGraphicItem.BOX_HEIGHT + 2) / 2 + hDown),
         QPointF((ModelerGraphicItem.BOX_WIDTH + 2) / 2,
                 (ModelerGraphicItem.BOX_HEIGHT + 2) / 2 + hDown),
         QPointF((ModelerGraphicItem.BOX_WIDTH + 2) / 2,
                 -(ModelerGraphicItem.BOX_HEIGHT + 2) / 2 - hUp),
         QPointF(-(ModelerGraphicItem.BOX_WIDTH + 2) / 2,
                 -(ModelerGraphicItem.BOX_HEIGHT + 2) / 2 - hUp)
     ])
     return pol
Esempio n. 6
0
 def __init__(self,
              startItem,
              startIndex,
              endItem,
              endIndex,
              parent=None,
              scene=None):
     super(ModelerArrowItem, self).__init__(parent, scene)
     self.arrowHead = QPolygonF()
     self.endIndex = endIndex
     self.startIndex = startIndex
     self.startItem = startItem
     self.endItem = endItem
     self.endPoints = []
     self.setFlag(QGraphicsItem.ItemIsSelectable, False)
     self.myColor = Qt.gray
     self.setPen(
         QPen(self.myColor, 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin))
     self.setZValue(0)