def __init__(self, mapCanvas): QgsMapCanvasItem.__init__(self, mapCanvas) self.__canvas = mapCanvas self.__iconType = QadVertexmarkerIconTypeEnum.X # icon to be shown self.__iconSize = QadVariables.get(QadMsg.translate("Environment variables", "AUTOSNAPSIZE")) self.__center = QgsPoint(0, 0) # coordinates of the point in the center self.__color = QColor(255, 0, 0) # color of the marker self.__penWidth = 2 # pen width
def __init__(self, mapCanvas): QgsMapCanvasItem.__init__(self, mapCanvas) self.__canvas = mapCanvas self.__iconType = QadVertexmarkerIconTypeEnum.X # icon to be shown self.__iconSize = QadVariables.get( QadMsg.translate("Environment variables", "AUTOSNAPSIZE")) self.__center = QgsPoint(0, 0) # coordinates of the point in the center self.__color = QColor(255, 0, 0) # color of the marker self.__penWidth = 2 # pen width
def run(self, command, param=None): try: # se c'é un comando attivo if self.actualCommand is not None: return # eccezione per comando virtuale "QadVirtualSelCommandClass" che in realtà non è un comando # ma è usato per selezionare oggetti quando nessun comando è attivo if command == "QadVirtualSelCommandClass": self.actualCommand = QadVirtualSelCommandClass(self.plugIn) # param è la posizione corrente del mouse if self.actualCommand.run(False, param) == True: # comando terminato self.clearCommand() return # eccezione per comando virtuale "QadVirtualGripCommandsClass" che in realtà non è un comando # ma è usato per modificare gli oggetti selezionati da grip points if command == "QadVirtualGripCommandsClass": self.actualCommand = QadVirtualGripCommandsClass(self.plugIn) # param è una lista in cui: # il primo elemento è il codice del comando da eseguire # il secondo elemento è entitySetGripPoints # il terzo elemento è il punto del grip corrente self.actualCommand.entitySetGripPoints = param[1] self.actualCommand.basePt = param[2] self.actualCommand.initStartCommand(param[0]) if self.actualCommand.run(False) == True: # comando terminato self.clearCommand() return self.actualCommand = self.getCommandObj(command) if self.actualCommand is None: # verifico se è una variabile di sistema if QadVariables.get(command) is not None: self.showMsg("\n") # lancio comando SETVAR per settare la variabile args = [ QadMsg.translate("Command_list", "SETVAR"), command ] return self.runMacro(args) msg = QadMsg.translate("QAD", "\nInvalid command \"{0}\".") self.showErr(msg.format(command)) return self.usedCmdNames.setUsed(command) self.plugIn.clearEntityGripPoints( ) # pulisco i grip points correnti if self.actualCommand.run() == True: # comando terminato self.clearCommand() except Exception as e: self.abortCommand() displayError(e)
def run(self, command, param = None): try: # se c'é un comando attivo if self.actualCommand is not None: return # eccezione per comando virtuale "QadVirtualSelCommandClass" che in realtà non è un comando # ma è usato per selezionare oggetti quando nessun comando è attivo if command == "QadVirtualSelCommandClass": self.actualCommand = QadVirtualSelCommandClass(self.plugIn) # param è la posizione corrente del mouse if self.actualCommand.run(False, param) == True: # comando terminato self.clearCommand() return # eccezione per comando virtuale "QadVirtualGripCommandsClass" che in realtà non è un comando # ma è usato per modificare gli oggetti selezionati da grip points if command == "QadVirtualGripCommandsClass": self.actualCommand = QadVirtualGripCommandsClass(self.plugIn) # param è una lista in cui: # il primo elemento è il codice del comando da eseguire # il secondo elemento è entitySetGripPoints # il terzo elemento è il punto del grip corrente self.actualCommand.entitySetGripPoints = param[1] self.actualCommand.basePt = param[2] self.actualCommand.initStartCommand(param[0]) if self.actualCommand.run(False) == True: # comando terminato self.clearCommand() return self.actualCommand = self.getCommandObj(command) if self.actualCommand is None: # verifico se è una variabile di sistema if QadVariables.get(command) is not None: self.showMsg("\n") # lancio comando SETVAR per settare la variabile args = [QadMsg.translate("Command_list", "SETVAR"), command] return self.runMacro(args) msg = QadMsg.translate("QAD", "\nInvalid command \"{0}\".") self.showErr(msg.format(command)) return self.usedCmdNames.setUsed(command) self.plugIn.clearEntityGripPoints() # pulisco i grip points correnti if self.actualCommand.run() == True: # comando terminato self.clearCommand() except Exception as e: self.abortCommand() displayError(e)
def isValidEnvVariable(self, variable): # verifico se è una variabile di sistema if QadVariables.get(variable) is not None: return True else: return False