Make name of method more explicit

This commit is contained in:
Hanno Braun 2024-10-23 18:47:20 +02:00
parent 16c2adaa7b
commit afe0698296
5 changed files with 30 additions and 11 deletions

View File

@ -20,7 +20,7 @@ impl Layer<Geometry> {
geometry: LocalCurveGeom,
) {
let mut events = Vec::new();
self.process(
self.process_command_and_capture_events(
DefineCurve {
curve,
surface,
@ -44,7 +44,10 @@ impl Layer<Geometry> {
geometry: CurveGeom2,
) {
let mut events = Vec::new();
self.process(DefineCurve2 { curve, geometry }, &mut events);
self.process_command_and_capture_events(
DefineCurve2 { curve, geometry },
&mut events,
);
}
/// # Define the geometry of the provided surface
@ -59,7 +62,10 @@ impl Layer<Geometry> {
geometry: SweptCurve,
) {
let mut events = Vec::new();
self.process(DefineSurface { surface, geometry }, &mut events);
self.process_command_and_capture_events(
DefineSurface { surface, geometry },
&mut events,
);
}
/// # Define the geometry of the provided surface
@ -81,7 +87,10 @@ impl Layer<Geometry> {
geometry: SurfaceGeom,
) {
let mut events = Vec::new();
self.process(DefineSurface2 { surface, geometry }, &mut events);
self.process_command_and_capture_events(
DefineSurface2 { surface, geometry },
&mut events,
);
}
/// Define the geometry of the provided vertex
@ -92,7 +101,7 @@ impl Layer<Geometry> {
geometry: LocalVertexGeom,
) {
let mut events = Vec::new();
self.process(
self.process_command_and_capture_events(
DefineVertex {
vertex,
curve,

View File

@ -27,7 +27,7 @@ impl<S> Layer<S> {
///
/// The command is processed synchronously. When this method returns, the
/// state has been updated.
pub fn process<C>(
pub fn process_command_and_capture_events<C>(
&mut self,
command: C,
events: &mut Vec<C::Event>,

View File

@ -14,7 +14,10 @@ impl Layer<Presentation> {
/// Set the color of a region
pub fn set_color(&mut self, region: Handle<Region>, color: Color) {
let mut events = Vec::new();
self.process(SetColor { region, color }, &mut events);
self.process_command_and_capture_events(
SetColor { region, color },
&mut events,
);
}
/// Mark an object as being derived from another
@ -24,7 +27,10 @@ impl Layer<Presentation> {
derived: AnyObject<Stored>,
) {
let mut events = Vec::new();
self.process(DeriveObject { original, derived }, &mut events);
self.process_command_and_capture_events(
DeriveObject { original, derived },
&mut events,
);
}
}

View File

@ -19,14 +19,18 @@ impl Layer<Topology> {
validation: &mut Layer<Validation>,
) {
let mut events = Vec::new();
self.process(InsertObject { object }, &mut events);
self.process_command_and_capture_events(
InsertObject { object },
&mut events,
);
for event in events {
let event = ValidateObject {
object: event.object.into(),
geometry,
};
validation.process(event, &mut Vec::new());
validation
.process_command_and_capture_events(event, &mut Vec::new());
}
}
}

View File

@ -11,7 +11,7 @@ use super::{Command, Event, Layer};
impl Layer<Validation> {
/// Take all errors stored in the validation layer
pub fn take_errors(&mut self) -> Result<(), ValidationErrors> {
self.process(TakeErrors, &mut Vec::new())
self.process_command_and_capture_events(TakeErrors, &mut Vec::new())
}
}