本文整理汇总了Python中qad_highlight.QadHighlight类的典型用法代码示例。如果您正苦于以下问题:Python QadHighlight类的具体用法?Python QadHighlight怎么用?Python QadHighlight使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QadHighlight类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.entitySet = None
self.basePt = None
self.arrayType = None
self.distanceBetweenRows = None
self.distanceBetweenCols = None
self.itemsRotation = None
# serie rettangolare
self.rectangleAngle = None
self.rectangleCols = None
self.rectangleRows = None
self.firstPt = None
# serie traiettoria
self.pathTangentDirection = None
self.pathRows = None
self.pathItemsNumber = None
self.pathLinearObjectList = None
# serie polare
self.centerPt = None
self.polarItemsNumber = None
self.polarAngleBetween = None
self.polarRows = None
self.__highlight = QadHighlight(self.canvas)
示例2: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.entity = None
self.arc = None
self.coordTransform = None
self.__highlight = QadHighlight(self.canvas)
示例3: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.entitySet = QadEntitySet()
self.seriesLen = 0
self.adjust = False
self.__highlight = QadHighlight(self.canvas)
示例4: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.Pt1ReferenceLen = None
self.ReferenceLen = 0
self.Pt1NewLen = None
self.entitySet = QadEntitySet()
self.__highlight = QadHighlight(self.canvas)
示例5: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.firstPt = None
self.layer = None
self.subGeom = None
self.offSet = 0
self.lastOffSetOnLeftSide = 0
self.lastOffSetOnRightSide = 0
self.gapType = 0
self.__highlight = QadHighlight(self.canvas)
示例6: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.firstPt = None
self.mode = None
self.layer = None
self.linearObjectList = qad_utils.QadLinearObjectList()
self.linearObject = None
self.startPt = None
self.endPt = None
self.tolerance2ApproxCurve = None
self.__highlight = QadHighlight(self.canvas)
示例7: Qad_pedit_maptool
class Qad_pedit_maptool(QadGetPoint):
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.firstPt = None
self.mode = None
self.layer = None
self.linearObjectList = qad_utils.QadLinearObjectList()
self.tolerance2ApproxCurve = None
self.vertexAt = 0
self.vertexPt = None
self.after = True
self.basePt = None
self.__highlight = QadHighlight(self.canvas)
def hidePointMapToolMarkers(self):
QadGetPoint.hidePointMapToolMarkers(self)
self.__highlight.hide()
def showPointMapToolMarkers(self):
QadGetPoint.showPointMapToolMarkers(self)
self.__highlight.show()
def clear(self):
QadGetPoint.clear(self)
self.__highlight.reset()
self.mode = None
if self.basePt is not None:
del(self.basePt)
self.basePt = None
def setLinearObjectList(self, linearObjectList, layer):
self.linearObjectList.set(linearObjectList)
self.layer = layer
self.tolerance2ApproxCurve = QadVariables.get(QadMsg.translate("Environment variables", "TOLERANCE2APPROXCURVE"))
def setVertexAt(self, vertexAt, after = None):
if vertexAt == self.linearObjectList.qty():
self.firstPt = self.linearObjectList.getLinearObjectAt(-1).getEndPt()
else:
self.firstPt = self.linearObjectList.getLinearObjectAt(vertexAt).getStartPt()
self.vertexPt = QgsPoint(self.firstPt)
self.vertexAt = vertexAt
self.after = after
def canvasMoveEvent(self, event):
QadGetPoint.canvasMoveEvent(self, event)
self.__highlight.reset()
tmpLinearObjectList = None
# si richiede un nuovo vertice da inserire
if self.mode == Qad_pedit_maptool_ModeEnum.ASK_FOR_NEW_VERTEX:
if self.basePt is not None:
offSetX = self.tmpPoint.x() - self.basePt.x()
offSetY = self.tmpPoint.y() - self.basePt.y()
newPt = QgsPoint(self.vertexPt.x() + offSetX, self.vertexPt.y() + offSetY)
else:
newPt = QgsPoint(self.tmpPoint)
tmpLinearObjectList = qad_utils.QadLinearObjectList()
tmpLinearObjectList.set(self.linearObjectList)
if self.after: # dopo
if self.vertexAt == tmpLinearObjectList.qty() and tmpLinearObjectList.isClosed():
tmpLinearObjectList.insertPoint(0, newPt)
else:
tmpLinearObjectList.insertPoint(self.vertexAt, newPt)
else: # prima
if self.vertexAt == 0 and tmpLinearObjectList.isClosed():
tmpLinearObjectList.insertPoint(tmpLinearObjectList.qty() - 1, newPt)
else:
tmpLinearObjectList.insertPoint(self.vertexAt - 1, newPt)
elif self.mode == Qad_pedit_maptool_ModeEnum.ASK_FOR_MOVE_VERTEX:
newPt = QgsPoint(self.tmpPoint)
tmpLinearObjectList = qad_utils.QadLinearObjectList()
tmpLinearObjectList.set(self.linearObjectList)
tmpLinearObjectList.movePoint(self.vertexAt, newPt)
if tmpLinearObjectList is not None:
pts = tmpLinearObjectList.asPolyline(self.tolerance2ApproxCurve)
if self.layer.geometryType() == QGis.Polygon:
geom = QgsGeometry.fromPolygon([pts])
else:
geom = QgsGeometry.fromPolyline(pts)
# trasformo la geometria nel crs del layer
self.__highlight.addGeometry(self.mapToLayerCoordinates(self.layer, geom), self.layer)
def activate(self):
QadGetPoint.activate(self)
self.__highlight.show()
def deactivate(self):
#.........这里部分代码省略.........
示例8: Qad_gripStretch_maptool
class Qad_gripStretch_maptool(QadGetPoint):
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.selectedEntityGripPoints = [] # lista in cui ogni elemento è una entità + una lista di punti da stirare
self.__highlight = QadHighlight(self.canvas)
def hidePointMapToolMarkers(self):
QadGetPoint.hidePointMapToolMarkers(self)
self.__highlight.hide()
def showPointMapToolMarkers(self):
QadGetPoint.showPointMapToolMarkers(self)
self.__highlight.show()
def clear(self):
QadGetPoint.clear(self)
self.__highlight.reset()
self.mode = None
#============================================================================
# getSelectedEntityGripPointNdx
#============================================================================
def getSelectedEntityGripPointNdx(self, entity):
# lista delle entityGripPoint con dei grip point selezionati
# cerca la posizione di un'entità nella lista in cui ogni elemento è una entità + una lista di punti da stirare
i = 0
tot = len(self.selectedEntityGripPoints)
while i < tot:
selectedEntityGripPoint = self.selectedEntityGripPoints[i]
if selectedEntityGripPoint[0] == entity:
return i
i = i + 1
return -1
#============================================================================
# stretch
#============================================================================
def stretch(self, entity, ptList, offSetX, offSetY, tolerance2ApproxCurve):
# entity = entità da stirare
# ptList = lista dei punti da stirare
# offSetX, offSetY = spostamento da fare
# tolerance2ApproxCurve = tolleranza per ricreare le curve
# entitySet = gruppo di selezione delle entità da stirare
# verifico se l'entità appartiene ad uno stile di quotatura
if entity.whatIs() == "ENTITY":
stretchedGeom = entity.gripGeomStretch(self.basePt, ptList, offSetX, offSetY, tolerance2ApproxCurve)
if stretchedGeom is not None:
self.__highlight.addGeometry(stretchedGeom, entity.layer)
elif entity.whatIs() == "DIMENTITY":
# stiro la quota
entity.stretch(ptList, offSetX, offSetY)
self.__highlight.addGeometry(entity.textualFeature.geometry(), entity.getTextualLayer())
self.__highlight.addGeometries(entity.getLinearGeometryCollection(), entity.getLinearLayer())
self.__highlight.addGeometries(entity.getSymbolGeometryCollection(), entity.getSymbolLayer())
#============================================================================
# addStretchedGeometries
#============================================================================
def addStretchedGeometries(self, newPt):
self.__highlight.reset()
dimElaboratedList = [] # lista delle quotature già elaborate
for selectedEntity in self.selectedEntityGripPoints:
entity = selectedEntity[0]
ptList = selectedEntity[1]
layer = entity.layer
tolerance2ApproxCurve = QadVariables.get(QadMsg.translate("Environment variables", "TOLERANCE2APPROXCURVE"))
offSetX = newPt.x() - self.basePt.x()
offSetY = newPt.y() - self.basePt.y()
# verifico se l'entità appartiene ad uno stile di quotatura
if entity.isDimensionComponent() == False:
self.stretch(entity, ptList, offSetX, offSetY, tolerance2ApproxCurve)
else:
dimEntity = QadDimEntity()
if dimEntity.initByDimId(entity.dimStyle, entity.dimId):
found = False
for dimElaborated in dimElaboratedList:
if dimElaborated == dimEntity:
found = True
if found == False: # quota non ancora elaborata
dimEntitySet = dimEntity.getEntitySet()
# creo un'unica lista contenente i grip points di tutti i componenti della quota
dimPtlist = []
for layerEntitySet in dimEntitySet.layerEntitySetList:
for featureId in layerEntitySet.featureIds:
componentDim = QadEntity()
componentDim.set(layerEntitySet.layer, featureId)
i = self.getSelectedEntityGripPointNdx(componentDim)
if i >= 0:
dimPtlist.extend(self.selectedEntityGripPoints[i][1])
#.........这里部分代码省略.........
示例9: Qad_gripLineToArcConvert_maptool
class Qad_gripLineToArcConvert_maptool(QadGetPoint):
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.firstPt = None
self.mode = None
self.layer = None
self.linearObjectList = qad_utils.QadLinearObjectList()
self.linearObject = None
self.startPt = None
self.endPt = None
self.tolerance2ApproxCurve = None
self.__highlight = QadHighlight(self.canvas)
def hidePointMapToolMarkers(self):
QadGetPoint.hidePointMapToolMarkers(self)
self.__highlight.hide()
def showPointMapToolMarkers(self):
QadGetPoint.showPointMapToolMarkers(self)
self.__highlight.show()
def clear(self):
QadGetPoint.clear(self)
self.__highlight.reset()
self.mode = None
def setLinearObjectList(self, linearObjectList, layer, partAt):
self.linearObjectList.set(linearObjectList)
self.layer = layer
self.tolerance2ApproxCurve = QadVariables.get(QadMsg.translate("Environment variables", "TOLERANCE2APPROXCURVE"))
self.linearObject = self.linearObjectList.getLinearObjectAt(partAt)
self.firstPt = self.linearObject.getMiddlePt()
self.startPt = self.linearObject.getStartPt()
self.endPt = self.linearObject.getEndPt()
def canvasMoveEvent(self, event):
QadGetPoint.canvasMoveEvent(self, event)
self.__highlight.reset()
ok = False
# noti il punto iniziale e finale dell'arco si richiede il punto intermedio
if self.mode == Qad_gripLineToArcConvert_maptool_ModeEnum.START_END_PT_KNOWN_ASK_FOR_SECOND_PT:
if self.linearObject is None:
return
arc = QadArc()
if arc.fromStartSecondEndPts(self.startPt, self.tmpPoint, self.endPt) == False:
return
if qad_utils.ptNear(self.startPt, arc.getStartPt()):
self.linearObject.setArc(arc, False) # arco non inverso
else:
self.linearObject.setArc(arc, True) # arco inverso
ok = True
if ok:
pts = self.linearObjectList.asPolyline(self.tolerance2ApproxCurve)
if self.layer.geometryType() == QGis.Polygon:
geom = QgsGeometry.fromPolygon([pts])
else:
geom = QgsGeometry.fromPolyline(pts)
# trasformo la geometria nel crs del layer
self.__highlight.addGeometry(self.mapToLayerCoordinates(self.layer, geom), self.layer)
def activate(self):
QadGetPoint.activate(self)
self.__highlight.show()
def deactivate(self):
try: # necessario perché se si chiude QGIS parte questo evento nonostante non ci sia più l'oggetto maptool !
QadGetPoint.deactivate(self)
self.__highlight.hide()
except:
pass
def setMode(self, mode):
self.mode = mode
# noti il punto iniziale e finale dell'arco si richiede il punto intermedio
if self.mode == Qad_gripLineToArcConvert_maptool_ModeEnum.START_END_PT_KNOWN_ASK_FOR_SECOND_PT:
self.setSelectionMode(QadGetPointSelectionModeEnum.POINT_SELECTION)
self.setDrawMode(QadGetPointDrawModeEnum.ELASTIC_LINE)
self.setStartPoint(self.firstPt)
# non si richiede niente
elif self.mode == Qad_pedit_maptool_ModeEnum.NONE:
self.setSelectionMode(QadGetPointSelectionModeEnum.POINT_SELECTION)
self.setDrawMode(QadGetPointDrawModeEnum.NONE)
示例10: Qad_stretch_maptool
class Qad_stretch_maptool(QadGetPoint):
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.SSGeomList = [] # lista di entità da stirare con geom di selezione
self.__highlight = QadHighlight(self.canvas)
def hidePointMapToolMarkers(self):
QadGetPoint.hidePointMapToolMarkers(self)
self.__highlight.hide()
def showPointMapToolMarkers(self):
QadGetPoint.showPointMapToolMarkers(self)
self.__highlight.show()
def clear(self):
QadGetPoint.clear(self)
self.__highlight.reset()
self.mode = None
#============================================================================
# stretch
#============================================================================
def stretch(self, entity, containerGeom, offSetX, offSetY, tolerance2ApproxCurve):
# entity = entità da stirare
# ptList = lista dei punti da stirare
# offSetX, offSetY = spostamento da fare
# tolerance2ApproxCurve = tolleranza per ricreare le curve
# verifico se l'entità appartiene ad uno stile di quotatura
if entity.whatIs() == "ENTITY":
stretchedGeom = entity.getGeometry()
# controllo inserito perchè con le quote, questa viene cancellata e ricreata quindi alcuni oggetti potrebbero non esistere più
if stretchedGeom is None: # se non c'è lo salto senza errore
return True
# trasformo la geometria nel crs del canvas per lavorare con coordinate piane xy
coordTransform = QgsCoordinateTransform(entity.layer.crs(), self.canvas.mapSettings().destinationCrs())
stretchedGeom.transform(coordTransform)
# stiro la feature
stretchedGeom = qad_stretch_fun.stretchQgsGeometry(stretchedGeom, containerGeom, \
offSetX, offSetY, \
tolerance2ApproxCurve)
if stretchedGeom is not None:
# trasformo la geometria nel crs del layer
coordTransform = QgsCoordinateTransform(self.canvas.mapSettings().destinationCrs(), entity.layer.crs())
stretchedGeom.transform(coordTransform)
self.__highlight.addGeometry(stretchedGeom, entity.layer)
elif entity.whatIs() == "DIMENTITY":
newDimEntity = QadDimEntity(entity) # la copio
# stiro la quota
newDimEntity.stretch(containerGeom, offSetX, offSetY)
self.__highlight.addGeometry(newDimEntity.textualFeature.geometry(), newDimEntity.getTextualLayer())
self.__highlight.addGeometries(newDimEntity.getLinearGeometryCollection(), newDimEntity.getLinearLayer())
self.__highlight.addGeometries(newDimEntity.getSymbolGeometryCollection(), newDimEntity.getSymbolLayer())
return True
#============================================================================
# addStretchedGeometries
#============================================================================
def addStretchedGeometries(self, newPt):
self.__highlight.reset()
dimElaboratedList = [] # lista delle quotature già elaborate
tolerance2ApproxCurve = QadVariables.get(QadMsg.translate("Environment variables", "TOLERANCE2APPROXCURVE"))
offSetX = newPt.x() - self.basePt.x()
offSetY = newPt.y() - self.basePt.y()
entity = QadEntity()
for SSGeom in self.SSGeomList:
# copio entitySet
entitySet = QadEntitySet(SSGeom[0])
geomSel = SSGeom[1]
for layerEntitySet in entitySet.layerEntitySetList:
layer = layerEntitySet.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:
self.stretch(entity, geomSel, offSetX, offSetY, tolerance2ApproxCurve)
else:
found = False
for dimElaborated in dimElaboratedList:
if dimElaborated == dimEntity:
found = True
if found == False: # quota non ancora elaborata
dimElaboratedList.append(dimEntity)
self.stretch(dimEntity, geomSel, offSetX, offSetY, tolerance2ApproxCurve)
#.........这里部分代码省略.........
示例11: Qad_scale_maptool
class Qad_scale_maptool(QadGetPoint):
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.Pt1ReferenceLen = None
self.ReferenceLen = 0
self.Pt1NewLen = None
self.entitySet = QadEntitySet()
self.__highlight = QadHighlight(self.canvas)
def hidePointMapToolMarkers(self):
QadGetPoint.hidePointMapToolMarkers(self)
self.__highlight.hide()
def showPointMapToolMarkers(self):
QadGetPoint.showPointMapToolMarkers(self)
self.__highlight.show()
def clear(self):
QadGetPoint.clear(self)
self.__highlight.reset()
self.mode = None
#============================================================================
# scale
#============================================================================
def scale(self, f, basePt, scale, layerEntitySet, entitySet):
# verifico se l'entità appartiene ad uno stile di quotatura
dimEntity = QadDimStyles.getDimEntity(layerEntitySet.layer, f.id())
if dimEntity is None:
# scalo la feature e la rimuovo da entitySet (é la prima)
f.setGeometry(qad_utils.scaleQgsGeometry(f.geometry(), basePt, scale))
self.__highlight.addGeometry(f.geometry(), layerEntitySet.layer)
del layerEntitySet.featureIds[0]
else:
# scalo la quota e la rimuovo da entitySet
dimEntitySet = dimEntity.getEntitySet()
dimEntity.scale(basePt, scale)
self.__highlight.addGeometry(dimEntity.textualFeature.geometry(), dimEntity.getTextualLayer())
self.__highlight.addGeometries(dimEntity.getLinearGeometryCollection(), dimEntity.getLinearLayer())
self.__highlight.addGeometries(dimEntity.getSymbolGeometryCollection(), dimEntity.getSymbolLayer())
entitySet.subtract(dimEntitySet)
#============================================================================
# addScaledGeometries
#============================================================================
def addScaledGeometries(self, scale):
self.__highlight.reset()
# copio entitySet
entitySet = QadEntitySet(self.entitySet)
if scale <= 0:
return
for layerEntitySet in entitySet.layerEntitySetList:
layer = layerEntitySet.layer
transformedBasePt = self.canvas.mapSettings().mapToLayerCoordinates(layer, self.basePt)
while len(layerEntitySet.featureIds) > 0:
featureId = layerEntitySet.featureIds[0]
f = layerEntitySet.getFeature(featureId)
self.scale(f, transformedBasePt, scale, layerEntitySet, entitySet)
def canvasMoveEvent(self, event):
QadGetPoint.canvasMoveEvent(self, event)
# noto il punto base si richiede il secondo punto per la scala
if self.mode == Qad_scale_maptool_ModeEnum.BASE_PT_KNOWN_ASK_FOR_SCALE_PT:
scale = qad_utils.getDistance(self.basePt, self.tmpPoint)
self.addScaledGeometries(scale)
# noto il primo punto si richiede il secondo punto per la lunghezza di riferimento
elif self.mode == Qad_scale_maptool_ModeEnum.BASE_PT_KNOWN_ASK_FOR_NEW_LEN_PT:
len = qad_utils.getDistance(self.basePt, self.tmpPoint)
scale = len / self.ReferenceLen
self.addScaledGeometries(scale)
# noto il primo punto si richiede il secondo punto per la nuova lunghezza
elif self.mode == Qad_scale_maptool_ModeEnum.FIRST_PT_KNOWN_ASK_FOR_SECOND_NEW_LEN_PT:
len = qad_utils.getDistance(self.Pt1NewLen, self.tmpPoint)
scale = len / self.ReferenceLen
self.addScaledGeometries(scale)
def activate(self):
QadGetPoint.activate(self)
self.__highlight.show()
def deactivate(self):
try: # necessario perché se si chiude QGIS parte questo evento nonostante non ci sia più l'oggetto maptool !
QadGetPoint.deactivate(self)
self.__highlight.hide()
except:
pass
#.........这里部分代码省略.........
示例12: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.SSGeomList = [] # lista di entità da stirare con geom di selezione
self.__highlight = QadHighlight(self.canvas)
示例13: Qad_mirror_maptool
class Qad_mirror_maptool(QadGetPoint):
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.firstMirrorPt = None
self.entitySet = QadEntitySet()
self.__highlight = QadHighlight(self.canvas)
def hidePointMapToolMarkers(self):
QadGetPoint.hidePointMapToolMarkers(self)
self.__highlight.hide()
def showPointMapToolMarkers(self):
QadGetPoint.showPointMapToolMarkers(self)
self.__highlight.show()
def clear(self):
QadGetPoint.clear(self)
self.__highlight.reset()
self.mode = None
#============================================================================
# mirror
#============================================================================
def mirror(self, f, pt1, pt2, layerEntitySet, entitySet):
# verifico se la feature appartiene ad una quotatura
dimEntity = QadDimStyles.getDimEntity(layerEntitySet.layer, f.id())
if dimEntity is None:
# specchio la feature e la rimuovo da entitySet (é la prima)
f.setGeometry(qad_utils.mirrorQgsGeometry(f.geometry(), pt1, pt2))
self.__highlight.addGeometry(f.geometry(), layerEntitySet.layer)
del layerEntitySet.featureIds[0]
else:
# specchio la quota e la rimuovo da entitySet
dimEntitySet = dimEntity.getEntitySet()
dimEntity.mirror(pt1, qad_utils.getAngleBy2Pts(pt1, pt2))
self.__highlight.addGeometry(dimEntity.textualFeature.geometry(), dimEntity.getTextualLayer())
self.__highlight.addGeometries(dimEntity.getLinearGeometryCollection(), dimEntity.getLinearLayer())
self.__highlight.addGeometries(dimEntity.getSymbolGeometryCollection(), dimEntity.getSymbolLayer())
entitySet.subtract(dimEntitySet)
def setMirroredGeometries(self, newPt):
self.__highlight.reset()
# copio entitySet
entitySet = QadEntitySet(self.entitySet)
for layerEntitySet in entitySet.layerEntitySetList:
layer = layerEntitySet.layer
transformedFirstMirrorPt = self.canvas.mapSettings().mapToLayerCoordinates(layer, self.firstMirrorPt)
transformedNewPtMirrorPt = self.canvas.mapSettings().mapToLayerCoordinates(layer, newPt)
while len(layerEntitySet.featureIds) > 0:
featureId = layerEntitySet.featureIds[0]
f = layerEntitySet.getFeature(featureId)
self.mirror(f, transformedFirstMirrorPt, transformedNewPtMirrorPt, layerEntitySet, entitySet)
def canvasMoveEvent(self, event):
QadGetPoint.canvasMoveEvent(self, event)
# noto il primo punto si richiede il secondo punto della linea speculare
if self.mode == Qad_mirror_maptool_ModeEnum.FIRST_PT_KNOWN_ASK_FOR_SECOND_PT:
self.setMirroredGeometries(self.tmpPoint)
def activate(self):
QadGetPoint.activate(self)
self.__highlight.show()
def deactivate(self):
try: # necessario perché se si chiude QGIS parte questo evento nonostante non ci sia più l'oggetto maptool !
QadGetPoint.deactivate(self)
self.__highlight.hide()
except:
pass
def setMode(self, mode):
self.mode = mode
# noto niente si richiede il primo punto della linea speculare
if self.mode == Qad_mirror_maptool_ModeEnum.NONE_KNOWN_ASK_FOR_FIRST_PT:
self.setDrawMode(QadGetPointDrawModeEnum.NONE)
self.__highlight.reset()
# noto il primo punto si richiede il secondo punto della linea speculare
elif self.mode == Qad_mirror_maptool_ModeEnum.FIRST_PT_KNOWN_ASK_FOR_SECOND_PT:
self.setDrawMode(QadGetPointDrawModeEnum.ELASTIC_LINE)
self.setStartPoint(self.firstMirrorPt)
示例14: __init__
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.firstMirrorPt = None
self.entitySet = QadEntitySet()
self.__highlight = QadHighlight(self.canvas)
示例15: Qad_gripChangeArcRadius_maptool
class Qad_gripChangeArcRadius_maptool(QadGetPoint):
def __init__(self, plugIn):
QadGetPoint.__init__(self, plugIn)
self.basePt = None
self.entity = None
self.arc = None
self.coordTransform = None
self.__highlight = QadHighlight(self.canvas)
def hidePointMapToolMarkers(self):
QadGetPoint.hidePointMapToolMarkers(self)
self.__highlight.hide()
def showPointMapToolMarkers(self):
QadGetPoint.showPointMapToolMarkers(self)
self.__highlight.show()
def clear(self):
QadGetPoint.clear(self)
self.__highlight.reset()
self.mode = None
def setEntity(self, entity):
self.entity = QadEntity(entity)
self.arc = self.entity.getQadGeom() # arco in map coordinate
self.basePt = self.arc.center
self.coordTransform = QgsCoordinateTransform(self.canvas.mapRenderer().destinationCrs(), entity.layer.crs())
#============================================================================
# stretch
#============================================================================
def changeRadius(self, radius):
self.__highlight.reset()
# radius = nuovo raggio dell'arco
# tolerance2ApproxCurve = tolleranza per ricreare le curve
self.arc.radius = radius
points = self.arc.asPolyline()
if points is None:
return False
g = QgsGeometry.fromPolyline(points)
# trasformo la geometria nel crs del layer
g.transform(self.coordTransform)
self.__highlight.addGeometry(g, self.entity.layer)
def canvasMoveEvent(self, event):
QadGetPoint.canvasMoveEvent(self, event)
# noto il punto base si richiede il secondo punto per il raggio
if self.mode == Qad_gripChangeArcRadius_maptool_ModeEnum.BASE_PT_KNOWN_ASK_FOR_RADIUS_PT:
radius = qad_utils.getDistance(self.basePt, self.tmpPoint)
self.changeRadius(radius)
def activate(self):
QadGetPoint.activate(self)
self.__highlight.show()
def deactivate(self):
try: # necessario perché se si chiude QGIS parte questo evento nonostante non ci sia più l'oggetto maptool !
QadGetPoint.deactivate(self)
self.__highlight.hide()
except:
pass
def setMode(self, mode):
self.mode = mode
# noto niente si richiede il punto base
if self.mode == Qad_gripChangeArcRadius_maptool_ModeEnum.ASK_FOR_BASE_PT:
self.clear()
self.setDrawMode(QadGetPointDrawModeEnum.NONE)
self.__highlight.reset()
# noto il punto base si richiede il secondo punto per il raggio
elif self.mode == Qad_gripChangeArcRadius_maptool_ModeEnum.BASE_PT_KNOWN_ASK_FOR_RADIUS_PT:
self.setDrawMode(QadGetPointDrawModeEnum.ELASTIC_LINE)
self.setStartPoint(self.basePt)