예제 #1
0
파일: qad_array_fun.py 프로젝트: geosim/QAD
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
예제 #2
0
    def move(self, f, offSetX, offSetY, layerEntitySet, entitySet):
        # verifico se l'entità appartiene ad uno stile di quotatura
        dimEntity = QadDimStyles.getDimEntity(layerEntitySet.layer, f.id())

        if dimEntity is None:
            # sposto la feature e la rimuovo da entitySet (é la prima)
            f.setGeometry(
                qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
            # plugIn, layer, feature, refresh, check_validity
            if qad_layer.updateFeatureToLayer(self.plugIn,
                                              layerEntitySet.layer, f, False,
                                              False) == False:
                return False
            del layerEntitySet.featureIds[0]
        else:
            # sposto la quota e la rimuovo da entitySet
            dimEntitySet = dimEntity.getEntitySet()
            if dimEntity.deleteToLayers(self.plugIn) == False:
                return False
            if dimEntity.move(offSetX, offSetY) == False:
                return False
            if dimEntity.addToLayers(self.plugIn) == False:
                return False
            entitySet.subtract(dimEntitySet)

        return True
예제 #3
0
파일: qad_move_cmd.py 프로젝트: gam17/QAD
 def move(self, entity, offSetX, offSetY):
    # entity = entità da spostare
    # 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":
       # sposto l'entità
       movedGeom = qad_utils.moveQgsGeometry(entity.getGeometry(), offSetX, offSetY)
       
       if movedGeom is not None:
          f = entity.getFeature()
          f.setGeometry(movedGeom)
          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                      
       newDimEntity = QadDimEntity(entity) # la copio
       newDimEntity.move(offSetX, offSetY)
       if newDimEntity.addToLayers(self.plugIn) == False:
          return False             
          
    return True
 def move(self, entity, offSetX, offSetY):
    # entity = entità da spostare
    # 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":
       # sposto l'entità
       movedGeom = qad_utils.moveQgsGeometry(entity.getGeometry(), offSetX, offSetY)
       
       if movedGeom is not None:
          f = entity.getFeature()
          f.setGeometry(movedGeom)
          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                      
       newDimEntity = QadDimEntity(entity) # la copio
       newDimEntity.move(offSetX, offSetY)
       if newDimEntity.addToLayers(self.plugIn) == False:
          return False             
          
    return True
예제 #5
0
 def move(self, f, offSetX, offSetY, layerEntitySet, entitySet, dimEntity):
    if dimEntity is None:
       # sposto la feature 
       f.setGeometry(qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
       self.__highlight.addGeometry(f.geometry(), layerEntitySet.layer)
    else:
       # sposto la quota
       dimEntity.move(offSetX, offSetY)
       self.__highlight.addGeometry(dimEntity.textualFeature.geometry(), dimEntity.getTextualLayer())
       self.__highlight.addGeometries(dimEntity.getLinearGeometryCollection(), dimEntity.getLinearLayer())
       self.__highlight.addGeometries(dimEntity.getSymbolGeometryCollection(), dimEntity.getSymbolLayer())
예제 #6
0
 def move(self, entity, offSetX, offSetY):
    # verifico se l'entità appartiene ad uno stile di quotatura
    if entity.whatIs() == "ENTITY":
       # sposto l'entità
       movedGeom = qad_utils.moveQgsGeometry(entity.getGeometry(), offSetX, offSetY)
       if movedGeom is not None:
          self.__highlight.addGeometry(movedGeom, entity.layer)
    else:
       # sposto la quota
       entity.move(offSetX, offSetY)
       self.__highlight.addGeometry(entity.textualFeature.geometry(), entity.getTextualLayer())
       self.__highlight.addGeometries(entity.getLinearGeometryCollection(), entity.getLinearLayer())
       self.__highlight.addGeometries(entity.getSymbolGeometryCollection(), entity.getSymbolLayer())
예제 #7
0
파일: qad_copy_cmd.py 프로젝트: ermati/QAD
 def move(self, f, offSetX, offSetY, layerEntitySet, entitySet, dimEntity):
    if dimEntity is None:
       # sposto la feature e la rimuovo da entitySet (é la prima)
       f.setGeometry(qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
       # plugIn, layer, feature, coordTransform, refresh, check_validity
       if qad_layer.addFeatureToLayer(self.plugIn, layerEntitySet.layer, f, None, False, False) == False:  
          return False
    else:
       # sposto la quota
       dimEntity.move(offSetX, offSetY)                               
       if dimEntity.addToLayers(self.plugIn) == False:
          return False             
          
    return True
예제 #8
0
 def move(self, f, offSetX, offSetY, layerEntitySet, entitySet, dimEntity):
    if dimEntity is None:
       # sposto la feature e la rimuovo da entitySet (é la prima)
       f.setGeometry(qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
       self.__rubberBand.addGeometry(f.geometry(), layerEntitySet.layer)
       del layerEntitySet.featureIds[0]
    else:
       # sposto la quota e la rimuovo da entitySet
       dimEntitySet = dimEntity.getEntitySet()
       dimEntity.move(offSetX, offSetY)
       self.__rubberBand.addGeometry(dimEntity.textualFeature.geometry(), dimEntity.getTextualLayer())
       self.__rubberBand.addGeometries(dimEntity.getLinearGeometryCollection(), dimEntity.getLinearLayer())
       self.__rubberBand.addGeometries(dimEntity.getSymbolGeometryCollection(), dimEntity.getSymbolLayer())
       entitySet.subtract(dimEntitySet)
예제 #9
0
 def move(self, f, offSetX, offSetY, layerEntitySet, entitySet, dimEntity):
    if dimEntity is None:
       # sposto la feature e la rimuovo da entitySet (é la prima)
       f.setGeometry(qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
       # plugIn, layer, feature, coordTransform, refresh, check_validity
       if qad_layer.addFeatureToLayer(self.plugIn, layerEntitySet.layer, f, None, False, False) == False:  
          return False
    else:
       newDimEntity = QadDimEntity(dimEntity) # la copio
       # sposto la quota
       newDimEntity.move(offSetX, offSetY)
       if newDimEntity.addToLayers(self.plugIn) == False:
          return False             
          
    return True
예제 #10
0
 def move(self, f, offSetX, offSetY, layerEntitySet, entitySet, dimEntity):
     if dimEntity is None:
         # sposto la feature
         f.setGeometry(
             qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
         self.__highlight.addGeometry(f.geometry(), layerEntitySet.layer)
     else:
         # sposto la quota
         dimEntity.move(offSetX, offSetY)
         self.__highlight.addGeometry(dimEntity.textualFeature.geometry(),
                                      dimEntity.getTextualLayer())
         self.__highlight.addGeometries(
             dimEntity.getLinearGeometryCollection(),
             dimEntity.getLinearLayer())
         self.__highlight.addGeometries(
             dimEntity.getSymbolGeometryCollection(),
             dimEntity.getSymbolLayer())
예제 #11
0
 def move(self, f, offSetX, offSetY, layerEntitySet, entitySet):
    # verifico se l'entità appartiene ad uno stile di quotatura
    dimEntity = self.plugIn.dimStyles.getDimEntity(layerEntitySet.layer, f.id())
    
    if dimEntity is None:
       # sposto la feature e la rimuovo da entitySet (é la prima)
       f.setGeometry(qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
       self.__rubberBand.addGeometry(f.geometry(), layerEntitySet.layer)
       del layerEntitySet.featureIds[0]
    else:
       # sposto la quota e la rimuovo da entitySet
       dimEntitySet = dimEntity.getEntitySet()
       dimEntity.move(offSetX, offSetY)
       self.__rubberBand.addGeometry(dimEntity.textualFeature.geometry(), dimEntity.getTextualLayer())
       self.__rubberBand.addGeometries(dimEntity.getLinearGeometryCollection(), dimEntity.getLinearLayer())
       self.__rubberBand.addGeometries(dimEntity.getSymbolGeometryCollection(), dimEntity.getSymbolLayer())
       entitySet.subtract(dimEntitySet)
예제 #12
0
파일: qad_copy_cmd.py 프로젝트: luipir/QAD
 def move(self, f, offSetX, offSetY, layerEntitySet, entitySet):    
    # verifico se l'entità appartiene ad uno stile di quotatura
    dimEntity = self.plugIn.dimStyles.getDimEntity(layerEntitySet.layer, f.id())
    
    if dimEntity is None:
       # sposto la feature e la rimuovo da entitySet (é la prima)
       f.setGeometry(qad_utils.moveQgsGeometry(f.geometry(), offSetX, offSetY))
       # plugIn, layer, feature, coordTransform, refresh, check_validity
       if qad_layer.addFeatureToLayer(self.plugIn, layerEntitySet.layer, f, None, False, False) == False:  
          return False
       del layerEntitySet.featureIds[0]
    else:
       # sposto la quota e la rimuovo da entitySet
       dimEntitySet = dimEntity.getEntitySet()
       dimEntity.move(offSetX, offSetY)                               
       if dimEntity.addToLayers(self.plugIn) == False:
          return False             
       entitySet.subtract(dimEntitySet)
          
    return True
 def move(self, entity, offSetX, offSetY):
     # verifico se l'entità appartiene ad uno stile di quotatura
     if entity.whatIs() == "ENTITY":
         # sposto l'entità
         movedGeom = qad_utils.moveQgsGeometry(entity.getGeometry(),
                                               offSetX, offSetY)
         if movedGeom is not None:
             self.__highlight.addGeometry(movedGeom, entity.layer)
     else:
         newDimEntity = QadDimEntity(entity)  # la copio
         # sposto la quota
         newDimEntity.move(offSetX, offSetY)
         self.__highlight.addGeometry(
             newDimEntity.textualFeature.geometry(),
             newDimEntity.getTextualLayer())
         self.__highlight.addGeometries(
             newDimEntity.getLinearGeometryCollection(),
             newDimEntity.getLinearLayer())
         self.__highlight.addGeometries(
             newDimEntity.getSymbolGeometryCollection(),
             newDimEntity.getSymbolLayer())
예제 #14
0
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