|
|
@@ -13,6 +13,11 @@ from core.cerberus_ import is_positive_int, is_positive_float, CerberusValidator
|
|
|
from core.checking import BaseChecker
|
|
|
from core.mncheck import QgsModel
|
|
|
|
|
|
+# TODO: verifier que les zapbos intersectent au moins une zasro et même nom que cette zasro
|
|
|
+# TODO: verifier que toute les prises comprises dans une zapbo soient contenues dans une seule et même zasro
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
logger = logging.getLogger("mncheck")
|
|
|
|
|
|
@@ -50,7 +55,8 @@ class SiteClient(QgsModel):
|
|
|
layername = "SITE_CLIENT"
|
|
|
geom_type = QgsModel.GEOM_POINT
|
|
|
bounding_box = (XMIN,YMIN,XMAX,YMAX)
|
|
|
- schema = {'SC_TYPFON': {'type': 'string', 'empty': False, 'allowed': ['RESIDENTIEL', 'PROFESSIONNEL', 'OPERATEUR', 'TECHNIQUE']},
|
|
|
+ schema = {
|
|
|
+ 'SC_TYPFON': {'type': 'string', 'empty': False, 'allowed': ['RESIDENTIEL', 'PROFESSIONNEL', 'OPERATEUR', 'TECHNIQUE']},
|
|
|
'SC_STATUT': {'type': 'string', 'empty': False, 'allowed': [STATUTS]},
|
|
|
'SC_NBPRISE': {'empty': False, 'validator': is_positive_int},
|
|
|
'SC_NBPRHAB': {'empty': False, 'validator': is_positive_int},
|
|
|
@@ -74,7 +80,7 @@ class Cable(QgsModel):
|
|
|
'CA_TYPSTR': {'type': 'string', 'empty': False, 'allowed': ['CONDUITE', 'AERIEN', 'COLONNE MONTANTE', 'IMMERGE', 'FACADE']},
|
|
|
'CA_STATUT': {'type': 'string', 'empty': False, 'allowed': [STATUTS]},
|
|
|
'CA_CAPFO': {'empty': False, 'allowed': [720,576,288,144,96,72,48,24,12]},
|
|
|
- 'CA_MODULO': {'empty': False, 'validator': is_positive_int},
|
|
|
+ 'CA_MODULO': {'empty': False, 'allowed': [6, 12]},
|
|
|
'CA_SUPPORT': {'type': 'string', 'empty': False, 'allowed': ['0', '1']}
|
|
|
}
|
|
|
|
|
|
@@ -87,7 +93,6 @@ class Zapbo(QgsModel):
|
|
|
'ZP_STATUT': {'type': 'string', 'empty': False, 'allowed': [STATUTS]}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
class Zasro(QgsModel):
|
|
|
layername = "ZASRO"
|
|
|
geom_type = QgsModel.GEOM_POLYGON
|
|
|
@@ -240,7 +245,6 @@ class Mn3ApdChecker(BaseChecker):
|
|
|
""" Recherche de doublons
|
|
|
Recherche d'éventuels doublons dans des champs qui supposent l'unicité
|
|
|
"""
|
|
|
-
|
|
|
# doublons dans ST_CODE
|
|
|
tmp = []
|
|
|
for site_telecom in self.sites_telecom:
|
|
|
@@ -251,45 +255,6 @@ class Mn3ApdChecker(BaseChecker):
|
|
|
else:
|
|
|
self.log_error("Doublons dans le champs ST_CODE", item=site_telecom)
|
|
|
|
|
|
- def test_graphic_duplicates(self):
|
|
|
- """ Recherche de doublons graphiques """
|
|
|
-
|
|
|
- for i, site_telecom in enumerate(self.sites_telecom):
|
|
|
- for other in self.sites_telecom[i+1:]:
|
|
|
- if site_telecom.geom.equals(other.geom):
|
|
|
- self.log_error("Une entité graphique est dupliquée", item=site_telecom)
|
|
|
- continue
|
|
|
-
|
|
|
- for i, site_client in enumerate(self.sites_client):
|
|
|
- for other in self.sites_client[i+1:]:
|
|
|
- if site_client.geom.equals(other.geom):
|
|
|
- self.log_error("Une entité graphique est dupliquée", item=site_client)
|
|
|
- continue
|
|
|
-
|
|
|
-# for i, cable in enumerate(self.cables):
|
|
|
-# for other in self.cables[i+1:]:
|
|
|
-# if cable.geom.equals(other.geom):
|
|
|
-# self.log_error("Une entité graphique est dupliquée", item=cable)
|
|
|
-# continue
|
|
|
-
|
|
|
- for i, zapbo in enumerate(self.zapbos):
|
|
|
- for other in self.zapbos[i+1:]:
|
|
|
- if zapbo.geom.equals(other.geom):
|
|
|
- self.log_error("Une entité graphique est dupliquée", item=zapbo)
|
|
|
- continue
|
|
|
-
|
|
|
- for i, zasro in enumerate(self.zasros):
|
|
|
- for other in self.zasros[i+1:]:
|
|
|
- if zasro.geom.equals(other.geom):
|
|
|
- self.log_error("Une entité graphique est dupliquée", item=zasro)
|
|
|
- continue
|
|
|
-
|
|
|
-# for i, adduction in enumerate(self.adductions):
|
|
|
-# for other in self.adductions[i+1:]:
|
|
|
-# if adduction.geom.equals(other.geom):
|
|
|
-# self.log_error("Une entité graphique est dupliquée", item=adduction)
|
|
|
-# continue
|
|
|
-
|
|
|
def test_dimension_zasro(self):
|
|
|
""" Contrôle le dimensionnement des ZASRO """
|
|
|
for zasro in self.zasros:
|
|
|
@@ -301,14 +266,13 @@ class Mn3ApdChecker(BaseChecker):
|
|
|
for site_client in self.site_clients:
|
|
|
if site_client.ZS.NBPRISES > 28:
|
|
|
self.log_error("L'affaiblissement est supérieur à 28", item=site_client)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
def test_capacite_modulo(self):
|
|
|
""" Contrôle l'affaiblissement """
|
|
|
for cable in self.cables:
|
|
|
- if cable.CA_CAPFO in [720,576,288,144,96,72] and cable.MODULO != "M12":
|
|
|
+ if cable.CA_CAPFO in [720,576,288,144,96] and cable.MODULO != 12:
|
|
|
self.log_error(f"Modulo invalide (capacite: {cable.CA_CAPFO}, modulo: {cable.MODULO})", item=cable)
|
|
|
- elif cable.CA_CAPFO in [72,48,24,12] and cable.MODULO != "M6":
|
|
|
+ elif cable.CA_CAPFO in [48,24,12] and cable.MODULO != 6:
|
|
|
self.log_error(f"Modulo invalide (capacite: {cable.CA_CAPFO}, modulo: {cable.MODULO})", item=cable)
|
|
|
|
|
|
def test_longueur_racco(self):
|
|
|
@@ -318,6 +282,23 @@ class Mn3ApdChecker(BaseChecker):
|
|
|
self.log_error("L'adduction ne devrait pas être consiudérée comme isolée (long.: {adduction.AD_LONG})", item=adduction)
|
|
|
|
|
|
elif adduction.AD_ISOLE == "0" and adduction.AD_LONG > 100:
|
|
|
- self.log_error("L'adduction devrait être consiudérée comme isolée (long.: {adduction.AD_LONG})", item=adduction)
|
|
|
+ self.log_error("L'adduction devrait être considérée comme isolée (long.: {adduction.AD_LONG})", item=adduction)
|
|
|
+
|
|
|
+ def test_zapbos_prises(self):
|
|
|
+ """ Topologie: Zapbos / Prises
|
|
|
+ Toutes les zapbo contiennent au moins une prise"""
|
|
|
+
|
|
|
+ for zapbo in self.zapbos:
|
|
|
+ nb_prises = sum([site_client.SC_NBPRISE for site_client in self.site_clients if zapbo.geom.contains(site_client.geom)])
|
|
|
+ if not nb_prises:
|
|
|
+ self.log_error("La Zapbo ne contient aucune prise", item=zapbo)
|
|
|
+
|
|
|
+ for site_client in self.site_clients:
|
|
|
+ nb_zapbo = len([zapbo for zapbo in self.zapbos if zapbo.geom.contains(site_client.geom)])
|
|
|
+ if nb_zapbo == 0:
|
|
|
+ self.log_error("La prise n'est contenue dans aucune ZAPBO", item=site_client)
|
|
|
+ elif nb_zapbo > 1:
|
|
|
+ self.log_error("La prise est contenue dans plus d'une ZAPBO", item=site_client)
|
|
|
+
|
|
|
|
|
|
checkers = [Mn3ApdChecker]
|