def elaborateSelSet(self, selSet, shiftKey): if self.checkDimLayers == True: dimEntitySet = QadEntitySet(selSet) # La funzione verifica se le entità che fanno parte di un entitySet sono anche parte di quotatura e, # in caso affermativo, aggiunge tutti i componenti delle quotature all'entitySet. QadDimStyles.addAllDimComponentsToEntitySet(dimEntitySet, self.onlyEditableLayers) selSet.unite(dimEntitySet) if self.AddOnSelection == True: # aggiungi al gruppo di selezione if shiftKey: # se la selezione é avvenuta con shift premuto if self.pickAdd == 0: # The objects most recently selected become the selection set # verifico se ci sono degli oggetti non ancora selezionati intersectSS = QadEntitySet(selSet) intersectSS.subtract(self.entitySet) if intersectSS.isEmpty(): # tutti gli oggetti erano già selezionati self.AddRemoveSelSet(selSet, False) # rimuovo il gruppo di selezione else: self.AddRemoveSelSet(selSet, True) # aggiungo il gruppo di selezione else: self.AddRemoveSelSet(selSet, False) # rimuovo il gruppo di selezione else: # senza tasto shift if self.pickAdd == 0: # The objects most recently selected become the selection set self.SetSelSet(selSet) else: self.AddRemoveSelSet(selSet, True) # aggiungo il gruppo di selezione else: # se si deve rimuovere dal gruppo di selezione self.AddRemoveEntity(selSet, False) # rimuovo il gruppo di selezione
def SetSelSet(self, selSet): for layerEntitySet in self.entitySet.layerEntitySetList: # se il layer non é presente in selSet if selSet.findLayerEntitySet(layerEntitySet) is None: layerEntitySet.deselectOnLayer() else: layerEntitySet.deselectOnLayer() self.entitySet.set(selSet) if self.checkDimLayers == True: dimEntitySet = QadEntitySet(selSet) # La funzione verifica se le entità che fanno parte di un entitySet sono anche parte di quotatura e, # in caso affermativo, aggiunge tutti i componenti delle quotature all'entitySet. QadDimStyles.addAllDimComponentsToEntitySet(dimEntitySet, self.onlyEditableLayers) self.entitySet.unite(dimEntitySet) self.showMsgOnAddRemove(self.entitySet.count()) self.entitySet.selectOnLayer(False) # incremental = False self.lastEntitySet.set(selSet)
def AddRemoveEntity(self, entity, Add): # controllo sul layer if self.onlyEditableLayers == True and entity.layer.isEditable() == False: self.showMsgOnAddRemove(0) return # controllo sul tipo if (self.checkPointLayer == False and entity.layer.geometryType() == QGis.Point) or \ (self.checkLineLayer == False and entity.layer.geometryType() == QGis.Line) or \ (self.checkPolygonLayer == False and entity.layer.geometryType() == QGis.Polygon): self.showMsgOnAddRemove(0) return # controllo su layer delle quotature if self.checkDimLayers == False and len(QadDimStyles.getDimListByLayer(entity.layer)) > 0: self.showMsgOnAddRemove(0) return self.entitySet.deselectOnLayer() if Add == True: # aggiungi al gruppo di selezione self.entitySet.addEntity(entity) else: # rimuovi dal gruppo di selezione self.entitySet.removeEntity(entity) if self.checkDimLayers == True: dimEntitySet = QadEntitySet() dimEntitySet.addEntity(entity) # La funzione verifica se le entità che fanno parte di un entitySet sono anche parte di quotatura e, # in caso affermativo, aggiunge/rimuove tutti i componenti delle quotature all'entitySet. QadDimStyles.addAllDimComponentsToEntitySet(dimEntitySet, self.onlyEditableLayers) if Add == True: # aggiungi al gruppo di selezione self.entitySet.unite(dimEntitySet) else: # rimuovi dal gruppo di selezione self.entitySet.subtract(dimEntitySet) self.showMsgOnAddRemove(dimEntitySet.count()) else: self.showMsgOnAddRemove(1) self.entitySet.selectOnLayer(False) # incremental = False self.lastEntitySet.clear() self.lastEntitySet.addEntity(entity)