diff --git a/cadastre/cadastre_import.py b/cadastre/cadastre_import.py
index fa829ffc..79cefef4 100644
--- a/cadastre/cadastre_import.py
+++ b/cadastre/cadastre_import.py
@@ -40,7 +40,16 @@
from qgis.PyQt.QtCore import QObject, QSettings, Qt
from qgis.PyQt.QtWidgets import QApplication, QMessageBox
-from cadastre.definitions import URL_DOCUMENTATION, URL_FANTOIR
+from cadastre.definitions import (
+ IMPORT_MEMORY_ERROR_MESSAGE,
+ REGEX_BATI,
+ REGEX_FANTOIR,
+ REGEX_LOTLOCAL,
+ REGEX_NBATI,
+ REGEX_PDL,
+ REGEX_PROP,
+ URL_FANTOIR,
+)
from cadastre.dialogs.dialog_common import CadastreCommon
# Import ogr2ogr.py from the script folder
@@ -102,36 +111,42 @@ def __init__(self, dialog):
s = QSettings()
self.majicSourceFileNames = [
- {'key': '[FICHIER_BATI]',
- 'value': s.value("cadastre/batiFileName", 'REVBATI.800', type=str),
- 'table': 'bati',
- 'required': True
- },
- {'key': '[FICHIER_FANTOIR]',
- 'value': s.value("cadastre/fantoirFileName", 'TOPFANR.800', type=str),
- 'table': 'fanr',
- 'required': True
- },
- {'key': '[FICHIER_LOTLOCAL]',
- 'value': s.value("cadastre/lotlocalFileName", 'REVD166.800', type=str),
- 'table': 'lloc',
- 'required': False
- },
- {'key': '[FICHIER_NBATI]',
- 'value': s.value("cadastre/nbatiFileName", 'REVNBAT.800', type=str),
- 'table': 'nbat',
- 'required': True
- },
- {'key': '[FICHIER_PDL]',
- 'value': s.value("cadastre/pdlFileName", 'REVFPDL.800', type=str),
- 'table': 'pdll',
- 'required': False
- },
- {'key': '[FICHIER_PROP]',
- 'value': s.value("cadastre/propFileName", 'REVPROP.800', type=str),
- 'table': 'prop',
- 'required': True
- }
+ {
+ 'key': '[FICHIER_BATI]',
+ 'regex': s.value("cadastre/regexBati", REGEX_BATI, type=str),
+ 'table': 'bati',
+ 'required': True
+ },
+ {
+ 'key': '[FICHIER_FANTOIR]',
+ 'regex': s.value("cadastre/regexFantoir", REGEX_FANTOIR, type=str),
+ 'table': 'fanr',
+ 'required': True
+ },
+ {
+ 'key': '[FICHIER_LOTLOCAL]',
+ 'regex': s.value("cadastre/regexLotLocal", REGEX_LOTLOCAL, type=str),
+ 'table': 'lloc',
+ 'required': False
+ },
+ {
+ 'key': '[FICHIER_NBATI]',
+ 'regex': s.value("cadastre/regexNbati", REGEX_NBATI, type=str),
+ 'table': 'nbat',
+ 'required': True
+ },
+ {
+ 'key': '[FICHIER_PDL]',
+ 'regex': s.value("cadastre/regexPdl", REGEX_PDL, type=str),
+ 'table': 'pdll',
+ 'required': False
+ },
+ {
+ 'key': '[FICHIER_PROP]',
+ 'regex': s.value("cadastre/regexProp", REGEX_PROP, type=str),
+ 'table': 'prop',
+ 'required': True
+ },
]
if self.dialog.dbType == 'postgis':
@@ -329,7 +344,7 @@ def importMajic(self):
# Import MAJIC files into database
# No use of COPY FROM to allow import into distant databases
importScript = {
- 'title': 'Import des fichiers majic',
+ 'title': 'Import des fichiers MAJIC',
'method': self.import_majic_into_database
}
scriptList.append(importScript)
@@ -425,44 +440,24 @@ def importMajic(self):
return None
- def chunk(self, iterable, n=100000, padvalue=None):
- """
- Chunks an iterable (file, etc.)
- into pieces
- """
- from itertools import zip_longest
- return zip_longest(*[iter(iterable)] * n, fillvalue=padvalue)
-
- def import_majic_into_database(self) -> bool:
+ def get_available_majic_files(self) -> tuple[dict, dict]:
"""
- Method which read each majic file
- and bulk import data into temp tables
-
- Returns False if no file processed
+ Get the list of MAJIC files to import
"""
- processed_files_count = 0
- majic_files_key = []
majic_files_found = {}
-
- # Regex to remove all chars not in the range in ASCII table from space to ~
- # http://www.catonmat.net/blog/my-favorite-regex/
- r = re.compile(r"[^ -~]")
-
- # Loop through all majic files
-
- # 1st path to build the complet liste for each majic source type (nbat, bati, lloc, etc.)
- # and read 1st line to get departement and direction to compare to inputs
dep_dirs = {}
for item in self.majicSourceFileNames:
table = item['table']
- value = item['value']
- # Get majic files for item
+ file_regex = item['regex']
+ # Get MAJIC files for item
maj_list = []
for root, dirs, files in os.walk(self.dialog.majicSourceDir):
- for i in files:
- if os.path.split(i)[1] == value:
- file_path = os.path.join(root, i)
+ for file_sub_path in files:
+ # self.qc.updateLog(file_sub_path)
+ # Check if the file matches the regex given for this file type
+ if re.search(file_regex, os.path.split(file_sub_path)[1].upper()):
# Add file path to the list
+ file_path = os.path.join(root, file_sub_path)
maj_list.append(file_path)
# Store dep_dir for this file
@@ -481,23 +476,29 @@ def import_majic_into_database(self) -> bool:
majic_files_found[table] = maj_list
- # Check if some important majic files are missing
+ return dep_dirs, majic_files_found
+
+ def check_missing_majic_files(self, majic_files_found: dict) -> bool:
+ """
+ Check if the mandatory MAJIC files have been found in the directory
+ """
f_keys = [a for a in majic_files_found if majic_files_found[a]]
r_keys = [a['table'] for a in self.majicSourceFileNames if a['required']]
- m_keys = [a for a in r_keys if a not in f_keys]
- if m_keys:
+ missing_files = [a for a in r_keys if a not in f_keys]
+ if missing_files:
msg = (
- "Des fichiers MAJIC importants sont manquants: {}
"
- "Vérifier le chemin des fichiers MAJIC:
"
- "{}
"
- "ainsi que les noms des fichiers configurés dans les options du plugin Cadastre:
"
- "{}
"
- "Vous pouvez télécharger les fichiers fantoirs à cette adresse :
"
+ "Des fichiers MAJIC importants sont manquants :
"
+ " {}
"
+ "Vérifier le chemin des fichiers MAJIC :
"
+ "{}
"
+ "ainsi que les mots recherchés pour chaque type de fichier configurés dans les options du plugin Cadastre :
"
+ "{}
"
+ "NB: Vous pouvez télécharger les fichiers FANTOIR à cette adresse :
"
"{}
"
).format(
- ', '.join(m_keys),
+ ', '.join(missing_files),
self.dialog.majicSourceDir,
- ', '.join([a['value'].upper() for a in self.majicSourceFileNames]),
+ ',
'.join([f"* {a['key'].strip('[]')}: {a['regex'].upper()}" for a in self.majicSourceFileNames]),
URL_FANTOIR,
URL_FANTOIR,
)
@@ -512,6 +513,14 @@ def import_majic_into_database(self) -> bool:
self.qc.updateLog(msg)
return False
+ return True
+
+ def check_majic_departement_direction(self, dep_dirs: dict) -> bool:
+ """
+ Check if departement and direction are the same for every MAJIC file.
+ Check if departement and direction are different from those
+ given by the user in dialog
+ """
# Check if departement and direction are the same for every file
if len(list(dep_dirs.keys())) > 1:
self.go = False
@@ -523,6 +532,7 @@ def import_majic_into_database(self) -> bool:
"\n
{}".format(lst)
)
self.qc.updateLog("Veuillez réaliser l'import en %s fois." % len(list(dep_dirs.keys())))
+
return False
# Check if departement and direction are different from those given by the user in dialog
@@ -530,10 +540,11 @@ def import_majic_into_database(self) -> bool:
f_dir = list(dep_dirs.keys())[0][2:3]
if self.dialog.edigeoDepartement != f_dep or self.dialog.edigeoDirection != f_dir:
msg = (
- "ERREUR : MAJIC - Les numéros de département et de direction trouvés dans les fichiers "
- "ne correspondent pas à ceux renseignés dans les options du dialogue d'import:\n"
+ "ERREUR : MAJIC - Les numéros de département et de direction trouvés dans les fichiers "
+ "ne correspondent pas à ceux renseignés dans les options du dialogue d'import:\n"
"
"
- "* fichiers : {} et {}
* options : {} et {}"
+ "* fichiers : {} et {}
"
+ "* options : {} et {}"
).format(
f_dep,
f_dir,
@@ -557,8 +568,122 @@ def import_majic_into_database(self) -> bool:
else:
self.go = False
self.qc.updateLog(msg)
+
+ return False
+
+ return True
+
+ def chunk(self, iterable, pieces_number=100000, padvalue=None):
+ """
+ Chunks an iterable (file, etc.)
+ into pieces
+ """
+ try:
+ from itertools import zip_longest
+
+ return zip_longest(*[iter(iterable)] * pieces_number, fillvalue=padvalue)
+ except MemoryError:
+ self.qc.updateLog(IMPORT_MEMORY_ERROR_MESSAGE)
+ self.go = False
+
+ return
+
+ def import_majic_file_into_database(self, table_name: str, file_path: str, dep_dir: str) -> bool:
+ """
+ Import a single MAJIC file into the corresponding database table
+
+ For example, import a file REVPROP.txt into the "prop" table
+ """
+ # Regex to remove all chars not in the range in ASCII table from space to ~
+ # http://www.catonmat.net/blog/my-favorite-regex/
+ regex_remove_non_ascii = re.compile(r"[^ -~]")
+
+ # read file content
+ with open(file_path, encoding='ascii', errors='replace') as fin:
+ # Divide file into chunks
+ for a in self.chunk(fin, self.maxInsertRows):
+ # Build sql INSERT query depending on database
+ if self.dialog.dbType == 'postgis':
+ try:
+ sql = "BEGIN;"
+ sql = CadastreCommon.setSearchPath(sql, self.dialog.schema)
+ # Build INSERT list
+ sql += '\n'.join(
+ [
+ "INSERT INTO \"{}\" VALUES ({});".format(
+ table_name,
+ self.connector.quoteString(
+ regex_remove_non_ascii.sub(' ', x.strip('\r\n'))
+ )
+ ) for x in a if x and x[0:3] == dep_dir
+ ]
+ )
+ sql += "COMMIT;"
+ except MemoryError:
+ # Issue #326
+ self.qc.updateLog(IMPORT_MEMORY_ERROR_MESSAGE)
+ self.go = False
+
+ return False
+
+ self.executeSqlQuery(sql)
+ else:
+ try:
+ c = self.connector._get_cursor()
+ c.executemany(
+ f'INSERT INTO "{table_name}" VALUES (?)',
+ [(regex_remove_non_ascii.sub(' ', x.strip('\r\n')),) for x in a if x and x[0:3] == dep_dir])
+ self.connector._commit()
+ c.close()
+ del c
+ except MemoryError:
+ # Issue #326
+ self.qc.updateLog(IMPORT_MEMORY_ERROR_MESSAGE)
+ self.go = False
+
+ return False
+ except:
+ self.qc.updateLog(
+ ""
+ f"ERREUR : l'import du fichier '{file_path}' a échoué"
+ ""
+ )
+ self.go = False
+
+ return False
+
+ # Return False if chunk returned an error
+ if not self.go:
return False
+ return True
+
+ def import_majic_into_database(self) -> bool:
+ """
+ Method which read each majic file
+ and bulk import data into temp tables
+
+ Returns False if no file processed
+ """
+ processed_files_count = 0
+ majic_files_key = []
+
+ # Loop through all majic files
+
+ # 1st path to build the complet list for each majic source type (nbat, bati, lloc, etc.)
+ # and read 1st line to get departement and direction to compare to inputs
+ dep_dirs, majic_files_found = self.get_available_majic_files()
+
+ # Check if some important majic files are missing
+ check_missing = self.check_missing_majic_files(majic_files_found)
+ if not check_missing:
+ return False
+
+ # Check departement & direction
+ check_depdir = self.check_majic_departement_direction(dep_dirs)
+ if not check_depdir:
+ return False
+
# 2nd path to insert data
dep_dir = f'{self.dialog.edigeoDepartement}{self.dialog.edigeoDirection}'
for item in self.majicSourceFileNames:
@@ -568,49 +693,9 @@ def import_majic_into_database(self) -> bool:
for file_path in majic_files_found[table]:
self.qc.updateLog(file_path)
- # read file content
- with open(file_path, encoding='ascii', errors='replace') as fin:
- # Divide file into chunks
- for a in self.chunk(fin, self.maxInsertRows):
- # Build sql INSERT query depending on database
- if self.dialog.dbType == 'postgis':
- try:
- sql = "BEGIN;"
- sql = CadastreCommon.setSearchPath(sql, self.dialog.schema)
- # Build INSERT list
- sql += '\n'.join(
- [
- "INSERT INTO \"{}\" VALUES ({});".format(
- table,
- self.connector.quoteString(r.sub(' ', x.strip('\r\n')))
- ) for x in a if x and x[0:3] == dep_dir
- ]
- )
- sql += "COMMIT;"
- except MemoryError:
- # Issue #326
- self.qc.updateLog(
- ""
- "ERREUR : Mémoire - Veuillez recommencer l'import en changeant le "
- "paramètre 'Taille maximum des requêtes INSERT' selon la "
- "documentation : {}{}"
- "".format(
- URL_DOCUMENTATION,
- "/extension-qgis/configuration/#performances",
- )
- )
- self.go = False
- return False
-
- self.executeSqlQuery(sql)
- else:
- c = self.connector._get_cursor()
- c.executemany(
- f'INSERT INTO {table} VALUES (?)',
- [(r.sub(' ', x.strip('\r\n')),) for x in a if x and x[0:3] == dep_dir])
- self.connector._commit()
- c.close()
- del c
+ import_file = self.import_majic_file_into_database(table, file_path, dep_dir)
+ if not import_file:
+ continue
if not processed_files_count:
self.qc.updateLog(
diff --git a/cadastre/definitions.py b/cadastre/definitions.py
index a396c950..779daca6 100644
--- a/cadastre/definitions.py
+++ b/cadastre/definitions.py
@@ -3,3 +3,17 @@
)
URL_DOCUMENTATION = "https://docs.3liz.org/QgisCadastrePlugin/"
+
+REGEX_BATI = "BATI"
+REGEX_FANTOIR = "FANTOIR|FANR"
+REGEX_LOTLOCAL = "LLOC|D166"
+REGEX_NBATI = "NBAT"
+REGEX_PDL = "PDL"
+REGEX_PROP = "PROP"
+
+IMPORT_MEMORY_ERROR_MESSAGE = "ERREUR : Mémoire"
+"Veuillez recommencer l'import en baissant la valeur du "
+"paramètre 'Taille maximum des requêtes INSERT' selon la "
+"documentation : {}/extension-qgis/configuration/#performances".format(
+ URL_DOCUMENTATION
+)
diff --git a/cadastre/dialogs/dialog_common.py b/cadastre/dialogs/dialog_common.py
index 9c005e78..31bf6748 100644
--- a/cadastre/dialogs/dialog_common.py
+++ b/cadastre/dialogs/dialog_common.py
@@ -274,7 +274,7 @@ def check_database_for_existing_structure(self):
self.dialog.hasMajicData = has_majic_data
self.dialog.hasMajicDataParcelle = has_majic_data_parcelle
self.dialog.hasMajicDataProp = has_majic_data_prop
- self.dialog.hasMajicData = has_majic_data_voie
+ self.dialog.hasMajicDataVoie = has_majic_data_voie
def checkDatabaseForExistingTable(self, tableName, schemaName=''):
"""
diff --git a/cadastre/dialogs/import_dialog.py b/cadastre/dialogs/import_dialog.py
index 3cb352ce..e0a95e3c 100644
--- a/cadastre/dialogs/import_dialog.py
+++ b/cadastre/dialogs/import_dialog.py
@@ -180,10 +180,13 @@ def chooseDataPath(self, key):
Ask the user to select a folder
and write down the path to appropriate field
"""
+ root_directory = str(self.pathSelectors[key]['input'].text()).strip(' \t')
+ if not root_directory:
+ root_directory = os.path.expanduser("~")
ipath = QFileDialog.getExistingDirectory(
None,
"Choisir le répertoire contenant les fichiers",
- str(self.pathSelectors[key]['input'].text().encode('utf-8')).strip(' \t')
+ root_directory
)
if os.path.exists(str(ipath)):
self.pathSelectors[key]['input'].setText(str(ipath))
diff --git a/cadastre/dialogs/options_dialog.py b/cadastre/dialogs/options_dialog.py
index 07ce9cf0..b21105d6 100644
--- a/cadastre/dialogs/options_dialog.py
+++ b/cadastre/dialogs/options_dialog.py
@@ -12,6 +12,14 @@
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QDialog, QFileDialog, QMessageBox
+from cadastre.definitions import (
+ REGEX_BATI,
+ REGEX_FANTOIR,
+ REGEX_LOTLOCAL,
+ REGEX_NBATI,
+ REGEX_PDL,
+ REGEX_PROP,
+)
from cadastre.tools import set_window_title
OPTION_FORM_CLASS, _ = uic.loadUiType(
@@ -109,30 +117,30 @@ def getValuesFromSettings(self):
from settings and set corresponding inputs
"""
s = QgsSettings()
- batiFileName = s.value("cadastre/batiFileName", 'REVBATI.800', type=str)
- if batiFileName:
- self.inMajicBati.setText(batiFileName)
- fantoirFileName = s.value("cadastre/fantoirFileName", 'TOPFANR.800', type=str)
- if fantoirFileName:
- self.inMajicFantoir.setText(fantoirFileName)
- lotlocalFileName = s.value("cadastre/lotlocalFileName", 'REVD166.800', type=str)
- if lotlocalFileName:
- self.inMajicLotlocal.setText(lotlocalFileName)
- nbatiFileName = s.value("cadastre/nbatiFileName", 'REVNBAT.800', type=str)
- if nbatiFileName:
- self.inMajicNbati.setText(nbatiFileName)
- pdlFileName = s.value("cadastre/pdlFileName", 'REVFPDL.800', type=str)
- if pdlFileName:
- self.inMajicPdl.setText(pdlFileName)
- propFileName = s.value("cadastre/propFileName", 'REVPROP.800', type=str)
- if propFileName:
- self.inMajicProp.setText(propFileName)
+ regexBati = s.value("cadastre/regexBati", REGEX_BATI, type=str)
+ if regexBati:
+ self.inMajicBati.setText(regexBati)
+ regexFantoir = s.value("cadastre/regexFantoir", REGEX_FANTOIR, type=str)
+ if regexFantoir:
+ self.inMajicFantoir.setText(regexFantoir)
+ regexLotLocal = s.value("cadastre/regexLotLocal", REGEX_LOTLOCAL, type=str)
+ if regexLotLocal:
+ self.inMajicLotlocal.setText(regexLotLocal)
+ regexNbati = s.value("cadastre/regexNbati", REGEX_NBATI, type=str)
+ if regexNbati:
+ self.inMajicNbati.setText(regexNbati)
+ regexPdl = s.value("cadastre/regexPdl", REGEX_PDL, type=str)
+ if regexPdl:
+ self.inMajicPdl.setText(regexPdl)
+ regexProp = s.value("cadastre/regexProp", REGEX_PROP, type=str)
+ if regexProp:
+ self.inMajicProp.setText(regexProp)
tempDir = s.value("cadastre/tempDir", type=str)
if tempDir and Path(tempDir).exists():
self.inTempDir.setText(tempDir)
else:
self.inTempDir.setText(tempfile.gettempdir())
- maxInsertRows = s.value("cadastre/maxInsertRows", 100000, type=int)
+ maxInsertRows = s.value("cadastre/maxInsertRows", 50000, type=int)
if maxInsertRows:
self.inMaxInsertRows.setValue(maxInsertRows)
spatialiteTempStore = s.value("cadastre/spatialiteTempStore", 'MEMORY', type=str)
@@ -183,12 +191,12 @@ def onAccept(self):
# Save Majic file names
s = QgsSettings()
- s.setValue("cadastre/batiFileName", self.inMajicBati.text().strip(' \t\n\r'))
- s.setValue("cadastre/fantoirFileName", self.inMajicFantoir.text().strip(' \t\n\r'))
- s.setValue("cadastre/lotlocalFileName", self.inMajicLotlocal.text().strip(' \t\n\r'))
- s.setValue("cadastre/nbatiFileName", self.inMajicNbati.text().strip(' \t\n\r'))
- s.setValue("cadastre/pdlFileName", self.inMajicPdl.text().strip(' \t\n\r'))
- s.setValue("cadastre/propFileName", self.inMajicProp.text().strip(' \t\n\r'))
+ s.setValue("cadastre/regexBati", self.inMajicBati.text().strip(' \t\n\r'))
+ s.setValue("cadastre/regexFantoir", self.inMajicFantoir.text().strip(' \t\n\r'))
+ s.setValue("cadastre/regexLotLocal", self.inMajicLotlocal.text().strip(' \t\n\r'))
+ s.setValue("cadastre/regexNbati", self.inMajicNbati.text().strip(' \t\n\r'))
+ s.setValue("cadastre/regexPdl", self.inMajicPdl.text().strip(' \t\n\r'))
+ s.setValue("cadastre/regexProp", self.inMajicProp.text().strip(' \t\n\r'))
# Save temp dir
s.setValue("cadastre/tempDir", self.inTempDir.text().strip(' \t\n\r'))
diff --git a/cadastre/forms/cadastre_import_form.ui b/cadastre/forms/cadastre_import_form.ui
index 948a8a57..e6753762 100644
--- a/cadastre/forms/cadastre_import_form.ui
+++ b/cadastre/forms/cadastre_import_form.ui
@@ -7,7 +7,7 @@
0
0
720
- 694
+ 883
@@ -24,8 +24,8 @@
0
0
- 686
- 691
+ 700
+ 830
@@ -449,8 +449,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html>
+</style></head><body style=" font-family:'Ubuntu Sans'; font-size:11pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p></body></html>
true
@@ -493,5 +493,6 @@ p, li { white-space: pre-wrap; }
+
diff --git a/cadastre/forms/cadastre_option_form.ui b/cadastre/forms/cadastre_option_form.ui
index 5d2d7758..0ea530a8 100644
--- a/cadastre/forms/cadastre_option_form.ui
+++ b/cadastre/forms/cadastre_option_form.ui
@@ -7,7 +7,7 @@
0
0
543
- 663
+ 825
@@ -25,7 +25,7 @@
0
0
523
- 643
+ 805
@@ -69,11 +69,42 @@
-
- Nom des fichiers MAJIC
+ Mot-clés pour trouver les fichiers MAJIC
+
-
+
+
+ Cette configuration permet de définir comment le plugin trouve les fichiers dans le répertoire MAJIC, en fonction de chaque type de fichier. Un simple mot ou une expression régulière peuvent être utilisés.
+
+
+ true
+
+
+
-
+
-
+
+
+ PROP
+
+
+
+ -
+
+
+ PDL
+
+
+
+ -
+
+
+ TOPO
+
+
+
-
@@ -81,13 +112,45 @@
- -
-
+
-
+
+
+ BATI
+
+
- -
-
+
-
+
- FANTOIR
+ PDL
+
+
+
+ -
+
+
+ PROP
+
+
+
+ -
+
+
+ NBAT
+
+
+
+ -
+
+
+ LLOC|D166
+
+
+
+ -
+
+
+ TOPO
@@ -98,12 +161,6 @@
- -
-
-
- -
-
-
-
@@ -111,29 +168,20 @@
- -
-
-
- -
-
-
- -
-
+
-
+
- PROP
+ FANTOIR|FANR
- -
-
+
-
+
- PDL
+ FANTOIR
- -
-
-
@@ -196,7 +244,7 @@
-
- Taille maximum des requêtes INSERT
+ Nombre de lignes MAJIC insérées par lot
@@ -257,18 +305,19 @@
btInterfaceCadastre
btInterfaceQgis
inMajicBati
- inMajicFantoir
inMajicLotlocal
inMajicNbati
inMajicPdl
inMajicProp
+ lineEdit
+ inMajicFantoir
inComposerTemplateFile
btComposerTemplateFile
inTempDir
btTempDir
inMaxInsertRows
inSpatialiteTempStore
- buttonBox
+
diff --git a/docs/extension-qgis/configuration.md b/docs/extension-qgis/configuration.md
index bcac9279..9113a20d 100644
--- a/docs/extension-qgis/configuration.md
+++ b/docs/extension-qgis/configuration.md
@@ -1,6 +1,6 @@
# Configuration
-Avant d'importer les premières données cadastrales dans la base de données, il faut au préalable configurer
+Avant d'importer les premières données cadastrales dans la base de données, vous pouvez si vous le souhaitez configurer
l'extension :
* Menu **Cadastre ➡ Configurer le plugin** ou l'icône **outils** de la barre d'outil Cadastre.
@@ -16,15 +16,26 @@ interface simplifiée adaptée à une utilisation de consultation du Cadastre.
fonctionnalité lorsque ce sera possible. En attendant, il faut donc le faire manuellement, comme expliqué dans
la fenêtre d'aide.
-## Nom des fichiers MAJIC
+## Mots-clés pour trouver les fichiers MAJIC
-Cette partie permet de spécifier comment sont appelés les fichiers MAJIC sur votre poste de travail.
+Cette partie permet de spécifier **comment sont recherchés les fichiers MAJIC** sur votre poste de travail
+dans le répertoire que vous choisissez dans l'outil d'import.
-En effet, les conventions de nommage peuvent changer d'un département à l'autre. Souvent, les fichiers se
-terminent par une extension relative au département et à la direction, par exemple `.800` pour les fichiers
-du département de la Somme.
+Pour chaque type de fichier (propriétés bâties, non bâties, propriétaires, etc.), un mot-clé,
+ou une liste de mots-clés séparés par `|` permettent de trouver les fichiers s'ils respectent
+les conventions classiques de nommage.
-**Il est important de bien configurer ces noms de fichiers avant votre premier import.**
+Par exemple, les fichiers contenant les propriétaires peuvent s'appeller
+`REVPROP.txt` ou `ART.DC21.W19132.PROP.A2019.N000688`. Dans ce cas,
+il seront bien trouvés par le mot-clé `PROP`.
+
+A noter :
+
+* la recherche est **insensible à la casse**;
+* les mots-clés sont en fait des **expressions régulières**. Par exemple `LLOC|D166`, qui permet
+ de trouver les fichiers des locaux, trouve les fichiers contenant `LLOC` ou `D166`.
+
+**Le plugin propose les mots-clés les plus courants. Vous pouvez les modifier si vos fichiers sont nommés différemment.**
Si l'extension ne trouve pas les fichiers MAJIC pendant l'import, alors que vous aviez spécifié le bon
répertoire d'import, un message vous avertira et vous proposera d'annuler l'import.
diff --git a/docs/media/cadastre_option_dialog.png b/docs/media/cadastre_option_dialog.png
index 1f28e927..dfc0d41b 100644
Binary files a/docs/media/cadastre_option_dialog.png and b/docs/media/cadastre_option_dialog.png differ