|
@@ -553,12 +553,12 @@ class Mn2Checker(BaseChecker):
|
|
|
if zapbo.geom.equals(other.geom):
|
|
if zapbo.geom.equals(other.geom):
|
|
|
self.log_error("Une entité graphique est dupliquée", item=zapbo)
|
|
self.log_error("Une entité graphique est dupliquée", item=zapbo)
|
|
|
continue
|
|
continue
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
def test_positions_noeuds(self):
|
|
def test_positions_noeuds(self):
|
|
|
""" Topologie: Noeuds / Artères
|
|
""" Topologie: Noeuds / Artères
|
|
|
Compare la géométrie des noeuds à celle des artères
|
|
Compare la géométrie des noeuds à celle des artères
|
|
|
"""
|
|
"""
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
for artere in self.arteres:
|
|
for artere in self.arteres:
|
|
|
if not artere.noeud_a or not artere.noeud_b:
|
|
if not artere.noeud_a or not artere.noeud_b:
|
|
|
continue
|
|
continue
|
|
@@ -567,12 +567,30 @@ class Mn2Checker(BaseChecker):
|
|
|
noeud_a_point = artere.noeud_a.get_points()[0]
|
|
noeud_a_point = artere.noeud_a.get_points()[0]
|
|
|
noeud_b_point = artere.noeud_b.get_points()[0]
|
|
noeud_b_point = artere.noeud_b.get_points()[0]
|
|
|
|
|
|
|
|
- if not (artere_points[0].distanceSquared(noeud_a_point) <= TOLERANCE and \
|
|
|
|
|
- artere_points[-1].distanceSquared(noeud_b_point) <= TOLERANCE) \
|
|
|
|
|
- and not (artere_points[-1].distanceSquared(noeud_a_point) <= TOLERANCE and \
|
|
|
|
|
- artere_points[0].distanceSquared(noeud_b_point) <= TOLERANCE):
|
|
|
|
|
- self.log_error(f"Pas de noeud aux coordonnées attendues (noeuds attendus: {artere.noeud_a.NO_CODE} ou {artere.noeud_b.NO_CODE})", item=artere)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ a_seen_at = []
|
|
|
|
|
+ b_seen_at = []
|
|
|
|
|
+ for i, p in enumerate(artere_points):
|
|
|
|
|
+ if p.distanceSquared(noeud_a_point) <= TOLERANCE:
|
|
|
|
|
+ a_seen_at.append(i)
|
|
|
|
|
+ if p.distanceSquared(noeud_b_point) <= TOLERANCE:
|
|
|
|
|
+ b_seen_at.append(i)
|
|
|
|
|
+
|
|
|
|
|
+ if a_seen_at:
|
|
|
|
|
+ if 0 in a_seen_at or (len(artere_points) - 1) in a_seen_at:
|
|
|
|
|
+ pass # ok
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"Le noeud A n'est pas situé à l'extremité de l'artère", item=artere)
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"Le noeud A n'est pas aux coordonnées attendues ({artere.noeud_a.NO_CODE})", item=artere)
|
|
|
|
|
+
|
|
|
|
|
+ if b_seen_at:
|
|
|
|
|
+ if 0 in b_seen_at or (len(artere_points) - 1) in b_seen_at:
|
|
|
|
|
+ pass # ok
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"Le noeud B n'est pas situé à l'extremité de l'artère", item=artere)
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"Le noeud B n'est pas aux coordonnées attendues ({artere.noeud_b.NO_CODE})", item=artere)
|
|
|
|
|
+
|
|
|
def test_positions_equipements(self):
|
|
def test_positions_equipements(self):
|
|
|
""" Topologie: Equipements / Cables
|
|
""" Topologie: Equipements / Cables
|
|
|
Compare la géométrie des équipements à celle des cables """
|
|
Compare la géométrie des équipements à celle des cables """
|
|
@@ -586,12 +604,29 @@ class Mn2Checker(BaseChecker):
|
|
|
equip_a_point = cable.equipement_a.noeud.get_points()[0]
|
|
equip_a_point = cable.equipement_a.noeud.get_points()[0]
|
|
|
equip_b_point = cable.equipement_b.noeud.get_points()[0]
|
|
equip_b_point = cable.equipement_b.noeud.get_points()[0]
|
|
|
|
|
|
|
|
- if not (cable_points[0].distanceSquared(equip_a_point) <= TOLERANCE and \
|
|
|
|
|
- cable_points[-1].distanceSquared(equip_b_point) <= TOLERANCE) \
|
|
|
|
|
- and not (cable_points[-1].distanceSquared(equip_a_point) <= TOLERANCE and \
|
|
|
|
|
- cable_points[0].distanceSquared(equip_b_point) <= TOLERANCE):
|
|
|
|
|
|
|
+ a_seen_at = []
|
|
|
|
|
+ b_seen_at = []
|
|
|
|
|
+ for i, p in enumerate(cable_points):
|
|
|
|
|
+ if p.distanceSquared(equip_a_point) <= TOLERANCE:
|
|
|
|
|
+ a_seen_at.append(i)
|
|
|
|
|
+ if p.distanceSquared(equip_b_point) <= TOLERANCE:
|
|
|
|
|
+ b_seen_at.append(i)
|
|
|
|
|
|
|
|
- self.log_error(f"Pas d'équipement aux coordonnées attendues (equipements attendus: {cable.equipement_a.EQ_CODE} ou {cable.equipement_b.EQ_CODE})", item=cable)
|
|
|
|
|
|
|
+ if a_seen_at:
|
|
|
|
|
+ if 0 in a_seen_at or (len(cable_points) - 1) in a_seen_at:
|
|
|
|
|
+ pass # ok
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"L'équipement A n'est pas situé à l'extremité du cable", item=cable)
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"L'équipement A n'est pas aux coordonnées attendues ({cable.equipement_a.EQ_CODE})", item=cable)
|
|
|
|
|
+
|
|
|
|
|
+ if b_seen_at:
|
|
|
|
|
+ if 0 in b_seen_at or (len(cable_points) - 1) in b_seen_at:
|
|
|
|
|
+ pass # ok
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"L'équipement B n'est pas situé à l'extremité du cable", item=cable)
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.log_error(f"L'équipement B n'est pas aux coordonnées attendues ({cable.equipement_b.EQ_CODE})", item=cable)
|
|
|
|
|
|
|
|
def test_tranchee_artere(self):
|
|
def test_tranchee_artere(self):
|
|
|
""" Topologie: Tranchées / Artères
|
|
""" Topologie: Tranchées / Artères
|