forked from 1b-agent/opencadstudio-upstream
90 lines
2.6 KiB
Rust
90 lines
2.6 KiB
Rust
// HAND-MAINTAINED wire vocabulary (the Query enum). NOT derived from the spec by
|
|
// build.rs — the enum is the canonical append-only wire vocabulary; the spec's
|
|
// `query` names must each map to a variant here (enforced by a test). Append new
|
|
// variants at the END only (bincode discriminant stability).
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::id::ObjectId;
|
|
|
|
/// A typed read query. Read-only: no mutation, no undo, no revision
|
|
/// bump. Safe to batch (`EnvelopeBody::Queries`). Append new variants at the END only.
|
|
/// (Not `Copy`: some variants carry owned data like a block name.)
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
#[non_exhaustive]
|
|
pub enum Query {
|
|
GetEntity {
|
|
id: ObjectId,
|
|
},
|
|
GetBounds {
|
|
id: ObjectId,
|
|
},
|
|
GetCentroid {
|
|
id: ObjectId,
|
|
},
|
|
GetVolume {
|
|
id: ObjectId,
|
|
},
|
|
/// Whether two entities' bounds overlap (two-phase conditional modelling).
|
|
GetIntersects {
|
|
a: ObjectId,
|
|
b: ObjectId,
|
|
},
|
|
GetGeometryRevision,
|
|
/// The text content of a Text/MText annotation.
|
|
GetTextContent {
|
|
id: ObjectId,
|
|
},
|
|
/// The boundary loops of a Hatch (outer + islands) as polylines.
|
|
GetHatchBoundary {
|
|
id: ObjectId,
|
|
},
|
|
/// The measured value of a Dimension (distance or angle).
|
|
GetDimensionMeasurement {
|
|
id: ObjectId,
|
|
},
|
|
/// An insert's attributes as (tag, value) pairs.
|
|
GetAttributes {
|
|
id: ObjectId,
|
|
},
|
|
/// The entity ids + kinds inside a block definition (read-only traversal).
|
|
GetBlockEntities {
|
|
block_name: String,
|
|
},
|
|
/// A viewport's view (target + zoom height).
|
|
GetViewportView {
|
|
id: ObjectId,
|
|
},
|
|
/// The XDATA record for `application_name` attached to an entity (`None` if absent).
|
|
GetXData {
|
|
id: ObjectId,
|
|
application_name: String,
|
|
},
|
|
/// The XRECORD object payload by id.
|
|
GetXRecord {
|
|
id: ObjectId,
|
|
},
|
|
/// List all layers in the document.
|
|
ListLayers,
|
|
/// The layer name of an entity.
|
|
GetEntityLayer {
|
|
id: ObjectId,
|
|
},
|
|
/// Enumerate first-class entities, optionally filtered by kind and/or layer.
|
|
/// `include_bounds` populates `EntityView::bounds`; leave it false for a
|
|
/// lightweight list view.
|
|
EnumerateEntities {
|
|
kind: Option<String>,
|
|
layer: Option<String>,
|
|
include_bounds: bool,
|
|
},
|
|
/// The WCS location of a Point entity.
|
|
GetPointPosition {
|
|
id: ObjectId,
|
|
},
|
|
/// The start and end WCS points of a Line entity.
|
|
GetLineGeometry {
|
|
id: ObjectId,
|
|
},
|
|
}
|