Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rial/Qvista into prePro
  • Loading branch information
oriolmarti97 committed Mar 3, 2021
2 parents e17c84a + d2151c4 commit ed650ca
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 20 deletions.
Binary file modified Dades/Zones.gpkg
Binary file not shown.
1 change: 1 addition & 0 deletions moduls/QVCercadorAdreca.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def iniAdrecaNumero(self):
self.numeroCarrer = ''
self.coordAdreca = None
self.infoAdreca = None
self.NumeroOficial = ''

def connectarLineEdits(self):
self.leCarrer.textChanged.connect(self.esborrarNumero)
Expand Down
2 changes: 1 addition & 1 deletion moduls/QvAtributs.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def __len__(self):
# print(type(chart))
# print(vars(chart))

chart = QvChart()
chart = QvChart('C:/temp/qVista/dades/provaAtrs.html','Gràfic de prova atributs')
chart.setGeometry(50, 50, 1200, 700)
chart.setWindowTitle('Gràfics')

Expand Down
21 changes: 16 additions & 5 deletions moduls/QvAtributsForms.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,31 @@ def consulta(self):
self.title = self.layer.name() + " - Consulta fitxa element"
self.ui.groupBox.setVisible(False)

def setDefaultValues(self, feature):
for idx in self.layer.attributeList():
vDef = self.layer.defaultValue(idx, feature)
feature.setAttribute(idx, vDef)

def addRemoveButton(self, form):
bDel = QPushButton("Esborra element")
bDel.clicked.connect(lambda: self.remove(form.feature()))
buttonBox = form.findChild(QDialogButtonBox)
buttonBox.addButton(bDel, QDialogButtonBox.ResetRole)

def edicion(self, new):
self.newFeature = None
self.total = 1
form = QgsAttributeDialog(self.layer, self.features[0], False)
feature = self.features[0]
if new:
self.mode = QgsAttributeEditorContext.AddFeatureMode
self.title = self.layer.name() + " - Fitxa nou element"
self.setDefaultValues(feature)
form = QgsAttributeDialog(self.layer, feature, False)
else:
self.mode = QgsAttributeEditorContext.SingleEditMode
self.title = self.layer.name() + " - Edició fitxa element"
bDel = QPushButton("Esborra element")
bDel.clicked.connect(lambda: self.remove(form.feature()))
buttonBox = form.findChild(QDialogButtonBox)
buttonBox.addButton(bDel, QDialogButtonBox.ResetRole)
form = QgsAttributeDialog(self.layer, feature, False)
self.addRemoveButton(form)
form.setMode(self.mode)
form.attributeForm().featureSaved.connect(self.featureSaved)
form.accepted.connect(self.formAccepted)
Expand Down
17 changes: 12 additions & 5 deletions moduls/QvDigitizeFeature.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@
#
# TODO
#
# - Autogenerar clave fid desactivado en nueva versión QGIS
# - Comado alta y luego modif altera el reset de salida
# - Valores default de campos al modificar atributos o geometría
# - Combinar comandos dibujo con los de visualización
# - Al salir de qVista, controlar si hay ediciones abiertas con modificaciones pendientes
# - Propiedades de capa: identificable, searchable, necesaria, readonly
# - Herramienta de seleccion en todas las capas
# - Pruebas edición tabla Oracle
# - Repasar activacion dirty bit
# - Propiedades de capa: identificable, searchable, necesaria, readonly
# - Formulario de opciones de snapping
# - Edicion de geonetría: QgsVectorLayerEditUtils
#
# - Password Manager para acceder a capas protegidas
# - En qVista no se ven las capas protegidas
# - Geocodificación número 0
# - L:\Dades\SIT\VistaMoitor que apunte al nuevo QGIS
# - Fotos geolocalizadas / asignadas a un punto
#
# https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html
#
Expand All @@ -51,7 +56,7 @@ def __init__(self, digitize, capa):

def cadCanvasReleaseEvent(self, event):
# Finaliza tool de dibujo con botón derecho cuando no hay puntos dibujados
if self.tool == self and self.size() == 0 and event.button() == qtCor.Qt.RightButton:
if event.button() == qtCor.Qt.RightButton and (self.tool == self) and self.size() == 0:
# Si estamos redibujando, vuelve al principio para seleccionar otro elemento
redraw = (self.signal == self.redrawFeature)
self.unset()
Expand Down Expand Up @@ -182,6 +187,8 @@ def newFeature(self, feature):

def redraw(self):
if self.capa.isEditable():
if self.tool == self:
self.unset()
tool = QvSeleccioElement(self.canvas, self.llegenda, senyal=True)
tool.elementsSeleccionats.connect(self.selectFeature)
self.go(tool, True)
Expand Down
8 changes: 6 additions & 2 deletions moduls/QvMapForms.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,15 @@ def nouArxiu(self):
# Carga combo con zonas si el campo correspondiente está en el fichero CSV
num = 0
for zona, val in mv.MAP_ZONES.items():
if val[1] != '' and self.fCSV.prefixe + QvSqlite.getAlias(val[0]) in self.fCSV.camps:
if val[1] != '' and self.fCSV.prefixe + QvSqlite().getAlias(val[0]) in self.fCSV.camps:
self.zona.addItem(zona)
num = num + 1

# Comprobar si la extensión del mapa está limitada
# Comprobar si la extensión del mapa está limitada:
# Si lo está (el fichero contiene más de 75% de registros con el mismo distrito):
# - La mapificación por distrito se desahabilita.
# Si no (el fichero abarca la totalidad de Barcelona):
# - Se impide la mapificación por solar.
if num > 0:
extensio = self.fCSV.testExtensioArxiu(mv.MAP_EXTENSIO)
if extensio: # Mapa limitado
Expand Down
2 changes: 2 additions & 0 deletions moduls/QvMapVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
MAP_ALPHA_INI = 18
MAP_ALPHA_FIN = 18
MAP_ZONES_DB = "Zones.gpkg"

# testExtensioArxiu
MAP_FEQ_EXTENSIO = 0.75
MAP_EXTENSIO = "DISTRICTE"
MAP_TRUE_EXTENSIO = "Districte"
Expand Down
8 changes: 4 additions & 4 deletions moduls/QvMapificacio.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def geocodificacio(self, campsAdreca: List[str], zones: List[str], fZones: str =
self.camps = [self.netejaString(camp) for camp in self.camps]

for campZona in self.campsZones:
campZona = QvSqlite.getAlias(campZona)
campZona = QvSqlite().getAlias(campZona)
campSortida = self.prefixe + campZona
if campSortida not in self.camps:
self.camps.append(campSortida)
Expand Down Expand Up @@ -405,7 +405,7 @@ def geocodificacio(self, campsAdreca: List[str], zones: List[str], fZones: str =
num += 1
else:
for campZona in self.campsZones:
campZona = QvSqlite.getAlias(campZona)
campZona = QvSqlite().getAlias(campZona)
campSortida = self.prefixe + campZona
campNou = (campSortida not in row.keys())
if (campNou or self.substituir or
Expand Down Expand Up @@ -504,7 +504,7 @@ def verifZona(self, zona: str) -> bool:
return False
else:
self.valZona = mv.MAP_ZONES[self.zona]
self.campZona = self.prefixe + QvSqlite.getAlias(self.valZona[0])
self.campZona = self.prefixe + QvSqlite().getAlias(self.valZona[0])
if self.campZona not in self.camps:
return False
return True
Expand Down Expand Up @@ -715,7 +715,7 @@ def generaCapaGpd(self, nomCapa: str, tipusAgregacio: str, tipusDistribucio: str
if campExt != '':
cnt = csv[campExt].value_counts(normalize=True)
if cnt.iloc[0] >= mv.MAP_FEQ_EXTENSIO:
if campExtensio == QvSqlite.getAlias(self.valZona[0]):
if campExtensio == QvSqlite().getAlias(self.valZona[0]):
campExtensio = 'CODI'
valExtensio = cnt.index[0]
listExtensions = cnt.index.tolist()
Expand Down
2 changes: 1 addition & 1 deletion moduls/QvSqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def campsCarrerNum(self, camps, codiCarrer, num='0'):
if self.query.exec_(select) and self.query.next():
result = {}
for i, camp in enumerate(camps):
camp = QvSqlite.getAlias(camp)
camp = QvSqlite().getAlias(camp)
result[camp] = self.query.value(i)
self.query.finish()
return result
Expand Down
4 changes: 2 additions & 2 deletions qVista.py
Original file line number Diff line number Diff line change
Expand Up @@ -2424,8 +2424,8 @@ def missatgeDesar(self, titol="Sortir de qVista", txtDesar='Desar-los', txtDesca

#A més de desar, retornarà un booleà indicant si l'usuari ha desat (True) o ha cancelat (False)
def desarProjecte(self):
""" la funcio retorna si s'ha acabat guardant o no """
""" Protecció dels projectes read-only: tres vies:
""" la funcio retorna si s'ha acabat guardant o no
Protecció dels projectes read-only: tres vies:
- Variable del projecte qV_readOnly=’True’
- Ubicació en una carpeta de només-lectura
- Ubicació en una de les subcarpetes de N:\SITEB\APL\PyQgis\qVista
Expand Down

0 comments on commit ed650ca

Please sign in to comment.