コード例 #1
0
    def testBasic(self):
        item = QgsAnnotationMarkerItem(QgsPoint(12, 13))

        self.assertEqual(item.geometry().x(), 12.0)
        self.assertEqual(item.geometry().y(), 13.0)

        item.setGeometry(QgsPoint(1000, 2000))
        item.setZIndex(11)
        self.assertEqual(item.geometry().x(), 1000.0)
        self.assertEqual(item.geometry().y(), 2000.0)
        self.assertEqual(item.zIndex(), 11)

        item.setSymbol(QgsMarkerSymbol.createSimple({'color': '100,200,200', 'size': '3', 'outline_color': 'black'}))
        self.assertEqual(item.symbol()[0].color(), QColor(100, 200, 200))
コード例 #2
0
    def test_apply_delete_node_edit(self):
        item = QgsAnnotationMarkerItem(QgsPoint(12, 13))
        self.assertEqual(item.geometry().asWkt(), 'POINT(12 13)')

        self.assertEqual(item.applyEdit(QgsAnnotationItemEditOperationDeleteNode('', QgsVertexId(0, 0, 0), QgsPoint(12, 13))), Qgis.AnnotationItemEditOperationResult.ItemCleared)
コード例 #3
0
    def test_apply_move_node_edit(self):
        item = QgsAnnotationMarkerItem(QgsPoint(12, 13))
        self.assertEqual(item.geometry().asWkt(), 'POINT(12 13)')

        self.assertEqual(item.applyEdit(QgsAnnotationItemEditOperationMoveNode('', QgsVertexId(0, 0, 1), QgsPoint(14, 13), QgsPoint(17, 18))), Qgis.AnnotationItemEditOperationResult.Success)
        self.assertEqual(item.geometry().asWkt(), 'POINT(17 18)')
コード例 #4
0
    def test_transform(self):
        item = QgsAnnotationMarkerItem(QgsPoint(12, 13))
        self.assertEqual(item.geometry().asWkt(), 'POINT(12 13)')

        self.assertEqual(item.applyEdit(QgsAnnotationItemEditOperationTranslateItem('', 100, 200)), Qgis.AnnotationItemEditOperationResult.Success)
        self.assertEqual(item.geometry().asWkt(), 'POINT(112 213)')
コード例 #5
0
    def test_transient_translate_operation(self):
        item = QgsAnnotationMarkerItem(QgsPoint(12, 13))
        self.assertEqual(item.geometry().asWkt(), 'POINT(12 13)')

        res = item.transientEditResults(QgsAnnotationItemEditOperationTranslateItem('', 100, 200))
        self.assertEqual(res.representativeGeometry().asWkt(), 'Point (112 213)')
コード例 #6
0
    def test_transient_move_operation(self):
        item = QgsAnnotationMarkerItem(QgsPoint(12, 13))
        self.assertEqual(item.geometry().asWkt(), 'POINT(12 13)')

        res = item.transientEditResults(QgsAnnotationItemEditOperationMoveNode('', QgsVertexId(0, 0, 0), QgsPoint(12, 13), QgsPoint(17, 18)))
        self.assertEqual(res.representativeGeometry().asWkt(), 'Point (17 18)')