Vue du type vecteur ou raster dans SIG

This commit is contained in:
Tom LAVEILLE 2025-07-23 16:00:36 +02:00
parent 3719456f04
commit 2690220a02
4 changed files with 64 additions and 54 deletions

View File

@ -59,6 +59,16 @@ import base64
global DeBUG
DeBUG = 0
itemIconRaster = QTableWidgetItem()
icon = QIcon()
icon.addPixmap(QtGui.QPixmap(resources_path('icons','mIconRaster.svg')), QIcon.Mode(0), QIcon.State(1))
itemIconRaster.setIcon(icon)
itemIconVecteur = QTableWidgetItem()
icon = QIcon()
icon.addPixmap(QtGui.QPixmap(resources_path('icons','mIconVecteur.svg')), QIcon.Mode(0), QIcon.State(1))
itemIconVecteur.setIcon(icon)
try:
account = login_base('account')
user = account[0]
@ -69,10 +79,9 @@ try:
sigdb = account[5]
refdb = account[6]
except:
print('')
print('Fails to login DB for account')
EDITOR_CLASS = load_ui('CenRa_Flux_base.ui')
html = '''<!DOCTYPE html>
<html>
@ -463,7 +472,7 @@ var Travaux = L.geoJSON(TravauxJSON,{
RasterList.append(rasterFind[0])
self.tableWidget.setRowCount(len(list_schema))
self.tableWidget.setColumnCount(3)
self.tableWidget.setColumnCount(4)
i=0
for value in list_schema:
if dbtype == sigdb:
@ -490,63 +499,60 @@ var Travaux = L.geoJSON(TravauxJSON,{
schema_name=str(value[0])
table_name=str(value[1])
elif type_val != '00' and type_val != '01' and type_val != '07' and type_val != '26' and type_val != '42' and type_val != '69' and type_val != 'ra':
if dbtype == refdb:
if (schema_name+'.'+table_name) in RasterList:
SVG = 'mIconRaster.svg'
else:
SVG = 'mIconWfs.svg'
itemIcon = QTableWidgetItem()
icon = QIcon()
icon.addPixmap(QtGui.QPixmap(resources_path('icons',SVG)), QIcon.Mode(0), QIcon.State(1))
itemIcon.setIcon(icon)
else:
type_val='agregation'
type_val='agregation'
schema_name=str(value[0])
table_name=str(value[1])
item = QTableWidgetItem(type_val)
if dbtype == refdb:
self.tableWidget.setItem(i,0,itemIcon)
if (str(value[0])+'.'+str(value[1])) in RasterList:
SVG='mIconRaster.svg'
else:
self.tableWidget.setCellWidget(i,0,None)
self.tableWidget.setItem(i,0,item)
item = QTableWidgetItem(schema_name)
SVG='mIconVecteur.svg'
itemIcon = QTableWidgetItem()
icon = QIcon()
icon.addPixmap(QtGui.QPixmap(resources_path('icons',SVG)), QIcon.Mode(0), QIcon.State(1))
itemIcon.setIcon(icon)
self.tableWidget.setItem(i,0,itemIcon)
item = QTableWidgetItem(type_val)
self.tableWidget.setItem(i,1,item)
item = QTableWidgetItem(table_name)
item = QTableWidgetItem(schema_name)
self.tableWidget.setItem(i,2,item)
item = QTableWidgetItem(table_name)
self.tableWidget.setItem(i,3,item)
i=i+1
self.tableWidget.setColumnWidth(0, 20)
self.tableWidget.setColumnWidth(1, 300)
self.tableWidget.setColumnWidth(1, 70)
self.tableWidget.setColumnWidth(2, 300)
self.tableWidget.setHorizontalHeaderLabels(["Code","Schema","Table"])
self.tableWidget.setColumnWidth(3, 300)
self.tableWidget.setHorizontalHeaderLabels(["Type","Code","Schema","Table"])
def selection_flux(self):
selected_row = 0
selected_items = self.tableWidget.selectedItems()
# Assuming you want to compare items in the first column for uniqueness
svgTake = (selected_items[2].tableWidget().cellWidget(0,0))
new_item_text = selected_items[2].text()
#svgTake = (selected_items[2].tableWidget().cellWidget(0,0))
new_item_text = selected_items[3].text()
if not self.item_already_exists(new_item_text):
self.tableWidget_2.insertRow(selected_row)
for column in range(self.tableWidget.columnCount()):
cloned_item = selected_items[column].clone()
self.tableWidget_2.setHorizontalHeaderLabels(["Code","Schema", "Table"])
self.tableWidget_2.setColumnCount(3)
self.tableWidget_2.setHorizontalHeaderLabels(["Type","Code","Schema", "Table"])
self.tableWidget_2.setColumnCount(4)
self.tableWidget_2.setItem(selected_row, column, cloned_item)
self.tableWidget_2.setColumnWidth(0, 50)
self.tableWidget_2.setColumnWidth(1, 300)
self.tableWidget_2.setColumnWidth(0, 20)
self.tableWidget_2.setColumnWidth(1, 70)
self.tableWidget_2.setColumnWidth(2, 300)
self.tableWidget_2.setColumnWidth(3, 300)
def item_already_exists(self, new_item_text):
# Assuming you want to compare items in the first column for uniqueness
existing_items = self.tableWidget_2.findItems(new_item_text, QtCore.Qt.MatchFlag(0))
# Check if there are any existing items with the same text in the first column
return len(existing_items) > 0
@ -613,26 +619,25 @@ var Travaux = L.geoJSON(TravauxJSON,{
for row in range(0, self.tableWidget_2.rowCount()):
color_rgba = 855030089
if self.tableWidget_2.item(row, 0).background().color().rgba() != 855030089:
if self.tableWidget_2.item(row, 1).background().color().rgba() != 855030089:
## supression de la partie de l'url après le point d'interrogation
if dbtype == sigdb:
code = self.tableWidget_2.item(row,0).text()
schema = '_'+code+'_'+self.tableWidget_2.item(row,1).text()
if code == 'travaux' or code == 'agregation':
schema = self.tableWidget_2.item(row,1).text()
table = self.tableWidget_2.item(row,2).text()
code = self.tableWidget_2.item(row,1).text()
schema = '_'+code+'_'+self.tableWidget_2.item(row,2).text()
if code == 'travaux' or code == 'agregation' :
schema = self.tableWidget_2.item(row,2).text()
table = self.tableWidget_2.item(row,3).text()
else:
table = self.tableWidget_2.item(row,2).text()
table = self.tableWidget_2.item(row,3).text()
table = schema+'_'+table
if dbtype == refdb:
# code = self.tableWidget_2.item(row,0).text()
schema = self.tableWidget_2.item(row,1).text()
table = self.tableWidget_2.item(row,2).text()#.split("?", 1)[0]
elif dbtype == refdb:
# code = self.tableWidget_2.item(row,1).text()
schema = self.tableWidget_2.item(row,2).text()
table = self.tableWidget_2.item(row,3).text()#.split("?", 1)[0]
uri = QgsDataSourceUri()
uri.setConnection(host ,port ,dbtype ,user ,mdp)
# nom du schéma à remplacer: "hydrographie" à supprimer et mettre "couches_collaboratives" lorsqu'on aura regroupé les couches à modifier dans un même schéma
if (schema+'.'+table) in RasterList:
uri.setDataSource(schema, table, "rast")
uri.setKeyColumn('rid')
@ -746,9 +751,16 @@ var Travaux = L.geoJSON(TravauxJSON,{
SchemaName = QTableWidgetItem(e[0][6:])
TableName = QTableWidgetItem(e[1][len(e[0])+1:])
self.tableWidget.insertRow(row_count)
self.tableWidget.setItem(row_count,0,DepName)
self.tableWidget.setItem(row_count,1,SchemaName)
self.tableWidget.setItem(row_count,2,TableName)
itemIcon = QTableWidgetItem()
icon = QIcon()
icon.addPixmap(QtGui.QPixmap(resources_path('icons','mIconVecteur.svg')), QIcon.Mode(0), QIcon.State(1))
itemIcon.setIcon(icon)
self.tableWidget.setItem(row_count,0,itemIcon)
self.tableWidget.setItem(row_count,1,DepName)
self.tableWidget.setItem(row_count,2,SchemaName)
self.tableWidget.setItem(row_count,3,TableName)
if TableSomme == 0:
for j in range(self.tableWidget.columnCount()):
self.tableWidget.item(row_count, j).setBackground(QtGui.QColor(246, 185, 73,50))

View File

@ -7,7 +7,7 @@ name=CenRa_FLUX
qgisMinimumVersion=3.0
supportsQt6=True
description=Permet d'ouvrire une table dans la base PostGis
version=3.2
version=3.3
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr
@ -19,7 +19,6 @@ email=si_besoin@cen-rhonealpes.fr
hasProcessingProvider=no
# Uncomment the following line and add your changelog:
# changelog= correctif de sécurité: envoi du certificat d'authentification seulement pour les couches fonciercen et drone / intégration des styles RPG geoportail / modification des noms de couches pour plus de clarté
# Tags are comma separated with spaces allowed
tags=cenra, postgis, database
@ -33,7 +32,7 @@ icon=icon.png
# experimental flag
experimental=False
changelog=<h2>CenRa_FLUX:</h2></br><p><h3>22/07/2025 - Version 3.2: </h3> - Visualisation des format raster et vecteur dans REF.</p></br><p><h3>21/07/2025 - Version 3.1: </h3> - Bug fix pour l'ouverture de plus de 5 couches.</p></br><p><h3>19/05/2025 - Version 3.0: </h3> - Compatible PyQt5 et PyQt6.</p></br><p><h3>09/04/2025 - Version 2.9: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 2.8: </h3> - Optimisation pour le TT.</p></br><p><h3>07/04/2025 - Version 2.7: </h3> - mode debug.</p></br><p><h3>03/04/2025 - Version 2.6: </h3> - Mise a jour de securite.</p></br><p><h3>20/03/2025 - Version 2.5: </h3> - Visualisation distincte des couches ne se trouvant pas dans l'antenne.</p></br><p><h3>13/02/2025 - Version 2.4: </h3> - Ajoute redimensionnement et déplacement mollette.</p></br><p><h3>05/02/2025 - Version 2.3: </h3> - Bouton de visualisation des couches se trouvent uniquement dans le canva de la carte.</p></br><p><h3>07/01/2025 - Version 2.2: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.1:</h3> - Correctif de bug.</br> - Evolution de la limit de 3 à 5. </br></p></br><p><h3>22/10/2024 - Version 2.0:</h3> - Reformatage du code.</br></p></br><p><h3>03/10/2024 - Version 1.14:</h3> - Remonte la fênetre dans la pille.</br></p><p><h3>13/09/2024 - Version 1.13:</h3>- MAJ sur le lien du changelog</br>- Bug-fix: Ouvre MultiPolygone et Polygon séparément.</p></br><p><h3>10/09/2024 - Version 1.11:</h3>- Ouverture de table contenant plusieurs géométries.</p></br><p><h3>26/08/2024 - Version 1.10:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p>
changelog=<h2>CenRa_FLUX:</h2></br><p><h3>23/07/2025 - Version 3.3: </h3> - Optimisation des chargement.</p></br><p><h3>22/07/2025 - Version 3.2: </h3> - Visualisation des format raster et vecteur dans REF.</p></br><p><h3>21/07/2025 - Version 3.1: </h3> - Bug fix pour l'ouverture de plus de 5 couches.</p></br><p><h3>19/05/2025 - Version 3.0: </h3> - Compatible PyQt5 et PyQt6.</p></br><p><h3>09/04/2025 - Version 2.9: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 2.8: </h3> - Optimisation pour le TT.</p></br><p><h3>07/04/2025 - Version 2.7: </h3> - mode debug.</p></br><p><h3>03/04/2025 - Version 2.6: </h3> - Mise a jour de securite.</p></br><p><h3>20/03/2025 - Version 2.5: </h3> - Visualisation distincte des couches ne se trouvant pas dans l'antenne.</p></br><p><h3>13/02/2025 - Version 2.4: </h3> - Ajoute redimensionnement et déplacement mollette.</p></br><p><h3>05/02/2025 - Version 2.3: </h3> - Bouton de visualisation des couches se trouvent uniquement dans le canva de la carte.</p></br><p><h3>07/01/2025 - Version 2.2: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.1:</h3> - Correctif de bug.</br> - Evolution de la limit de 3 à 5. </br></p></br><p><h3>22/10/2024 - Version 2.0:</h3> - Reformatage du code.</br></p></br><p><h3>03/10/2024 - Version 1.14:</h3> - Remonte la fênetre dans la pille.</br></p><p><h3>13/09/2024 - Version 1.13:</h3>- MAJ sur le lien du changelog</br>- Bug-fix: Ouvre MultiPolygone et Polygon séparément.</p></br><p><h3>10/09/2024 - Version 1.11:</h3>- Ouverture de table contenant plusieurs géométries.</p></br><p><h3>26/08/2024 - Version 1.10:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p>
# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False
@ -46,4 +45,3 @@ deprecated=False
# If the plugin can run on QGIS Server.
server=False

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -50,9 +50,9 @@
<tags>cenra,sicen</tags>
</pyqgis_plugin>
<pyqgis_plugin name="CenRa_FLUX" version="3.2">
<pyqgis_plugin name="CenRa_FLUX" version="3.3">
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
<version>3.2</version>
<version>3.3</version>
<qgis_minimum_version>3.16</qgis_minimum_version>
<homepage>https://plateformesig.cenra-outils.org/</homepage>
<file_name>CenRa_FLUX.zip</file_name>
@ -61,7 +61,7 @@
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_FLUX.zip</download_url>
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
<create_date>2024-02-06</create_date>
<update_date>2025-07-22</update_date>
<update_date>2025-07-23</update_date>
<experimental>False</experimental>
<deprecated>False</deprecated>
<tags>cenra,flux</tags>