mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-06 19:08:28 +00:00
Move reference infra to new validation infra
This commit is contained in:
parent
84de93d676
commit
c4309bccd9
@ -65,7 +65,6 @@ mod curve;
|
||||
mod cycle;
|
||||
mod face;
|
||||
mod half_edge;
|
||||
mod references;
|
||||
mod region;
|
||||
mod shell;
|
||||
mod sketch;
|
||||
@ -78,10 +77,7 @@ use crate::{
|
||||
validation::{ValidationConfig, ValidationError},
|
||||
};
|
||||
|
||||
pub use self::{
|
||||
references::MultipleReferencesToObject, sketch::SketchValidationError,
|
||||
solid::SolidValidationError,
|
||||
};
|
||||
pub use self::{sketch::SketchValidationError, solid::SolidValidationError};
|
||||
|
||||
/// Assert that some object has a validation error which matches a specific
|
||||
/// pattern. This is preferred to matching on [`Validate::validate_and_return_first_error`], since usually we don't care about the order.
|
||||
|
@ -4,12 +4,13 @@ use crate::{
|
||||
geometry::Geometry,
|
||||
storage::Handle,
|
||||
topology::{Cycle, Sketch},
|
||||
validation::{checks::AdjacentHalfEdgesNotConnected, ValidationCheck},
|
||||
validation::{
|
||||
checks::{AdjacentHalfEdgesNotConnected, ReferenceCounter},
|
||||
ValidationCheck,
|
||||
},
|
||||
};
|
||||
|
||||
use super::{
|
||||
references::ReferenceCounter, Validate, ValidationConfig, ValidationError,
|
||||
};
|
||||
use super::{Validate, ValidationConfig, ValidationError};
|
||||
|
||||
impl Validate for Sketch {
|
||||
fn validate(
|
||||
|
@ -4,12 +4,11 @@ use crate::{
|
||||
geometry::Geometry,
|
||||
storage::Handle,
|
||||
topology::{Solid, Vertex},
|
||||
validation::checks::ReferenceCounter,
|
||||
};
|
||||
use fj_math::Point;
|
||||
|
||||
use super::{
|
||||
references::ReferenceCounter, Validate, ValidationConfig, ValidationError,
|
||||
};
|
||||
use super::{Validate, ValidationConfig, ValidationError};
|
||||
|
||||
impl Validate for Solid {
|
||||
fn validate(
|
||||
|
@ -8,6 +8,7 @@ mod face_boundary;
|
||||
mod face_winding;
|
||||
mod half_edge_connection;
|
||||
mod half_edge_has_no_sibling;
|
||||
mod multiple_references;
|
||||
|
||||
pub use self::{
|
||||
coincident_half_edges_are_not_siblings::CoincidentHalfEdgesAreNotSiblings,
|
||||
@ -16,4 +17,5 @@ pub use self::{
|
||||
face_winding::InteriorCycleHasInvalidWinding,
|
||||
half_edge_connection::AdjacentHalfEdgesNotConnected,
|
||||
half_edge_has_no_sibling::HalfEdgeHasNoSibling,
|
||||
multiple_references::{MultipleReferencesToObject, ReferenceCounter},
|
||||
};
|
||||
|
@ -30,9 +30,17 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
// Warnings are temporarily silenced, until this struct can be made private.
|
||||
// This can happen once this validation check has been fully ported from the old
|
||||
// infrastructure.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Default)]
|
||||
pub struct ReferenceCounter<T, U>(HashMap<Handle<T>, Vec<Handle<U>>>);
|
||||
|
||||
// Warnings are temporarily silenced, until this struct can be made private.
|
||||
// This can happen once this validation check has been fully ported from the old
|
||||
// infrastructure.
|
||||
#[allow(missing_docs)]
|
||||
impl<T, U> ReferenceCounter<T, U> {
|
||||
pub fn new() -> Self {
|
||||
Self(HashMap::new())
|
@ -2,15 +2,13 @@ use std::{convert::Infallible, fmt};
|
||||
|
||||
use crate::{
|
||||
topology::{Cycle, Face, HalfEdge, Region, Shell},
|
||||
validate::{
|
||||
MultipleReferencesToObject, SketchValidationError, SolidValidationError,
|
||||
},
|
||||
validate::{SketchValidationError, SolidValidationError},
|
||||
};
|
||||
|
||||
use super::checks::{
|
||||
AdjacentHalfEdgesNotConnected, CoincidentHalfEdgesAreNotSiblings,
|
||||
CurveGeometryMismatch, FaceHasNoBoundary, HalfEdgeHasNoSibling,
|
||||
InteriorCycleHasInvalidWinding,
|
||||
InteriorCycleHasInvalidWinding, MultipleReferencesToObject,
|
||||
};
|
||||
|
||||
/// An error that can occur during a validation
|
||||
|
Loading…
Reference in New Issue
Block a user