Exemplo n.º 1
0
 def clear(self):
     self.dock.lineEditIds.setText("")
     for marker in self.idsVertexMarkers:
         marker.setVisible(False)
     self.idsVertexMarkers = []
     self.dock.lineEditTargetIds.setText("")
     for marker in self.targetIdsVertexMarkers:
         marker.setVisible(False)
     self.targetIdsVertexMarkers = []
     self.dock.lineEditSourceId.setText("")
     self.sourceIdVertexMarker.setVisible(False)
     self.dock.lineEditTargetId.setText("")
     self.targetIdVertexMarker.setVisible(False)
     self.sourceIdRubberBand.reset(Utils.getRubberBandType(False))
     self.targetIdRubberBand.reset(Utils.getRubberBandType(False))
     for marker in self.canvasItemList['markers']:
         marker.setVisible(False)
     self.canvasItemList['markers'] = []
     for anno in self.canvasItemList['annotations']:
         anno.setVisible(False)
     self.canvasItemList['annotations'] = []
     for path in self.canvasItemList['paths']:
         path.reset(Utils.getRubberBandType(False))
     self.canvasItemList['paths'] = []
     self.canvasItemList['path'].reset(Utils.getRubberBandType(False))
     self.canvasItemList['area'].reset(Utils.getRubberBandType(True))
Exemplo n.º 2
0
 def clear(self):
     self.dock.lineEditIds.setText("")
     for marker in self.idsVertexMarkers:
         marker.setVisible(False)
     self.idsVertexMarkers = []
     self.dock.lineEditTargetIds.setText("")
     for marker in self.targetIdsVertexMarkers:
         marker.setVisible(False)
     self.targetIdsVertexMarkers = []
     self.dock.lineEditSourceId.setText("")
     self.sourceIdVertexMarker.setVisible(False)
     self.dock.lineEditTargetId.setText("")
     self.targetIdVertexMarker.setVisible(False)
     self.sourceIdRubberBand.reset(Utils.getRubberBandType(False))
     self.targetIdRubberBand.reset(Utils.getRubberBandType(False))
     for marker in self.canvasItemList["markers"]:
         marker.setVisible(False)
     self.canvasItemList["markers"] = []
     for anno in self.canvasItemList["annotations"]:
         anno.setVisible(False)
     self.canvasItemList["annotations"] = []
     for path in self.canvasItemList["paths"]:
         path.reset(Utils.getRubberBandType(False))
     self.canvasItemList["paths"] = []
     self.canvasItemList["path"].reset(Utils.getRubberBandType(False))
     self.canvasItemList["area"].reset(Utils.getRubberBandType(True))
Exemplo n.º 3
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface

        self.idsVertexMarkers = []
        self.targetIdsVertexMarkers = []
        self.sourceIdVertexMarker = QgsVertexMarker(self.iface.mapCanvas())
        self.sourceIdVertexMarker.setColor(Qt.blue)
        self.sourceIdVertexMarker.setPenWidth(2)
        self.sourceIdVertexMarker.setVisible(False)
        self.targetIdVertexMarker = QgsVertexMarker(self.iface.mapCanvas())
        self.targetIdVertexMarker.setColor(Qt.green)
        self.targetIdVertexMarker.setPenWidth(2)
        self.targetIdVertexMarker.setVisible(False)
        self.sourceIdRubberBand = QgsRubberBand(self.iface.mapCanvas(), Utils.getRubberBandType(False))
        self.sourceIdRubberBand.setColor(Qt.cyan)
        self.sourceIdRubberBand.setWidth(4)
        self.targetIdRubberBand = QgsRubberBand(self.iface.mapCanvas(), Utils.getRubberBandType(False))
        self.targetIdRubberBand.setColor(Qt.yellow)
        self.targetIdRubberBand.setWidth(4)

        self.canvasItemList = {}
        self.canvasItemList["markers"] = []
        self.canvasItemList["annotations"] = []
        self.canvasItemList["paths"] = []
        resultPathRubberBand = QgsRubberBand(self.iface.mapCanvas(), Utils.getRubberBandType(False))
        resultPathRubberBand.setColor(QColor(255, 0, 0, 128))
        resultPathRubberBand.setWidth(4)
        self.canvasItemList["path"] = resultPathRubberBand
        resultAreaRubberBand = QgsRubberBand(self.iface.mapCanvas(), Utils.getRubberBandType(True))
        resultAreaRubberBand.setColor(Qt.magenta)
        resultAreaRubberBand.setWidth(2)
        if not Utils.isQGISv1():
            resultAreaRubberBand.setBrushStyle(Qt.Dense4Pattern)
        self.canvasItemList["area"] = resultAreaRubberBand
Exemplo n.º 4
0
 def selectTargetId(self, checked):
     if checked:
         self.toggleSelectButton(self.dock.buttonSelectTargetId)
         self.dock.lineEditTargetId.setText("")
         self.targetIdVertexMarker.setVisible(False)
         self.targetIdRubberBand.reset(Utils.getRubberBandType(False))
         self.iface.mapCanvas().setMapTool(self.targetIdEmitPoint)
     else:
         self.iface.mapCanvas().unsetMapTool(self.targetIdEmitPoint)
Exemplo n.º 5
0
 def selectTargetId(self, checked):
     if checked:
         self.toggleSelectButton(self.dock.buttonSelectTargetId)
         self.dock.lineEditTargetId.setText("")
         self.targetIdVertexMarker.setVisible(False)
         self.targetIdRubberBand.reset(Utils.getRubberBandType(False))
         self.iface.mapCanvas().setMapTool(self.targetIdEmitPoint)
     else:
         self.iface.mapCanvas().unsetMapTool(self.targetIdEmitPoint)
Exemplo n.º 6
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface

        self.idsVertexMarkers = []
        self.targetIdsVertexMarkers = []
        self.sourceIdVertexMarker = QgsVertexMarker(self.iface.mapCanvas())
        self.sourceIdVertexMarker.setColor(Qt.blue)
        self.sourceIdVertexMarker.setPenWidth(2)
        self.sourceIdVertexMarker.setVisible(False)
        self.targetIdVertexMarker = QgsVertexMarker(self.iface.mapCanvas())
        self.targetIdVertexMarker.setColor(Qt.green)
        self.targetIdVertexMarker.setPenWidth(2)
        self.targetIdVertexMarker.setVisible(False)
        self.sourceIdRubberBand = QgsRubberBand(self.iface.mapCanvas(),
                                                Utils.getRubberBandType(False))
        self.sourceIdRubberBand.setColor(Qt.cyan)
        self.sourceIdRubberBand.setWidth(4)
        self.targetIdRubberBand = QgsRubberBand(self.iface.mapCanvas(),
                                                Utils.getRubberBandType(False))
        self.targetIdRubberBand.setColor(Qt.yellow)
        self.targetIdRubberBand.setWidth(4)

        self.canvasItemList = {}
        self.canvasItemList['markers'] = []
        self.canvasItemList['annotations'] = []
        self.canvasItemList['paths'] = []
        resultPathRubberBand = QgsRubberBand(self.iface.mapCanvas(),
                                             Utils.getRubberBandType(False))
        resultPathRubberBand.setColor(QColor(255, 0, 0, 128))
        resultPathRubberBand.setWidth(4)
        self.canvasItemList['path'] = resultPathRubberBand
        resultAreaRubberBand = QgsRubberBand(self.iface.mapCanvas(),
                                             Utils.getRubberBandType(True))
        resultAreaRubberBand.setColor(Qt.magenta)
        resultAreaRubberBand.setWidth(2)
        if not Utils.isQGISv1():
            resultAreaRubberBand.setBrushStyle(Qt.Dense4Pattern)
        self.canvasItemList['area'] = resultAreaRubberBand
Exemplo n.º 7
0
 def test_getRubberBandType_2(self):
     isPolygon = False
     self.assertEqual(utils.getRubberBandType(isPolygon), 1)
Exemplo n.º 8
0
 def test_getRubberBandType_1(self):
     isPolygon = True
     self.assertEqual(utils.getRubberBandType(isPolygon), 2)
Exemplo n.º 9
0
 def test_getRubberBandType_1(self):
     isPolygon = True
     self.assertEqual(utils.getRubberBandType(isPolygon),2)
Exemplo n.º 10
0
 def test_getRubberBandType_2(self):
     isPolygon = False
     self.assertEqual(utils.getRubberBandType(isPolygon),1)