本文整理汇总了Python中qad_utils.toDegrees函数的典型用法代码示例。如果您正苦于以下问题:Python toDegrees函数的具体用法?Python toDegrees怎么用?Python toDegrees使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toDegrees函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rotate
def rotate(self, basePt, angle):
# basePt = punto base espresso in map coordinate
# restituisce una feature ruotata
canvas = qgis.utils.iface.mapCanvas()
destinationCrs = canvas.mapSettings().destinationCrs()
f = self.getFeature()
g = g.geometry()
g.transform(QgsCoordinateTransform(self.crs(), destinationCrs))
# ruoto la feature
g = qad_utils.rotateQgsGeometry(g, basePt, angle)
g.transform(QgsCoordinateTransform(destinationCrs, self.crs()))
f.setGeometry(g)
rotFldName = ""
if self.getEntityType() == QadEntityGeomTypeEnum.TEXT:
# se la rotazione dipende da un solo campo
rotFldNames = qad_label.get_labelRotationFieldNames(self.layer)
if len(rotFldNames) == 1 and len(rotFldNames[0]) > 0:
rotFldName = rotFldNames[0]
elif self.getEntityType() == QadEntityGeomTypeEnum.SYMBOL:
rotFldName = qad_layer.get_symbolRotationFieldName(self.layer)
if len(rotFldName) > 0:
rotValue = f.attribute(rotFldName)
# a volte vale None e a volte null (vai a capire...)
rotValue = 0 if rotValue is None or isinstance(rotValue, QPyNullVariant) else qad_utils.toRadians(rotValue) # la rotazione é in gradi nel campo della feature
rotValue = rotValue + angle
f.setAttribute(rotFldName, qad_utils.toDegrees(qad_utils.normalizeAngle(rotValue)))
return f
示例2: doMoveAndRotateGeom
def doMoveAndRotateGeom(plugIn, f, g, layer, offSetX, offSetY, angle, rotFldName, basePt, coordTransform, addToLayer, highlightObj):
# funzione di ausilio
newGeom = qad_utils.moveQgsGeometry(g, offSetX, offSetY)
if angle is not None:
newGeom = qad_utils.rotateQgsGeometry(newGeom, basePt, angle)
newGeom.transform(coordTransform)
if addToLayer:
newF = QgsFeature(f) # la copio perchè altrimenti qgis si incarta
newF.setGeometry(newGeom)
if len(rotFldName) > 0:
rotValue = newF.attribute(rotFldName)
# a volte vale None e a volte null (vai a capire...)
rotValue = 0 if rotValue is None or isinstance(rotValue, QPyNullVariant) else qad_utils.toRadians(rotValue) # la rotazione é in gradi nel campo della feature
rotValue = rotValue + angle
newF.setAttribute(rotFldName, qad_utils.toDegrees(qad_utils.normalizeAngle(rotValue)))
# plugIn, layer, feature, coordTransform, refresh, check_validity
if qad_layer.addFeatureToLayer(plugIn, layer, newF, None, False, False) == False:
return False
if highlightObj is not None:
highlightObj.addGeometry(newGeom, layer)
del newGeom
return True
示例3: rotate
def rotate(self, entity, basePt, angle, rotFldName):
# entity = entità da ruotare
# basePt = punto base
# angle = angolo di rotazione in gradi
# 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()
# ruoto l'entità
f.setGeometry(qad_utils.rotateQgsGeometry(entity.getGeometry(), basePt, angle))
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
rotValue = rotValue + angle
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":
# stiro la quota
if self.copyEntities == False:
if entity.deleteToLayers(self.plugIn) == False:
return False
entity.rotate(self.plugIn, basePt, angle)
if entity.addToLayers(self.plugIn) == False:
return False
return True
示例4: addFeature
def addFeature(self, layer):
transformedPoint = self.mapToLayerCoordinates(layer, self.insPt)
g = QgsGeometry.fromPoint(transformedPoint)
f = QgsFeature()
f.setGeometry(g)
# Add attribute fields to feature.
fields = layer.pendingFields()
f.setFields(fields)
# assegno i valori di default
provider = layer.dataProvider()
for field in fields.toList():
i = fields.indexFromName(field.name())
f[field.name()] = provider.defaultValue(i)
# se l'altezza testo dipende da un solo campo
sizeFldNames = qad_label.get_labelSizeFieldNames(layer)
if len(sizeFldNames) == 1 and len(sizeFldNames[0]) > 0:
f.setAttribute(sizeFldNames[0], self.hText)
# se la rotazione dipende da un solo campo
rotFldNames = qad_label.get_labelRotationFieldNames(layer)
if len(rotFldNames) == 1 and len(rotFldNames[0]) > 0:
f.setAttribute(rotFldNames[0], qad_utils.toDegrees(self.rot))
# setto i valori degli attributi che compongono l'etichetta
i = 0
tot = len(self.labelFields)
while i < tot:
f.setAttribute(self.labelFields[i].name(), self.labelFieldValues[i])
i = i + 1
return qad_layer.addFeatureToLayer(self.plugIn, layer, f)
示例5: addFeature
def addFeature(self, layer):
transformedPoint = self.mapToLayerCoordinates(layer, self.insPt)
g = QgsGeometry.fromPoint(transformedPoint)
f = QgsFeature()
f.setGeometry(g)
# Add attribute fields to feature.
fields = layer.pendingFields()
f.setFields(fields)
# assegno i valori di default
provider = layer.dataProvider()
for field in fields.toList():
i = fields.indexFromName(field.name())
f[field.name()] = provider.defaultValue(i)
# se la scala dipende da un campo
scaleFldName = qad_layer.get_symbolScaleFieldName(layer)
if len(scaleFldName) > 0:
f.setAttribute(scaleFldName, self.scale)
# se la rotazione dipende da un campo
rotFldName = qad_layer.get_symbolRotationFieldName(layer)
if len(rotFldName) > 0:
f.setAttribute(rotFldName, qad_utils.toDegrees(self.rot))
return qad_layer.addFeatureToLayer(self.plugIn, layer, f)
示例6: waitForReferenceRot
def waitForReferenceRot(self):
# imposto il map tool
self.getPointMapTool().setMode(Qad_rotate_maptool_ModeEnum.ASK_FOR_FIRST_PT_REFERENCE_ANG)
msg = QadMsg.translate("Command_GRIPROTATE", "Specify reference angle <{0}>: ")
# si appresta ad attendere un punto o enter o una parola chiave
# msg, inputType, default, keyWords, nessun controllo
self.waitFor(msg.format(str(qad_utils.toDegrees(self.plugIn.lastReferenceRot))), \
QadInputTypeEnum.POINT2D | QadInputTypeEnum.FLOAT, \
self.plugIn.lastReferenceRot, \
"")
self.step = 3
示例7: waitForTotalAngle
def waitForTotalAngle(self, msgMapTool, msg):
self.step = 9
self.OpType = "Angle"
# si appresta ad attendere l'angolo di rotazione
if self.GetAngleClass is not None:
del self.GetAngleClass
self.GetAngleClass = QadGetAngleClass(self.plugIn)
prompt = QadMsg.translate("Command_LENGTHEN", "Enter total angle <{0}>: ")
self.GetAngleClass.msg = prompt.format(str(qad_utils.toDegrees(self.plugIn.lastTotalAngle_lengthen)))
self.GetAngleClass.angle = self.plugIn.lastTotalAngle_lengthen
self.GetAngleClass.run(msgMapTool, msg)
示例8: waitForRotation
def waitForRotation(self):
# imposto il map tool
self.getPointMapTool().setMode(Qad_rotate_maptool_ModeEnum.BASE_PT_KNOWN_ASK_FOR_ROTATION_PT)
keyWords = QadMsg.translate("Command_ROTATE", "Copy") + "/" + \
QadMsg.translate("Command_ROTATE", "Reference")
prompt = QadMsg.translate("Command_ROTATE", "Specify rotation angle or [{0}] <{1}>: ").format(keyWords, \
str(qad_utils.toDegrees(self.plugIn.lastRot)))
englishKeyWords = "Copy" + "/" + "Reference"
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.FLOAT | QadInputTypeEnum.KEYWORDS, \
self.plugIn.lastRot, \
keyWords, QadInputModeEnum.NONE)
self.step = 3
示例9: showLength
def showLength(self, entity, pt):
# visualizza la lunghezza dell'entità in unità di mappa
geom = entity.getGeometry()
if geom is None:
errMsg = QadMsg.translate("QAD", "Invalid object.")
self.showErr("\n" + errMsg)
return None
# Trasformo il punto nel sistema di coordinate del layer
convPt = self.mapToLayerCoordinates(entity.layer, pt)
# ritorna una tupla (<The squared cartesian distance>,
# <minDistPoint>
# <afterVertex>
# <leftOf>)
dummy = qad_utils.closestSegmentWithContext(pt, geom)
if dummy[2] is None:
errMsg = QadMsg.translate("QAD", "Invalid object.")
self.showErr("\n" + errMsg)
return None
# ritorna la sotto-geometria al vertice <atVertex> e la sua posizione nella geometria (0-based)
subGeom, atSubGeom = qad_utils.getSubGeomAtVertex(geom, dummy[2])
LinearObjectListToMisure = qad_utils.QadLinearObjectList()
pointList = subGeom.asPolyline()
LinearObjectListToMisure.fromPolyline(pointList)
# la trasformo in unità di mappa
LinearObjectListToMisure.transformFromCRSToCRS(entity.layer.crs(), self.plugIn.canvas.mapSettings().destinationCrs())
msg = QadMsg.translate("Command_LENGTHEN", "\nCurrent length: {0}")
msg = msg.format(str(LinearObjectListToMisure.length()))
arc = QadArc()
startEndVertices = arc.fromPolyline(pointList, 0)
# se la polilinea è composta solo da un arco
if startEndVertices and startEndVertices[0] == 0 and startEndVertices[1] == len(pointList)-1:
msg = msg + QadMsg.translate("Command_LENGTHEN", ", included angle: {0}")
msg = msg.format(str(qad_utils.toDegrees(arc.totalAngle())))
self.showMsg(msg)
示例10: 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)
# a volte vale None e a volte null (vai a capire...)
rotValue = 0 if rotValue is None or isinstance(rotValue, QPyNullVariant) 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
newDimEntity = QadDimEntity(entity) # la copio
newDimEntity.mirror(pt1, mirrorAngle)
if newDimEntity.addToLayers(self.plugIn) == False:
return False
return True
示例11: rotate
def rotate(self, f, basePt, angle, rotFldName, layerEntitySet, entitySet):
# verifico se l'entità appartiene ad uno stile di quotatura
dimEntity = QadDimStyles.getDimEntity(layerEntitySet.layer, f.id())
if dimEntity is None:
# ruoto la feature e la rimuovo da entitySet (é la prima)
f.setGeometry(qad_utils.rotateQgsGeometry(f.geometry(), basePt, angle))
if len(rotFldName) > 0:
rotValue = f.attribute(rotFldName)
# a volte vale None e a volte null (vai a capire...)
rotValue = 0 if rotValue is None or isinstance(rotValue, QPyNullVariant) else qad_utils.toRadians(rotValue) # la rotazione é in gradi nel campo della feature
rotValue = rotValue + angle
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:
# ruoto la quota e la rimuovo da entitySet
dimEntitySet = dimEntity.getEntitySet()
if self.copyFeatures == False:
if dimEntity.deleteToLayers(self.plugIn) == False:
return False
newDimEntity = QadDimEntity(dimEntity) # la copio
newDimEntity.rotate(basePt, angle)
if newDimEntity.addToLayers(self.plugIn) == False:
return False
entitySet.subtract(dimEntitySet)
return True
示例12: run
def run(self, msgMapTool = False, msg = None):
if self.plugIn.canvas.mapRenderer().destinationCrs().geographicFlag():
self.showMsg(QadMsg.translate("QAD", "\nIl sistema di riferimento del progetto deve essere un sistema di coordinate proiettate.\n"))
return True # fine comando
currLayer, errMsg = qad_layer.getCurrLayerEditable(self.plugIn.canvas, QGis.Point)
if currLayer is None:
self.showErr(errMsg)
return True # fine comando
if qad_layer.isSymbolLayer(currLayer) == False:
errMsg = QadMsg.translate("QAD", "\nIl layer corrente non é di tipo simbolo.")
errMsg = errMsg + QadMsg.translate("QAD", "\nUn layer simbolo é un layer vettoriale di tipo punto senza etichetta.\n")
self.showErr(errMsg)
return True # fine comando
#=========================================================================
# RICHIESTA PUNTO DI INSERIMENTO
if self.step == 0: # inizio del comando
self.waitForPoint() # si appresta ad attendere un punto
self.step = self.step + 1
return False
#=========================================================================
# RISPOSTA ALLA RICHIESTA PUNTO DI INSERIMENTO
elif self.step == 1: # 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
return True # fine comando
else:
self.setMapTool(self.getPointMapTool()) # riattivo il maptool
return False
pt = self.getPointMapTool().point
else: # il punto arriva come parametro della funzione
pt = msg
self.insPt = QgsPoint(pt)
self.plugIn.setLastPoint(self.insPt)
# se la scala dipende da un campo
scaleFldName = qad_layer.get_symbolScaleFieldName(currLayer)
if len(scaleFldName) > 0:
# si appresta ad attendere la scala
self.GetDistClass = QadGetDistClass(self.plugIn)
prompt = QadMsg.translate("Command_INSERT", "Specificare la scala del simbolo <{0}>: ")
self.GetDistClass.msg = prompt.format(str(self.scale))
self.GetDistClass.dist = self.scale
self.GetDistClass.inputMode = QadInputModeEnum.NOT_NEGATIVE | QadInputModeEnum.NOT_ZERO
self.GetDistClass.startPt = self.insPt
self.step = 2
self.GetDistClass.run(msgMapTool, msg)
return False
else:
# se la rotazione dipende da un campo
rotFldName = qad_layer.get_symbolRotationFieldName(currLayer)
if len(rotFldName) > 0:
if self.GetAngleClass is not None:
del self.GetAngleClass
# si appresta ad attendere l'angolo di rotazione
self.GetAngleClass = QadGetAngleClass(self.plugIn)
prompt = QadMsg.translate("Command_INSERT", "Specificare la rotazione del simbolo <{0}>: ")
self.GetAngleClass.msg = prompt.format(str(qad_utils.toDegrees(self.rot)))
self.GetAngleClass.angle = self.rot
self.GetAngleClass.startPt = self.insPt
self.step = 3
self.GetAngleClass.run(msgMapTool, msg)
return False
else:
self.addFeature(currLayer)
return True
#=========================================================================
# RISPOSTA ALLA RICHIESTA SCALA (da step = 1)
elif self.step == 2:
if self.GetDistClass.run(msgMapTool, msg) == True:
if self.GetDistClass.dist is not None:
self.scale = self.GetDistClass.dist
self.plugIn.setLastScale(self.scale)
del self.GetDistClass
self.GetDistClass = None
# se la rotazione dipende da un campo
rotFldName = qad_layer.get_symbolRotationFieldName(currLayer)
if len(rotFldName) > 0:
if self.GetAngleClass is not None:
del self.GetAngleClass
# si appresta ad attendere l'angolo di rotazione
self.GetAngleClass = QadGetAngleClass(self.plugIn)
prompt = QadMsg.translate("Command_INSERT", "Specificare la rotazione del simbolo <{0}>: ")
self.GetAngleClass.msg = prompt.format(str(qad_utils.toDegrees(self.rot)))
self.GetAngleClass.angle = self.rot
self.GetAngleClass.startPt = self.insPt
#.........这里部分代码省略.........
示例13: run
def run(self, msgMapTool = False, msg = None):
if self.plugIn.canvas.mapSettings().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
currLayer, errMsg = qad_layer.getCurrLayerEditable(self.plugIn.canvas, QGis.Point)
if currLayer is None:
self.showErr(errMsg)
return True # fine comando
if qad_layer.isTextLayer(currLayer) == False:
errMsg = QadMsg.translate("QAD", "\nCurrent layer is not a textual layer.")
errMsg = errMsg + QadMsg.translate("QAD", "\nA textual layer is a vector punctual layer having a label and the symbol transparency no more than 10%.\n")
self.showErr(errMsg)
return True # fine comando
#=========================================================================
# RICHIESTA PUNTO DI INSERIMENTO
if self.step == 0: # inizio del comando
self.waitForPoint() # si appresta ad attendere un punto
self.step = self.step + 1
return False
#=========================================================================
# RISPOSTA ALLA RICHIESTA PUNTO DI INSERIMENTO
elif self.step == 1: # 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
return True # fine comando
else:
self.setMapTool(self.getPointMapTool()) # riattivo il maptool
return False
pt = self.getPointMapTool().point
else: # il punto arriva come parametro della funzione
pt = msg
self.insPt = QgsPoint(pt)
self.plugIn.setLastPoint(self.insPt)
# se l'altezza testo dipende da un solo campo
sizeFldNames = qad_label.get_labelSizeFieldNames(currLayer)
if len(sizeFldNames) == 1 and len(sizeFldNames[0]) > 0:
# si appresta ad attendere la scala
self.GetDistClass = QadGetDistClass(self.plugIn)
prompt = QadMsg.translate("Command_TEXT", "Specify the text height <{0}>: ")
self.GetDistClass.msg = prompt.format(str(self.hText))
self.GetDistClass.dist = self.hText
self.GetDistClass.inputMode = QadInputModeEnum.NOT_NEGATIVE | QadInputModeEnum.NOT_ZERO
self.GetDistClass.startPt = self.insPt
self.step = 2
self.GetDistClass.run(msgMapTool, msg)
return False
else:
# se la rotazione dipende da un solo campo
rotFldNames = qad_label.get_labelRotationFieldNames(currLayer)
if len(rotFldNames) == 1 and len(rotFldNames[0]) > 0:
if self.GetAngleClass is not None:
del self.GetAngleClass
# si appresta ad attendere l'angolo di rotazione
self.GetAngleClass = QadGetAngleClass(self.plugIn)
prompt = QadMsg.translate("Command_TEXT", "Specify the text rotation <{0}>: ")
self.GetAngleClass.msg = prompt.format(str(qad_utils.toDegrees(self.rot)))
self.GetAngleClass.angle = self.rot
self.GetAngleClass.startPt = self.insPt
self.step = 3
self.GetAngleClass.run(msgMapTool, msg)
return False
else:
self.initLabelFields(currLayer)
if self.waitForFieldValue() == False:
self.addFeature(currLayer)
return True
return False
#=========================================================================
# RISPOSTA ALLA RICHIESTA ALTEZZA TESTO (da step = 1)
elif self.step == 2:
if self.GetDistClass.run(msgMapTool, msg) == True:
if self.GetDistClass.dist is not None:
self.hText = self.GetDistClass.dist
self.plugIn.setLastHText(self.hText)
del self.GetDistClass
self.GetDistClass = None
# se la rotazione dipende da un solo campo
rotFldNames = qad_label.get_labelRotationFieldNames(currLayer)
if len(rotFldNames) == 1 and len(rotFldNames[0]) > 0:
if self.GetAngleClass is not None:
del self.GetAngleClass
# si appresta ad attendere l'angolo di rotazione
self.GetAngleClass = QadGetAngleClass(self.plugIn)
prompt = QadMsg.translate("Command_TEXT", "Specify the text rotation <{0}>: ")
#.........这里部分代码省略.........
示例14: waitForNewReferenceRot
def waitForNewReferenceRot(self):
# imposto il map tool
self.getPointMapTool().setMode(Qad_rotate_maptool_ModeEnum.BASE_PT_KNOWN_ASK_FOR_NEW_ROTATION_PT)
keyWords = QadMsg.translate("Command_ROTATE", "Points")
if self.plugIn.lastNewReferenceRot == 0:
angle = self.plugIn.lastRot
else:
angle = self.plugIn.lastNewReferenceRot
prompt = QadMsg.translate("Command_ROTATE", "Specify new angle or [{0}] <{1}>: ").format(keyWords, str(qad_utils.toDegrees(angle)))
englishKeyWords = "Points"
keyWords += "_" + englishKeyWords
# si appresta ad attendere un punto o enter o una parola chiave
# msg, inputType, default, keyWords, nessun controllo
self.waitFor(prompt, \
QadInputTypeEnum.POINT2D | QadInputTypeEnum.FLOAT | QadInputTypeEnum.KEYWORDS, \
angle, \
keyWords)
self.step = 6
示例15: init_text_tab
def init_text_tab(self):
self.onInit = True
index = self.textFont.findText(self.dimStyle.textFont)
self.textFont.setCurrentIndex(index)
self.textColor.setColor(QColor(self.dimStyle.textColor))
self.textHeight.setValue(self.dimStyle.textHeight)
# textVerticalPos
self.textVerticalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Centered"))
self.textVerticalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Above"))
self.textVerticalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Outside"))
self.textVerticalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Below"))
if self.dimStyle.textVerticalPos == QadDimStyleTxtVerticalPosEnum.CENTERED_LINE:
self.textVerticalPos.setCurrentIndex(0)
elif self.dimStyle.textVerticalPos == QadDimStyleTxtVerticalPosEnum.ABOVE_LINE:
self.textVerticalPos.setCurrentIndex(1)
elif self.dimStyle.textVerticalPos == QadDimStyleTxtVerticalPosEnum.EXTERN_LINE:
self.textVerticalPos.setCurrentIndex(2)
elif self.dimStyle.textVerticalPos == QadDimStyleTxtVerticalPosEnum.BELOW_LINE:
self.textVerticalPos.setCurrentIndex(3)
# textHorizontalPos
self.textHorizontalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Centered"))
self.textHorizontalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "At Ext Line 1"))
self.textHorizontalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "At Ext Line 2"))
self.textHorizontalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Over Ext Line 1"))
self.textHorizontalPos.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Over Ext Line 2"))
if self.dimStyle.textHorizontalPos == QadDimStyleTxtHorizontalPosEnum.CENTERED_LINE:
self.textHorizontalPos.setCurrentIndex(0)
elif self.dimStyle.textHorizontalPos == QadDimStyleTxtHorizontalPosEnum.FIRST_EXT_LINE:
self.textHorizontalPos.setCurrentIndex(1)
elif self.dimStyle.textHorizontalPos == QadDimStyleTxtHorizontalPosEnum.SECOND_EXT_LINE:
self.textHorizontalPos.setCurrentIndex(2)
elif self.dimStyle.textHorizontalPos == QadDimStyleTxtHorizontalPosEnum.FIRST_EXT_LINE_UP:
self.textHorizontalPos.setCurrentIndex(3)
elif self.dimStyle.textHorizontalPos == QadDimStyleTxtHorizontalPosEnum.SECOND_EXT_LINE_UP:
self.textHorizontalPos.setCurrentIndex(4)
# textDirection
self.textDirection.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Left-to-Right"))
self.textDirection.addItem(QadMsg.translate("DimStyle_Details_Dialog", "Right-to-Left"))
if self.dimStyle.textDirection == QadDimStyleTxtDirectionEnum.SX_TO_DX:
self.textDirection.setCurrentIndex(0)
elif self.dimStyle.textDirection == QadDimStyleTxtDirectionEnum.DX_TO_SX:
self.textDirection.setCurrentIndex(1)
self.textOffsetDist.setValue(self.dimStyle.textOffsetDist)
# textForcedRot
if self.dimStyle.textRotMode == QadDimStyleTxtRotModeEnum.HORIZONTAL:
self.textRotModeHorizontal.setChecked(True)
elif self.dimStyle.textRotMode == QadDimStyleTxtRotModeEnum.ALIGNED_LINE:
self.textRotModeAligned.setChecked(True)
elif self.dimStyle.textRotMode == QadDimStyleTxtRotModeEnum.ISO:
self.textRotModeISO.setChecked(True)
elif self.dimStyle.textRotMode == QadDimStyleTxtRotModeEnum.FORCED_ROTATION:
self.textRotModeFixedRot.setChecked(True)
self.textForcedRot.setValue(qad_utils.toDegrees(self.dimStyle.textForcedRot))
self.textRotModeFixedRotToggled(self.textRotModeFixedRot.isChecked())
self.onInit = False