|
@@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
@author: olivier.massot, 2018
|
|
@author: olivier.massot, 2018
|
|
|
'''
|
|
'''
|
|
|
|
|
+
|
|
|
import logging
|
|
import logging
|
|
|
from qgis.core import QgsProject, QgsGeometry
|
|
from qgis.core import QgsProject, QgsGeometry
|
|
|
|
|
|
|
@@ -16,10 +17,8 @@ from core.mncheck import QgsModel
|
|
|
|
|
|
|
|
logger = logging.getLogger("mncheck")
|
|
logger = logging.getLogger("mncheck")
|
|
|
|
|
|
|
|
-
|
|
|
|
|
SCHEMA_NAME = "Schéma MN v2 REC"
|
|
SCHEMA_NAME = "Schéma MN v2 REC"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
STATUTS = ['EN ETUDE', 'EN REALISATION', 'EN SERVICE', 'HORS SERVICE']
|
|
STATUTS = ['EN ETUDE', 'EN REALISATION', 'EN SERVICE', 'HORS SERVICE']
|
|
|
|
|
|
|
|
XMIN, XMAX, YMIN, YMAX = 1341999, 1429750, 8147750, 8294000
|
|
XMIN, XMAX, YMIN, YMAX = 1341999, 1429750, 8147750, 8294000
|
|
@@ -35,6 +34,7 @@ class Artere(QgsModel):
|
|
|
geom_type = QgsModel.GEOM_LINE
|
|
geom_type = QgsModel.GEOM_LINE
|
|
|
crs = CRS
|
|
crs = CRS
|
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
|
|
|
+ pk = "AR_CODE"
|
|
|
schema = {'AR_CODE': {'type': 'string', 'maxlength': 26},
|
|
schema = {'AR_CODE': {'type': 'string', 'maxlength': 26},
|
|
|
'AR_NOM': {'type': 'string', 'maxlength': 26},
|
|
'AR_NOM': {'type': 'string', 'maxlength': 26},
|
|
|
'AR_ID_INSE': {'type': 'string', 'empty': False, 'regex': r'50\d{3}'},
|
|
'AR_ID_INSE': {'type': 'string', 'empty': False, 'regex': r'50\d{3}'},
|
|
@@ -67,13 +67,14 @@ class Artere(QgsModel):
|
|
|
'AR_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
'AR_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
- return "Artere {}".format(self.AR_CODE)
|
|
|
|
|
|
|
+ return f"Artere {self.AR_CODE}"
|
|
|
|
|
|
|
|
class Cable(QgsModel):
|
|
class Cable(QgsModel):
|
|
|
layername = "cable_geo"
|
|
layername = "cable_geo"
|
|
|
geom_type = QgsModel.GEOM_LINE
|
|
geom_type = QgsModel.GEOM_LINE
|
|
|
crs = CRS
|
|
crs = CRS
|
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
|
|
|
+ pk = "CA_CODE"
|
|
|
schema = {'CA_CODE': {'type': 'string', 'maxlength': 18},
|
|
schema = {'CA_CODE': {'type': 'string', 'maxlength': 18},
|
|
|
'CA_NOM': {'type': 'string', 'maxlength': 18},
|
|
'CA_NOM': {'type': 'string', 'maxlength': 18},
|
|
|
'CA_NUMERO': {'type': 'string', 'maxlength': 17},
|
|
'CA_NUMERO': {'type': 'string', 'maxlength': 17},
|
|
@@ -100,13 +101,14 @@ class Cable(QgsModel):
|
|
|
'CA_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
'CA_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
- return "Cable {}-{}".format(self.CA_EQ_A, self.CA_EQ_B)
|
|
|
|
|
|
|
+ return f"Cable {self.CA_CODE}"
|
|
|
|
|
|
|
|
class Equipement(QgsModel):
|
|
class Equipement(QgsModel):
|
|
|
layername = "equipement_passif"
|
|
layername = "equipement_passif"
|
|
|
geom_type = QgsModel.GEOM_POINT
|
|
geom_type = QgsModel.GEOM_POINT
|
|
|
crs = CRS
|
|
crs = CRS
|
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
|
|
|
+ pk = "EQ_CODE"
|
|
|
schema = {'EQ_CODE': {'type': 'string', 'maxlength': 18},
|
|
schema = {'EQ_CODE': {'type': 'string', 'maxlength': 18},
|
|
|
'EQ_NOM': {'type': 'string', 'maxlength': 10, 'contains_any_of': ['PBO', 'BPE', 'BAI']},
|
|
'EQ_NOM': {'type': 'string', 'maxlength': 10, 'contains_any_of': ['PBO', 'BPE', 'BAI']},
|
|
|
'EQ_NOM_NOE': {'type': 'string', 'maxlength': 30},
|
|
'EQ_NOM_NOE': {'type': 'string', 'maxlength': 30},
|
|
@@ -132,13 +134,14 @@ class Equipement(QgsModel):
|
|
|
'EQ_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
'EQ_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
- return "Equipement {}".format(self.EQ_NOM)
|
|
|
|
|
|
|
+ return f"Equipement {self.EQ_CODE}"
|
|
|
|
|
|
|
|
class Noeud(QgsModel):
|
|
class Noeud(QgsModel):
|
|
|
layername = "noeud_geo"
|
|
layername = "noeud_geo"
|
|
|
geom_type = QgsModel.GEOM_POINT
|
|
geom_type = QgsModel.GEOM_POINT
|
|
|
crs = CRS
|
|
crs = CRS
|
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
|
|
|
+ pk = "NO_CODE"
|
|
|
schema = {'NO_CODE': {'type': 'string', 'maxlength': 18},
|
|
schema = {'NO_CODE': {'type': 'string', 'maxlength': 18},
|
|
|
'NO_NOM': {'type': 'string', 'maxlength': 30},
|
|
'NO_NOM': {'type': 'string', 'maxlength': 30},
|
|
|
'NO_ID_INSE': {'type': 'string', 'empty': False, 'regex': r'50\d{3}'},
|
|
'NO_ID_INSE': {'type': 'string', 'empty': False, 'regex': r'50\d{3}'},
|
|
@@ -168,13 +171,14 @@ class Noeud(QgsModel):
|
|
|
'NO_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
'NO_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
- return "Noeud {}".format(self.NO_NOM)
|
|
|
|
|
|
|
+ return f"Noeud {self.NO_CODE}"
|
|
|
|
|
|
|
|
class Tranchee(QgsModel):
|
|
class Tranchee(QgsModel):
|
|
|
layername = "tranchee_geo"
|
|
layername = "tranchee_geo"
|
|
|
geom_type = QgsModel.GEOM_LINE
|
|
geom_type = QgsModel.GEOM_LINE
|
|
|
crs = CRS
|
|
crs = CRS
|
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
|
|
|
+ pk = "TR_CODE"
|
|
|
schema = {'TR_CODE': {'type': 'string', 'maxlength': 23},
|
|
schema = {'TR_CODE': {'type': 'string', 'maxlength': 23},
|
|
|
'TR_NOM': {'type': 'string', 'maxlength': 23},
|
|
'TR_NOM': {'type': 'string', 'maxlength': 23},
|
|
|
'TR_ID_INSE': {'type': 'string', 'empty': False, 'regex': r'50\d{3}'},
|
|
'TR_ID_INSE': {'type': 'string', 'empty': False, 'regex': r'50\d{3}'},
|
|
@@ -200,30 +204,26 @@ class Tranchee(QgsModel):
|
|
|
'TR_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
'TR_STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
- return "Tranchee {}".format(self.TR_VOIE)
|
|
|
|
|
|
|
+ return f"Tranchee {self.TR_CODE}"
|
|
|
|
|
|
|
|
class Zapbo(QgsModel):
|
|
class Zapbo(QgsModel):
|
|
|
layername = "zapbo_geo"
|
|
layername = "zapbo_geo"
|
|
|
geom_type = QgsModel.GEOM_POLYGON
|
|
geom_type = QgsModel.GEOM_POLYGON
|
|
|
crs = CRS
|
|
crs = CRS
|
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
|
|
|
+ pk = "ID_ZAPBO"
|
|
|
schema = {'ID_ZAPBO': {'type': 'string', 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE']},
|
|
schema = {'ID_ZAPBO': {'type': 'string', 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE']},
|
|
|
'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True},
|
|
'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True},
|
|
|
'STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
'STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
- return "Zapbo {}".format(self.ID_ZAPBO)
|
|
|
|
|
|
|
+ return f"Zapbo {self.ID_ZAPBO}"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
models = [Artere, Cable, Equipement, Noeud, Tranchee, Zapbo]
|
|
models = [Artere, Cable, Equipement, Noeud, Tranchee, Zapbo]
|
|
|
|
|
|
|
|
####### Validateur
|
|
####### Validateur
|
|
|
|
|
|
|
|
-class Mn1Checker(BaseChecker):
|
|
|
|
|
-
|
|
|
|
|
- def __init__(self):
|
|
|
|
|
- super().__init__()
|
|
|
|
|
|
|
+class Mn2Checker(BaseChecker):
|
|
|
|
|
|
|
|
def test_load_layers(self):
|
|
def test_load_layers(self):
|
|
|
""" Chargement des données
|
|
""" Chargement des données
|