Commit 0e6e0a0f authored by Alice Salsé's avatar Alice Salsé
Browse files

improve recalage plugin

parent 2ac75c1a
......@@ -407,33 +407,20 @@ class NetworkTools:
self.iface.messageBar().pushMessage("La couche doit être en édition", Qgis.Warning)
return
if layer.geometryType() == QgsWkbTypes.PointGeometry :
leves, ctrl = QInputDialog.getItem(QInputDialog(), "Levés", "Choisir les levés cible", ['Corrige', 'ESRI', 'Chapuis', 'CSV', 'DWG', 'ProxDWG'], 0)
if ctrl :
echecs=[]
l_qtablename=layer.dataProvider().uri().quotedTablename ()
for i in l_ids :
if leves == 'ESRI' :
query="UPDATE "+l_qtablename+" SET geom = ST_SetSRID(st_makepoint(x_reel_esri,y_reel_esri),2154), statut = 'recal auto ESRI' WHERE id = " + str(i)+ ";"
elif leves == 'Chapuis':
query="UPDATE "+l_qtablename+" SET geom = ST_SetSRID(st_makepoint(x_chapuis,y_chapuis),2154), statut = 'recal auto Chapuis' WHERE id = " + str(i)+ ";"
elif leves == 'Corrige':
query="UPDATE "+l_qtablename+" SET geom = ST_SetSRID(st_makepoint(x_corrige,y_corrige),2154), statut = 'recal auto Corrige' WHERE id = " + str(i)+ ";"
elif leves == 'CSV':
query="UPDATE "+l_qtablename+" SET geom = ST_SetSRID(st_makepoint(x_csv,y_csv),2154), statut = 'recal auto CSV' WHERE id = " + str(i)+ ";"
elif leves == 'DWG':
query="UPDATE "+l_qtablename+" SET geom = ST_SetSRID(st_makepoint(x_dwg,y_dwg),2154), statut = 'recal auto DWG' WHERE id = " + str(i)+ ";"
elif leves == 'ProxDWG':
query="UPDATE "+l_qtablename+" SET geom = ST_SetSRID(st_makepoint(x_proxdwg,y_proxdwg),2154), statut = 'recal auto prox DWG' WHERE id = " + str(i)+ ";"
result=layer.dataProvider().transaction().executeSql(query,True)
if result[0] == True :
pass
else :
echecs.append(str(i) + " : " + result[1].split('\n')[0])
if len(echecs) == 0 :
self.iface.messageBar().pushMessage("Recalage réussi pour {} objets".format(len(l_ids)), Qgis.Info)
echecs=[]
l_qtablename=layer.dataProvider().uri().quotedTablename ()
for i in l_ids :
query="UPDATE "+l_qtablename+" SET geom = ST_SetSRID(st_makepoint(x_reel,y_reel), 2154) WHERE id = " + str(i)+ ";"
result=layer.dataProvider().transaction().executeSql(query,True)
if result[0] == True :
pass
else :
self.iface.messageBar().pushMessage("Recalage echoué pour {}/{} : ".format(len(echecs),len(l_ids)) + ','.join(echecs), Qgis.Warning)
# return
echecs.append(str(i) + " : " + result[1].split('\n')[0])
if len(echecs) == 0 :
self.iface.messageBar().pushMessage("Recalage réussi pour {} objets".format(len(l_ids)), Qgis.Info)
else :
self.iface.messageBar().pushMessage("Recalage echoué pour {}/{} : ".format(len(echecs),len(l_ids)) + ','.join(echecs), Qgis.Warning)
# return
else :
self.iface.messageBar().pushMessage("La couche sélectionnée n'est pas de type point", Qgis.Warning)
return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment