示例#1
0
 def __init__(self, plugIn):
     QadCommandClass.__init__(self, plugIn)
     self.SSGetClass = QadSSGetClass(plugIn)
     self.SSGetClass.entitySet.set(
         plugIn.tool.entitySet)  # da usare solo con QadMapTool
     self.SSGetClass.exitAfterSelection = True
     self.SSGetClass.step = 1
示例#2
0
 def reinitSSGetClass(self):
    checkPointLayer = self.SSGetClass.checkPointLayer
    del self.SSGetClass
    self.SSGetClass = QadSSGetClass(self.plugIn)
    self.SSGetClass.onlyEditableLayers = False
    self.SSGetClass.checkDimLayers = False # scarto le quote
    self.SSGetClass.checkPointLayer = checkPointLayer
示例#3
0
 def __init__(self, plugIn):
    QadCommandClass.__init__(self, plugIn)
    self.SSGetClass = QadSSGetClass(plugIn)
    self.SSGetClass.onlyEditableLayers = True
    self.entitySet = QadEntitySet()
    self.firstMirrorPt = QgsPoint()
    self.secondMirrorPt = QgsPoint()
    self.copyFeatures = True
示例#4
0
 def __init__(self, plugIn):
    QadCommandClass.__init__(self, plugIn)
    self.SSGetClass = QadSSGetClass(plugIn)
    self.PLINECommand = None      
    self.RECTANGLECommand = None
    self.entitySet = QadEntitySet() # entità da tagliare o estendere
    self.limitEntitySet = QadEntitySet() # entità che fanno da limiti
    self.edgeMode = QadVariables.get(QadMsg.translate("Environment variables", "EDGEMODE"))
    self.defaultValue = None # usato per gestire il tasto dx del mouse
    self.nOperationsToUndo = 0
示例#5
0
 def __init__(self, plugIn):
     QadCommandClass.__init__(self, plugIn)
     self.SSGetClass = QadSSGetClass(plugIn)
     self.SSGetClass.onlyEditableLayers = True
     self.entitySet = QadEntitySet()
     self.basePt = None
     self.copyFeatures = False
     self.Pt1ReferenceLen = None
     self.ReferenceLen = 1
     self.Pt1NewLen = None
示例#6
0
 def __init__(self, plugIn):
     QadCommandClass.__init__(self, plugIn)
     # se questo flag = True il comando serve all'interno di un altro comando per disegnare un buffer
     # che non verrà salvato su un layer
     self.virtualCmd = False
     self.rubberBandBorderColor = None
     self.rubberBandFillColor = None
     self.SSGetClass = QadSSGetClass(plugIn)
     self.entitySet = QadEntitySet()
     self.width = 0
     self.segments = self.plugIn.segments  # il numero di segmenti per l'approssimazione delle curve
示例#7
0
    def __init__(self, plugIn):
        QadCommandClass.__init__(self, plugIn)

        self.entity = QadEntity()

        self.SSGetClass = QadSSGetClass(plugIn)
        self.SSGetClass.onlyEditableLayers = False
        self.SSGetClass.checkDimLayers = False  # scarto le quote

        self.entSelClass = None

        self.currSubGeom = None
        self.currAtSubGeom = None
示例#8
0
 def __init__(self, plugIn):
    QadCommandClass.__init__(self, plugIn)
    self.SSGetClass = QadSSGetClass(plugIn)
    self.SSGetClass.onlyEditableLayers = True
    self.entitySet = QadEntitySet()
    self.basePt = QgsPoint()
    self.series = False
    self.seriesLen = 2
    self.adjust = False
    self.copyMode = QadVariables.get(QadMsg.translate("Environment variables", "COPYMODE"))
    
    self.featureCache = [] # lista di (layer, feature)
    self.nOperationsToUndo = 0
示例#9
0
    def canvasPressEvent(self, event):
        # volevo mettere questo evento nel canvasReleaseEvent
        # ma il tasto destro non genera quel tipo di evento
        if event.button() == Qt.RightButton:
            self.displayPopupMenuOnQuiescentState(event.pos())
        elif event.button() == Qt.LeftButton:
            # verifico se tasto shift premuto
            shiftKey = True if event.modifiers() & Qt.ShiftModifier else False
            # posizione corrente del mouse
            point = self.toMapCoordinates(event.pos())
            # leggo il punto grip che si interseca alla posizione del mouse
            entityGripPoint = self.entitySetGripPoints.isIntersecting(point)
            if entityGripPoint is not None:
                if shiftKey == False:  # lancio il comando
                    selectedEntityGripPoints = self.entitySetGripPoints.getSelectedEntityGripPoints(
                    )
                    # se non ci sono già grip selezionati
                    if len(selectedEntityGripPoints) == 0:
                        # seleziono il corrente
                        if self.entitySetGripPoints.selectIntersectingGripPoints(
                                point) > 0:
                            selectedEntityGripPoints = self.entitySetGripPoints.getSelectedEntityGripPoints(
                            )

                    # lancio il comando
                    self.plugIn.runCommand("QadVirtualGripCommandsClass", [QadVirtualGripCommandsEnum.STRECTH, \
                                           self.entitySetGripPoints, entityGripPoint.getPoint()])
                else:  # shift premuto
                    # inverto lo stato ai grip che intersecano il punto
                    self.entitySetGripPoints.toggleSelectIntersectingGripPoints(
                        point)
            else:
                result = qad_utils.getEntSel(event.pos(), self, \
                                             QadVariables.get(QadMsg.translate("Environment variables", "PICKBOX")))
                if result is not None:
                    feature = result[0]
                    layer = result[1]
                    tmpEntity = QadEntity()
                    tmpEntity.set(layer, feature.id())
                    SSGetClass = QadSSGetClass(self.plugIn)
                    SSGetClass.entitySet.set(self.entitySet)
                    SSGetClass.elaborateEntity(tmpEntity, shiftKey)
                    self.plugIn.showMsg("\n", True)  # ripete il prompt
                    self.entitySet.set(SSGetClass.entitySet)
                    del SSGetClass  # che deseleziona gli oggetti
                    self.entitySet.selectOnLayer(False)
                    self.refreshEntityGripPoints(self.entitySet)
                else:
                    self.plugIn.runCommand("QadVirtualSelCommandClass", point)
    def canvasPressEvent(self, event):
        # I wanted to put this event in the canvasReleaseEvent
        # But the right button does not generate that kind of event
        if event.button() == Qt.RightButton:
            self.displayPopupMenuOnQuiescentState(event.pos())
        elif event.button() == Qt.LeftButton:
            # I check if the shift key is pressed
            shiftKey = True if event.modifiers() & Qt.ShiftModifier else False
            # Current mouse position
            point = self.toMapCoordinates(event.pos())
            # I read the grip point that intersects the mouse position
            entityGripPoint = self.entitySetGripPoints.isIntersecting(point)
            if entityGripPoint is not None:
                if shiftKey == False:  # lancio il comando
                    selectedEntityGripPoints = self.entitySetGripPoints.getSelectedEntityGripPoints(
                    )
                    # se non ci sono già grip selezionati
                    if len(selectedEntityGripPoints) == 0:
                        # seleziono il corrente
                        if self.entitySetGripPoints.selectIntersectingGripPoints(
                                point) > 0:
                            selectedEntityGripPoints = self.entitySetGripPoints.getSelectedEntityGripPoints(
                            )

                    # lancio il comando
                    self.plugIn.runCommand("QadVirtualGripCommandsClass", [QadVirtualGripCommandsEnum.STRECTH, \
                                           self.entitySetGripPoints, entityGripPoint.getPoint()])
                else:  # Shift pressed
                    # Invert the state of grips intersecting the point
                    self.entitySetGripPoints.toggleSelectIntersectingGripPoints(
                        point)
            else:
                result = qad_utils.getEntSel(event.pos(), self, \
                                             QadVariables.get(QadMsg.translate("Environment variables", "PICKBOX")))
                if result is not None:
                    feature = result[0]
                    layer = result[1]
                    tmpEntity = QadEntity()
                    tmpEntity.set(layer, feature.id())
                    SSGetClass = QadSSGetClass(self.plugIn)
                    SSGetClass.entitySet.set(self.entitySet)
                    SSGetClass.elaborateEntity(tmpEntity, shiftKey)
                    self.plugIn.showMsg("\n", True)  # Repeat the prompt
                    self.entitySet.set(SSGetClass.entitySet)
                    del SSGetClass  # Which deselects objects
                    self.entitySet.selectOnLayer(False)
                    self.refreshEntityGripPoints(self.entitySet)
                else:
                    self.plugIn.runCommand("QadVirtualSelCommandClass", point)
示例#11
0
    def reinitSSGetClass(self):
        if self.SSGetClass is not None: del self.SSGetClass

        self.SSGetClass = QadSSGetClass(self.plugIn)
        self.SSGetClass.onlyEditableLayers = True
        self.SSGetClass.checkDimLayers = False  # scarto le quote
        geometryType = self.entity.layer.geometryType()
        if geometryType == QGis.Point:
            self.SSGetClass.checkPointLayer = True
            self.SSGetClass.checkLineLayer = False
            self.SSGetClass.checkPolygonLayer = False
        elif geometryType == QGis.Line:
            self.SSGetClass.checkPointLayer = False
            self.SSGetClass.checkLineLayer = True
            self.SSGetClass.checkPolygonLayer = True
        elif geometryType == QGis.Polygon:
            self.SSGetClass.checkPointLayer = False
            self.SSGetClass.checkLineLayer = True
            self.SSGetClass.checkPolygonLayer = True
示例#12
0
 def __init__(self, plugIn):
     QadCommandClass.__init__(self, plugIn)
     self.SSGetClass = QadSSGetClass(plugIn)
     self.SSGetClass.onlyEditableLayers = True
示例#13
0
 def __init__(self, plugIn):
     QadCommandClass.__init__(self, plugIn)
     self.SSGetClass = QadSSGetClass(plugIn)
     self.SSGetClass.onlyEditableLayers = True
     self.entitySet = QadEntitySet()
     self.basePt = QgsPoint()
示例#14
0
 def __init__(self, plugIn):
     QadCommandClass.__init__(self, plugIn)
     self.SSGetClass = QadSSGetClass(plugIn)
     self.firstTime = True