forked from 1b-agent/opencadstudio-upstream
ocs_doc_api: Phase 2c-iii — 2-line angular dimension (all dimension sub-types done)
- CreateDimensionAngular2Ln(DimensionAngularSpec) op (append-only). - backend add_dimension_angular2ln (DimensionAngular2Ln::new computes angle). - facade create_dimension_angular2ln; spec constructor; api_reference + binding_schema regenerated; mocks + baseline. - IMPLEMENTATION.md: fix stale Status line (all 5 phases complete, current test counts); mark all dimension sub-types done. - Test phase2ciii_dimension_angular2ln (90-degree 2-line angle) -> 616 host lib + 3 consistency green.
This commit is contained in:
1 parent
240831edcd
commit
612e8e13e0
12 files changed
+82
-7
No files matched your search
@@ -78,6 +78,9 @@ pub trait DocApiBackend {
|
||||
/// Add a `TABLE` (rows × columns grid); returns the fresh `ObjectId`.
|
||||
fn add_table(&mut self, spec: &crate::ops::TableSpec) -> ApiResult<ObjectId>;
|
||||
|
||||
/// Add a 2-line angular `DIMENSION`; returns the fresh `ObjectId`.
|
||||
fn add_dimension_angular2ln(&mut self, spec: &crate::ops::DimensionAngularSpec) -> ApiResult<ObjectId>;
|
||||
|
||||
/// A dimension's measured value (distance for linear/radius, degrees for angular).
|
||||
fn dimension_measurement(&self, id: ObjectId) -> ApiResult<f64>;
|
||||
|
||||
|
||||
@@ -304,6 +304,12 @@ pub fn apply_op<B: DocApiBackend>(b: &mut B, op: Operation) -> ApiResult<Receipt
|
||||
b.finalize_op();
|
||||
OpOutcome::NewId(id)
|
||||
}
|
||||
Operation::CreateDimensionAngular2Ln(spec) => {
|
||||
b.push_undo(name);
|
||||
let id = b.add_dimension_angular2ln(spec)?;
|
||||
b.finalize_op();
|
||||
OpOutcome::NewId(id)
|
||||
}
|
||||
};
|
||||
Ok(Receipt {
|
||||
outcome: Some(outcome),
|
||||
|
||||
@@ -539,6 +539,14 @@ impl CurveCollection {
|
||||
Ok(Entity::new(self.session.clone(), id))
|
||||
}
|
||||
|
||||
/// A 2-line angular DIMENSION: angle between lines (vertex→first) and (vertex→second).
|
||||
pub fn create_dimension_angular2ln(&self, vertex: [f64; 3], first_point: [f64; 3], second_point: [f64; 3], arc_location: [f64; 3]) -> ApiResult<Dimension> {
|
||||
let receipt = self.session.apply_op(Operation::CreateDimensionAngular2Ln(crate::ops::DimensionAngularSpec {
|
||||
vertex, first_point, second_point, arc_location,
|
||||
}))?;
|
||||
let id = receipt.outcome.and_then(|o| o.new_id()).ok_or_else(|| ApiError::Transport("create_dimension returned no id".into()))?;
|
||||
Ok(Dimension::new(self.session.clone(), id))
|
||||
}
|
||||
/// A radial DIMENSION for the circle centered at `center` through `point`.
|
||||
pub fn create_dimension_radius(&self, center: [f64; 3], point: [f64; 3]) -> ApiResult<Dimension> {
|
||||
self.create_dim_radial(Operation::CreateDimensionRadius, center, point)
|
||||
|
||||
@@ -136,6 +136,7 @@ Linear dimension between two measured points. measurement() reads the distance;
|
||||
- **create_dimension_radius**(center: [f64; 3], point: [f64; 3]) -> `Dimension` — `CreateDimensionRadius`
|
||||
- **create_dimension_diameter**(center: [f64; 3], point: [f64; 3]) -> `Dimension` — `CreateDimensionDiameter`
|
||||
- **create_dimension_angular**(vertex: [f64; 3], first_point: [f64; 3], second_point: [f64; 3], arc_location: [f64; 3]) -> `Dimension` — `CreateDimensionAngular`
|
||||
- **create_dimension_angular2ln**(vertex: [f64; 3], first_point: [f64; 3], second_point: [f64; 3], arc_location: [f64; 3]) -> `Dimension` — `CreateDimensionAngular2Ln`
|
||||
|
||||
### Methods
|
||||
|
||||
|
||||
@@ -56,4 +56,6 @@ pub enum Operation {
|
||||
CreateAttributeDefinition(AttributeDefinitionSpec),
|
||||
// tables
|
||||
CreateTable(TableSpec),
|
||||
// dimension sub-types (2-line angular)
|
||||
CreateDimensionAngular2Ln(DimensionAngularSpec),
|
||||
}
|
||||
@@ -233,6 +233,7 @@ impl crate::gen::Operation {
|
||||
CreateDimensionAngular(_) => "CreateDimensionAngular",
|
||||
CreateAttributeDefinition(_) => "CreateAttributeDefinition",
|
||||
CreateTable(_) => "CreateTable",
|
||||
CreateDimensionAngular2Ln(_) => "CreateDimensionAngular2Ln",
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user