22#include "reusex/core/ProjectDB.hpp"
23#include "reusex/core/component_record.hpp"
24#include "reusex/geometry/BuildingComponent.hpp"
25#include "reusex/geometry/CoplanarPolygon.hpp"
38inline core::ComponentRecord
45 for (
int i = 0; i < 4; ++i)
55inline BuildingComponent
60 if (!record.
type.empty())
65 for (
int i = 0; i < 4; ++i)
93 std::string_view name) {
std::vector< std::string > list_building_components() const
core::ComponentRecord component_record(std::string_view name) const
Load the component row with the given name. Throws if absent.
void save_component_record(const core::ComponentRecord &record)
Insert or replace the component row identified by record.name.
void update_component_record_by_guid(const core::ComponentRecord &record)
Update an existing component's mutable fields (name, type, parent_id, confidence, metadata,...
std::string_view to_string(ComponentType type)
std::vector< std::string > list_building_components(const ProjectDB &db, ComponentType type)
Names of all stored components of the given type.
void update_building_component_by_guid(ProjectDB &db, const BuildingComponent &component)
Update an existing component's mutable fields, matched by its immutable guid.
ComponentType
Discriminator for building component types.
ComponentType component_type_from_string(std::string_view str)
BuildingComponent building_component(const ProjectDB &db, std::string_view name)
Load the component stored under name. Throws if absent.
void component_data_from_json(BuildingComponent &c, const std::string &json)
Deserialize JSON TEXT into the variant data on a BuildingComponent.
core::ComponentRecord to_component_record(const BuildingComponent &component)
Flatten a component into the persistence POD.
void save_building_component(ProjectDB &db, const BuildingComponent &component)
Insert or replace component, keyed by its name.
BuildingComponent from_component_record(const core::ComponentRecord &record)
Rebuild a component from the persistence POD.
std::string component_data_to_json(const BuildingComponent &c)
Serialize the type-specific variant data to JSON TEXT.
Core-owned persistence contract for a row of the building_components table (#227).
std::array< double, 4 > plane
plane blob — Hessian normal form [a,b,c,d] of ax+by+cz+d=0, always persisted as 4 * 8 bytes.
std::string guid
guid column (schema v8) — stable, immutable identity.
double confidence
confidence column — detection confidence, -1 if manual.
std::string name
name column — unique; the UPSERT conflict target.
int parent_id
parent_id column — optional link to a parent component, -1 if none.
std::string type
type column — component-type discriminator as stored, e.g. "window".
std::string metadata
metadata column — opaque JSON TEXT owned by the geometry layer.
std::vector< uint8_t > vertex_data
vertex_data blob — boundary vertices as packed little-endian float64 xyz triples (3 * 8 bytes per ver...
std::string notes
notes column — free-form text. Bound as NULL when empty.
A detected or manual building component (window, door, wall, ...).
std::string guid
Stable, immutable identifier.
std::vector< uint8_t > serialize_vertices() const
Serialize vertices to compact binary (N * 3 * sizeof(double) bytes).
std::vector< Eigen::Vector3d > vertices
static std::vector< Eigen::Vector3d > deserialize_vertices(const void *data, size_t size)
Deserialize vertices from compact binary.