Example #1
0
 def scale(self, entity, basePt, scale, sizeFldName):
    # entity = entità da scalare
    # basePt = punto base
    # scale = fattore di scala
    # sizeFldName = campo della tabella che memorizza la scala
    # verifico se l'entità appartiene ad uno stile di quotatura
    if entity.whatIs() == "ENTITY":
       f = entity.getFeature()
       # ruoto l'entità
       f.setGeometry(qad_utils.scaleQgsGeometry(entity.getGeometry(), basePt, scale))
       if len(sizeFldName) > 0:
          sizeValue = f.attribute(sizeFldName)
          if sizeValue is None:
             sizeValue = 1
          sizeValue = sizeValue * scale
          f.setAttribute(sizeFldName, sizeValue)                           
       
       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.scale(self.plugIn, basePt, scale)
       if entity.addToLayers(self.plugIn) == False:
          return False
Example #2
0
 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)
    def scale(self, f, basePt, scale, sizeFldName, 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))
            if sizeFldName is not None:
                sizeValue = f.attribute(sizeFldName)
                # a volte vale None e a volte null (vai a capire...)
                if sizeValue is None or isinstance(sizeValue, QPyNullVariant):
                    sizeValue = 1
                sizeValue = sizeValue * scale
                f.setAttribute(sizeFldName, sizeValue)

            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
            dimEntitySet = dimEntity.getEntitySet()
            if self.copyFeatures == False:
                if dimEntity.deleteToLayers(self.plugIn) == False:
                    return False
            newDimEntity = QadDimEntity(dimEntity)  # la copio
            newDimEntity.scale(basePt, scale)
            if newDimEntity.addToLayers(self.plugIn) == False:
                return False
            entitySet.subtract(dimEntitySet)
    def scale(self, entity, basePt, scale, sizeFldName):
        # entity = entità da scalare
        # basePt = punto base
        # scale = fattore di scala
        # sizeFldName = campo della tabella che memorizza la scala
        # verifico se l'entità appartiene ad uno stile di quotatura
        if entity.whatIs() == "ENTITY":
            f = entity.getFeature()
            # ruoto l'entità
            f.setGeometry(
                qad_utils.scaleQgsGeometry(entity.getGeometry(), basePt,
                                           scale))
            if len(sizeFldName) > 0:
                sizeValue = f.attribute(sizeFldName)
                # a volte vale None e a volte null (vai a capire...)
                if sizeValue is None or isinstance(sizeValue, QPyNullVariant):
                    sizeValue = 1
                sizeValue = sizeValue * scale
                f.setAttribute(sizeFldName, sizeValue)

            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.scale(basePt, scale)
            if newDimEntity.addToLayers(self.plugIn) == False:
                return False
Example #5
0
   def scale(self, f, basePt, scale, sizeFldName, 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))
         if sizeFldName is not None:
            sizeValue = f.attribute(sizeFldName)
            # a volte vale None e a volte null (vai a capire...)
            if sizeValue is None or isinstance(sizeValue, QPyNullVariant):
               sizeValue = 1
            sizeValue = sizeValue * scale
            f.setAttribute(sizeFldName, sizeValue)                           
         
         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
         dimEntitySet = dimEntity.getEntitySet()
         if self.copyFeatures == False:
            if dimEntity.deleteToLayers(self.plugIn) == False:
               return False                      
         newDimEntity = QadDimEntity(dimEntity) # la copio
         newDimEntity.scale(basePt, scale)
         if newDimEntity.addToLayers(self.plugIn) == False:
            return False             
         entitySet.subtract(dimEntitySet)
Example #6
0
    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)