forked from geosim/QAD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qad_mirror_cmd.py
601 lines (490 loc) · 26.8 KB
/
qad_mirror_cmd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QAD Quantum Aided Design plugin
comando MIRROR per spostare oggetti
-------------------
begin : 2013-12-11
copyright : iiiii
email : hhhhh
developers : bbbbb aaaaa ggggg
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
# Import the PyQt and QGIS libraries
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qad_mirror_maptool import *
from qad_generic_cmd import QadCommandClass
from qad_msg import QadMsg
from qad_getpoint import *
from qad_textwindow import *
from qad_ssget_cmd import QadSSGetClass
from qad_entity import *
import qad_utils
import qad_layer
import qad_label
# Classe che gestisce il comando MIRROR
class QadMIRRORCommandClass(QadCommandClass):
def instantiateNewCmd(self):
""" istanzia un nuovo comando dello stesso tipo """
return QadMIRRORCommandClass(self.plugIn)
def getName(self):
return QadMsg.translate("Command_list", "MIRROR")
def getEnglishName(self):
return "MIRROR"
def connectQAction(self, action):
QObject.connect(action, SIGNAL("triggered()"), self.plugIn.runMIRRORCommand)
def getIcon(self):
return QIcon(":/plugins/qad/icons/mirror.png")
def getNote(self):
# impostare le note esplicative del comando
return QadMsg.translate("Command_MIRROR", "Creates a mirrored copy of selected objects.")
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
def __del__(self):
QadCommandClass.__del__(self)
del self.SSGetClass
def getPointMapTool(self, drawMode = QadGetPointDrawModeEnum.NONE):
if self.step == 0: # quando si é in fase di selezione entità
return self.SSGetClass.getPointMapTool()
else:
if (self.plugIn is not None):
if self.PointMapTool is None:
self.PointMapTool = Qad_mirror_maptool(self.plugIn)
return self.PointMapTool
else:
return None
#============================================================================
# scale
#============================================================================
def mirror(self, f, pt1, pt2, rotFldName, layerEntitySet, entitySet, dimEntity):
if dimEntity is None:
# scalo la feature e la rimuovo da entitySet (é la prima)
f.setGeometry(qad_utils.mirrorQgsGeometry(f.geometry(), pt1, pt2))
if len(rotFldName) > 0:
rotValue = f.attribute(rotFldName)
rotValue = 0 if rotValue is None else qad_utils.toRadians(rotValue) # la rotazione é in gradi nel campo della feature
ptDummy = qad_utils.getPolarPointByPtAngle(pt1, rotValue, 1)
mirrorAngle = qad_utils.getAngleBy2Pts(pt1, pt2)
ptDummy = qad_utils.mirrorPoint(ptDummy, pt1, mirrorAngle)
rotValue = qad_utils.getAngleBy2Pts(pt1, ptDummy)
f.setAttribute(rotFldName, qad_utils.toDegrees(qad_utils.normalizeAngle(rotValue)))
if self.copyFeatures == False:
# plugIn, layer, feature, refresh, check_validity
if qad_layer.updateFeatureToLayer(self.plugIn, layerEntitySet.layer, f, False, False) == False:
self.plugIn.destroyEditCommand()
return False
else:
# plugIn, layer, features, coordTransform, refresh, check_validity
if qad_layer.addFeatureToLayer(self.plugIn, layerEntitySet.layer, f, None, False, False) == False:
self.plugIn.destroyEditCommand()
return False
del layerEntitySet.featureIds[0]
else:
# scalo la quota e la rimuovo da entitySet
mirrorAngle = qad_utils.getAngleBy2Pts(pt1, pt2)
dimEntitySet = dimEntity.getEntitySet()
if self.copyFeatures == False:
if dimEntity.deleteToLayers(self.plugIn) == False:
return False
dimEntity.mirror(self.plugIn, pt1, mirrorAngle)
if dimEntity.addToLayers(self.plugIn) == False:
return False
entitySet.subtract(dimEntitySet)
#============================================================================
# mirrorGeoms
#============================================================================
def mirrorGeoms(self):
# copio entitySet
entitySet = QadEntitySet(self.entitySet)
self.plugIn.beginEditCommand("Feature mirrored", self.entitySet.getLayerList())
for layerEntitySet in entitySet.layerEntitySetList:
layer = layerEntitySet.layer
transformedBasePt = self.mapToLayerCoordinates(layer, self.firstMirrorPt)
transformedNewPt = self.mapToLayerCoordinates(layer, self.secondMirrorPt)
rotFldName = ""
if qad_layer.isTextLayer(layer):
# se la rotazione dipende da un solo campo
rotFldNames = qad_label.get_labelRotationFieldNames(layer)
if len(rotFldNames) == 1 and len(rotFldNames[0]) > 0:
rotFldName = rotFldNames[0]
elif qad_layer.isSymbolLayer(layer):
rotFldName = qad_layer.get_symbolRotationFieldName(layer)
while len(layerEntitySet.featureIds) > 0:
featureId = layerEntitySet.featureIds[0]
f = layerEntitySet.getFeature(featureId)
entity = QadEntity()
entity.set(layer, featureId)
# verifico se l'entità appartiene ad uno stile di quotatura
dimStyle, dimId = QadDimStyles.getDimIdByEntity(entity)
if dimStyle is not None:
dimEntity = QadDimEntity()
if dimEntity.initByDimId(dimStyle, dimId) == False:
dimEntity = None
else:
dimEntity = None
if self.mirror(f, transformedBasePt, transformedNewPt, rotFldName, layerEntitySet, entitySet, dimEntity) == False:
self.plugIn.destroyEditCommand()
return
self.plugIn.endEditCommand()
def run(self, msgMapTool = False, msg = None):
if self.plugIn.canvas.mapRenderer().destinationCrs().geographicFlag():
self.showMsg(QadMsg.translate("QAD", "\nThe coordinate reference system of the project must be a projected coordinate system.\n"))
return True # fine comando
#=========================================================================
# RICHIESTA SELEZIONE OGGETTI
if self.step == 0: # inizio del comando
if self.SSGetClass.run(msgMapTool, msg) == True:
# selezione terminata
self.step = 1
self.getPointMapTool().refreshSnapType() # aggiorno lo snapType che può essere variato dal maptool di selezione entità
return self.run(msgMapTool, msg)
#=========================================================================
# SPECCHIA OGGETTI
elif self.step == 1:
self.entitySet.set(self.SSGetClass.entitySet)
if self.entitySet.count() == 0:
return True # fine comando
# imposto il map tool
self.getPointMapTool().entitySet.set(self.entitySet)
self.getPointMapTool().setMode(Qad_mirror_maptool_ModeEnum.NONE_KNOWN_ASK_FOR_FIRST_PT)
# si appresta ad attendere un punto
self.waitForPoint(QadMsg.translate("Command_MIRROR", "Specify first point of mirror line: "))
self.step = 2
return False
#=========================================================================
# RISPOSTA ALLA RICHIESTA PUNTO BASE (da step = 1)
elif self.step == 2: # dopo aver atteso un punto o un numero reale si riavvia il comando
if msgMapTool == True: # il punto arriva da una selezione grafica
# la condizione seguente si verifica se durante la selezione di un punto
# é stato attivato un altro plugin che ha disattivato Qad
# quindi stato riattivato il comando che torna qui senza che il maptool
# abbia selezionato un punto
if self.getPointMapTool().point is None: # il maptool é stato attivato senza un punto
if self.getPointMapTool().rightButton == True: # se usato il tasto destro del mouse
# si appresta ad attendere un punto
self.waitForPoint(QadMsg.translate("Command_MIRROR", "Specify first point of mirror line: "))
return False
else:
self.setMapTool(self.getPointMapTool()) # riattivo il maptool
return False
value = self.getPointMapTool().point
else: # il punto arriva come parametro della funzione
value = msg
self.firstMirrorPt.set(value.x(), value.y())
# imposto il map tool
self.getPointMapTool().firstMirrorPt = self.firstMirrorPt
self.getPointMapTool().setMode(Qad_mirror_maptool_ModeEnum.FIRST_PT_KNOWN_ASK_FOR_SECOND_PT)
# si appresta ad attendere un punto
self.waitForPoint(QadMsg.translate("Command_MIRROR", "Specify second point of mirror line: "))
self.step = 3
return False
#=========================================================================
# RISPOSTA ALLA RICHIESTA SECONDO PUNTO PER SPECCHIO (da step = 2)
elif self.step == 3: # dopo aver atteso un punto si riavvia il comando
if msgMapTool == True: # il punto arriva da una selezione grafica
# la condizione seguente si verifica se durante la selezione di un punto
# é stato attivato un altro plugin che ha disattivato Qad
# quindi stato riattivato il comando che torna qui senza che il maptool
# abbia selezionato un punto
if self.getPointMapTool().point is None: # il maptool é stato attivato senza un punto
if self.getPointMapTool().rightButton == True: # se usato il tasto destro del mouse
# si appresta ad attendere un punto
self.waitForPoint(QadMsg.translate("Command_MIRROR", "Specify second point of mirror line: "))
else:
self.setMapTool(self.getPointMapTool()) # riattivo il maptool
return False
value = self.getPointMapTool().point
else: # il punto arriva come parametro della funzione
value = msg
if qad_utils.ptNear(self.firstMirrorPt, value):
self.showMsg(QadMsg.translate("Command_MIRROR", "\nThe points must be different."))
# si appresta ad attendere un punto
self.waitForPoint(QadMsg.translate("Command_MIRROR", "Specify second point of mirror line: "))
return False
self.secondMirrorPt.set(value.x(), value.y())
keyWords = QadMsg.translate("QAD", "Yes") + "/" + \
QadMsg.translate("QAD", "No")
if self.copyFeatures == False:
default = QadMsg.translate("QAD", "Yes")
else:
default = QadMsg.translate("QAD", "No")
prompt = QadMsg.translate("Command_MIRROR", "Erase source objects ? [{0}] <{1}>: ").format(keyWords, default)
englishKeyWords = "Yes" + "/" + "No"
keyWords += "_" + englishKeyWords
# si appresta ad attendere enter o una parola chiave
# msg, inputType, default, keyWords, nessun controllo
self.waitFor(prompt, \
QadInputTypeEnum.KEYWORDS, \
default, \
keyWords, QadInputModeEnum.NONE)
self.getPointMapTool().setMode(Qad_mirror_maptool_ModeEnum.NONE_KNOWN_ASK_FOR_FIRST_PT)
self.step = 4
return False
#=========================================================================
# RISPOSTA ALLA RICHIESTA DI CANCELLAZIONE OGGETTO SORGENTE (da step = 3)
elif self.step == 4: # dopo aver atteso un punto o un numero reale si riavvia il comando
if msgMapTool == True: # il punto arriva da una selezione grafica
# la condizione seguente si verifica se durante la selezione di un punto
# é stato attivato un altro plugin che ha disattivato Qad
# quindi stato riattivato il comando che torna qui senza che il maptool
# abbia selezionato un punto
if self.getPointMapTool().rightButton == True: # se usato il tasto destro del mouse
value = QadMsg.translate("QAD", "No")
else:
self.setMapTool(self.getPointMapTool()) # riattivo il maptool
return False
else: # il valore arriva come parametro della funzione
value = msg
if type(value) == unicode:
if value == QadMsg.translate("QAD", "Yes") or value == "Yes":
self.copyFeatures = False
elif value == QadMsg.translate("QAD", "No") or value == "No":
self.copyFeatures = True
self.mirrorGeoms()
return True # fine comando
return False
# Classe che gestisce il comando MIRROR per i grip
class QadGRIPMIRRORCommandClass(QadCommandClass):
def instantiateNewCmd(self):
""" istanzia un nuovo comando dello stesso tipo """
return QadMIRRORCommandClass(self.plugIn)
def __init__(self, plugIn):
QadCommandClass.__init__(self, plugIn)
self.entitySet = QadEntitySet()
self.basePt = QgsPoint()
self.secondMirrorPt = QgsPoint()
self.skipToNextGripCommand = False
self.copyEntities = False
self.nOperationsToUndo = 0
def __del__(self):
QadCommandClass.__del__(self)
def getPointMapTool(self, drawMode = QadGetPointDrawModeEnum.NONE):
if (self.plugIn is not None):
if self.PointMapTool is None:
self.PointMapTool = Qad_mirror_maptool(self.plugIn)
return self.PointMapTool
else:
return None
#============================================================================
# setSelectedEntityGripPoints
#============================================================================
def setSelectedEntityGripPoints(self, entitySetGripPoints):
# lista delle entityGripPoint con dei grip point selezionati
self.entitySet.clear()
for entityGripPoints in entitySetGripPoints.entityGripPoints:
self.entitySet.addEntity(entityGripPoints.entity)
self.getPointMapTool().entitySet.set(self.entitySet)
#============================================================================
# mirror
#============================================================================
def mirror(self, entity, pt1, pt2, rotFldName):
# entity = entità da specchiare
# pt1 e pt2 = linea di simmetria
# rotFldName = campo della tabella che memorizza la rotazione
# verifico se l'entità appartiene ad uno stile di quotatura
if entity.whatIs() == "ENTITY":
f = entity.getFeature()
# specchio l'entità
f.setGeometry(qad_utils.mirrorQgsGeometry(entity.getGeometry(), pt1, pt2))
if len(rotFldName) > 0:
rotValue = f.attribute(rotFldName)
rotValue = 0 if rotValue is None else qad_utils.toRadians(rotValue) # la rotazione é in gradi nel campo della feature
ptDummy = qad_utils.getPolarPointByPtAngle(pt1, rotValue, 1)
mirrorAngle = qad_utils.getAngleBy2Pts(pt1, pt2)
ptDummy = qad_utils.mirrorPoint(ptDummy, pt1, mirrorAngle)
rotValue = qad_utils.getAngleBy2Pts(pt1, ptDummy)
f.setAttribute(rotFldName, qad_utils.toDegrees(qad_utils.normalizeAngle(rotValue)))
if self.copyEntities == False:
# plugIn, layer, feature, refresh, check_validity
if qad_layer.updateFeatureToLayer(self.plugIn, entity.layer, f, False, False) == False:
return False
else:
# plugIn, layer, features, coordTransform, refresh, check_validity
if qad_layer.addFeatureToLayer(self.plugIn, entity.layer, f, None, False, False) == False:
return False
elif entity.whatIs() == "DIMENTITY":
mirrorAngle = qad_utils.getAngleBy2Pts(pt1, pt2)
# specchio la quota
if self.copyEntities == False:
if entity.deleteToLayers(self.plugIn) == False:
return False
entity.mirror(self.plugIn, pt1, mirrorAngle)
if entity.addToLayers(self.plugIn) == False:
return False
return True
#============================================================================
# mirrorGeoms
#============================================================================
def mirrorGeoms(self):
entity = QadEntity()
self.plugIn.beginEditCommand("Feature mirrored", self.entitySet.getLayerList())
dimElaboratedList = [] # lista delle quotature già elaborate
for layerEntitySet in self.entitySet.layerEntitySetList:
layer = layerEntitySet.layer
transformedBasePt = self.mapToLayerCoordinates(layer, self.basePt)
transformedNewPt = self.mapToLayerCoordinates(layer, self.secondMirrorPt)
rotFldName = ""
if qad_layer.isTextLayer(layer):
# se la rotazione dipende da un solo campo
rotFldNames = qad_label.get_labelRotationFieldNames(layer)
if len(rotFldNames) == 1 and len(rotFldNames[0]) > 0:
rotFldName = rotFldNames[0]
elif qad_layer.isSymbolLayer(layer):
rotFldName = qad_layer.get_symbolRotationFieldName(layer)
for featureId in layerEntitySet.featureIds:
entity.set(layer, featureId)
# verifico se l'entità appartiene ad uno stile di quotatura
dimEntity = QadDimStyles.getDimEntity(entity)
if dimEntity is None:
if self.mirror(entity, transformedBasePt, transformedNewPt, rotFldName) == False:
self.plugIn.destroyEditCommand()
return
else:
found = False
for dimElaborated in dimElaboratedList:
if dimElaborated == dimEntity:
found = True
if found == False: # quota non ancora elaborata
dimElaboratedList.append(dimEntity)
if self.mirror(dimEntity, transformedBasePt, transformedNewPt, rotFldName) == False:
self.plugIn.destroyEditCommand()
return
self.plugIn.endEditCommand()
self.nOperationsToUndo = self.nOperationsToUndo + 1
#============================================================================
# waitForMirrorPoint
#============================================================================
def waitForMirrorPoint(self):
self.step = 1
self.plugIn.setLastPoint(self.basePt)
# imposto il map tool
self.getPointMapTool().firstMirrorPt = self.basePt
self.getPointMapTool().setMode(Qad_mirror_maptool_ModeEnum.FIRST_PT_KNOWN_ASK_FOR_SECOND_PT)
keyWords = QadMsg.translate("Command_GRIPMIRROR", "Base point") + "/" + \
QadMsg.translate("Command_GRIPMIRROR", "Copy") + "/" + \
QadMsg.translate("Command_GRIPMIRROR", "Undo") + "/" + \
QadMsg.translate("Command_GRIPMIRROR", "eXit")
prompt = QadMsg.translate("Command_GRIPMIRROR", "Specify second point or [{0}]: ").format(keyWords)
englishKeyWords = "Base point" + "/" + "Copy" + "/" + "Undo" + "/" + "eXit"
keyWords += "_" + englishKeyWords
# si appresta ad attendere un punto, un numero reale o enter o una parola chiave
# msg, inputType, default, keyWords, nessun controllo
self.waitFor(prompt, QadInputTypeEnum.POINT2D | QadInputTypeEnum.KEYWORDS, \
None, \
keyWords, QadInputModeEnum.NONE)
#============================================================================
# waitForBasePt
#============================================================================
def waitForBasePt(self):
self.step = 2
# imposto il map tool
self.getPointMapTool().setMode(Qad_mirror_maptool_ModeEnum.NONE_KNOWN_ASK_FOR_FIRST_PT)
# si appresta ad attendere un punto
self.waitForPoint(QadMsg.translate("Command_GRIPROTATE", "Specify base point: "))
def run(self, msgMapTool = False, msg = None):
if self.plugIn.canvas.mapRenderer().destinationCrs().geographicFlag():
self.showMsg(QadMsg.translate("QAD", "\nThe coordinate reference system of the project must be a projected coordinate system.\n"))
return True # fine comando
#=========================================================================
# RICHIESTA SELEZIONE OGGETTI
if self.step == 0: # inizio del comando
if self.entitySet.isEmpty(): # non ci sono oggetti da ruotare
return True
self.showMsg(QadMsg.translate("Command_GRIPMIRROR", "\n** MIRROR **\n"))
# si appresta ad attendere il secondo punto di specchio
self.waitForMirrorPoint()
#=========================================================================
# RISPOSTA ALLA RICHIESTA SECONDO PUNTO PER SPECCHIO
elif self.step == 1: # dopo aver atteso un punto si riavvia il comando
ctrlKey = False
if msgMapTool == True: # il punto arriva da una selezione grafica
# la condizione seguente si verifica se durante la selezione di un punto
# é stato attivato un altro plugin che ha disattivato Qad
# quindi stato riattivato il comando che torna qui senza che il maptool
# abbia selezionato un punto
if self.getPointMapTool().point is None: # il maptool é stato attivato senza un punto
if self.getPointMapTool().rightButton == True: # se usato il tasto destro del mouse
value = None
else:
self.setMapTool(self.getPointMapTool()) # riattivo il maptool
return False
ctrlKey = self.getPointMapTool().ctrlKey
value = self.getPointMapTool().point
else: # il punto arriva come parametro della funzione
value = msg
if type(value) == unicode:
if value == QadMsg.translate("Command_GRIPMIRROR", "Base point") or value == "Base point":
# si appresta ad attendere il punto base
self.waitForBasePt()
elif value == QadMsg.translate("Command_GRIPMIRROR", "Copy") or value == "Copy":
# Copia entità lasciando inalterate le originali
self.copyEntities = True
# si appresta ad attendere il secondo punto di specchio
self.waitForMirrorPoint()
elif value == QadMsg.translate("Command_GRIPMIRROR", "Undo") or value == "Undo":
if self.nOperationsToUndo > 0:
self.nOperationsToUndo = self.nOperationsToUndo - 1
self.plugIn.undoEditCommand()
else:
self.showMsg(QadMsg.translate("QAD", "\nThe command has been canceled."))
# si appresta ad attendere il secondo punto di specchio
self.waitForMirrorPoint()
elif value == QadMsg.translate("Command_GRIPMIRROR", "eXit") or value == "eXit":
return True # fine comando
elif type(value) == QgsPoint: # se é stato inserito il secondo punto
if qad_utils.ptNear(self.basePt, value):
self.showMsg(QadMsg.translate("Command_GRIPMIRROR", "\nThe points must be different."))
# si appresta ad attendere il secondo punto di specchio
self.waitForMirrorPoint()
return False
self.secondMirrorPt.set(value.x(), value.y())
if ctrlKey:
self.copyEntities = True
self.mirrorGeoms()
if self.copyEntities == False:
return True
# si appresta ad attendere il secondo punto di specchio
self.waitForMirrorPoint()
else:
if self.copyEntities == False:
self.skipToNextGripCommand = True
return True # fine comando
return False
#=========================================================================
# RISPOSTA ALLA RICHIESTA PUNTO BASE (da step = 1)
elif self.step == 2: # dopo aver atteso un punto
if msgMapTool == True: # il punto arriva da una selezione grafica
# la condizione seguente si verifica se durante la selezione di un punto
# é stato attivato un altro plugin che ha disattivato Qad
# quindi stato riattivato il comando che torna qui senza che il maptool
# abbia selezionato un punto
if self.getPointMapTool().point is None: # il maptool é stato attivato senza un punto
if self.getPointMapTool().rightButton == True: # se usato il tasto destro del mouse
pass # opzione di default "spostamento"
else:
self.setMapTool(self.getPointMapTool()) # riattivo il maptool
return False
value = self.getPointMapTool().point
else: # il punto arriva come parametro della funzione
value = msg
if type(value) == QgsPoint: # se é stato inserito il punto base
self.basePt.set(value.x(), value.y())
# si appresta ad attendere il secondo punto di specchio
self.waitForMirrorPoint()
return False