[158] Raumbuch: Nutzung und Oberflächen je Raum (Boden/Wand/Decke, Aufbau), Raum-Belag im Grundriss statt Deckenbelag, Nassraum aus Nutzung, Belagszeile im Stempel, Objekt-Info, Liste/Blatt-Tabelle/CSV, Mengen, IFC-Psets mit Rundreise
This commit is contained in:
27 files changed
+1406
-26
No files matched your search
@@ -3617,6 +3617,33 @@ Format · [90] Versionsvergleich · [91] Assistent · [92] Speckle.
|
||||
Blöcke/Körper (geschlossene 2D-Formen der Kategorie „Möbel" sparen nicht aus); Deckenspiegel-Untersicht unverändert
|
||||
(0.1 mm, alte Ausdünnung); Level-Feld nur über Ansichtsvorlage einstellbar (kein eigenes Feld im Ebenen-Panel); nur
|
||||
Linux, nicht in der Tauri-App/Metal angesehen. · S
|
||||
- ◐ **[158] Raumbuch (Oberflächen je Raum).** (7.11., Folge aus [156] „Offen": Nassräume nur über Namen, Belag
|
||||
nur an der Decke.) **Modell** (Rust, `gen:types`): `Room.usage` (`RoomUsage`: living/sleeping/kitchen/dining/bath/wc/
|
||||
shower/laundry/circulation/technical/storage/office/other; Nassraum = Bad/WC/Dusche/Waschküche), `floorFinish`/
|
||||
`wallFinish`/`ceilingFinish` (Kennung eines Bauteil-Materials aus `components` oder Freitext), `floorBuildUp` (Freitext),
|
||||
`RoomStamp.showFinish`; Blatt-Tabellenquelle `roomBook`. Ohne Felder alles wie bisher (Goldens unverändert). **Kern**
|
||||
`room_book.rs` (Abfrage `roomBook`): Zeile je Raum (Geschoss, Nr., Name, Fläche, Nutzung, Nassraum, Boden/Wand/Decke
|
||||
als Material-Name oder Text, Aufbau, lichte Höhe, Wandfläche netto) sortiert nach Geschoss und Nummer (natürlich), dazu
|
||||
Mengen je Oberfläche und Material (Boden = Decke = Raumfläche netto; Wand = Umfang × lichte Höhe − Öffnungen in den
|
||||
Wänden am Raum; lichte Höhe = UK Decke darüber − OK Decke darunter am Raum-Innenpunkt, sonst Geschosshöhe).
|
||||
**Grundriss** ([156] erweitert): Raum mit Material-Belag (mit Oberflächenmuster) zeigt dessen Muster auf dem Raumumriss
|
||||
statt des Deckenbelags (Deckenbelag dort ausgeschnitten); Darstellung/Regeln/Aussparungen wie [156]; Freitext-Belag
|
||||
ändert nichts. Nassraum-Erkennung über `usage`, Rückfall Name (`is_wet_name`). Raumstempel: Belagszeile über
|
||||
„Bodenbelag anzeigen" im Stempel-Editor (Vorgabe aus). **Objekt-Info Raum:** Nutzung (Auswahl), Nassraum-Anzeige,
|
||||
Boden/Wand/Decke (Eingabe mit Vorschlagsliste der Projekt-Materialien; ein Material-Name wird als Verweis gespeichert,
|
||||
sonst Freitext), Bodenaufbau. **Liste:** Abschnitt „Raumbuch" im Flächenbilanz-Panel (Tabelle + Mengen, CSV/PDF über
|
||||
das Berichtsmodell, `export/roomBook.ts`), Blatt-Tabelle Quelle „Raumbuch (Oberflächen)" (Spalten Geschoss, Nr., Raum,
|
||||
Fläche, Nutzung, Boden, Wand, Decke; optional Aufbau, lichte Höhe, Wandfläche, Umfang, Nassraum), CLI
|
||||
`schedule --rooms [--format json|csv|svg|pdf]`. **IFC:** IfcSpace mit `Pset_SpaceCoveringRequirements`
|
||||
(Floor/Wall/CeilingCovering; IFC2x3 in `Pset_SpaceCommon`) und `Dossier_RoomBook` (Usage, FloorBuildUp); Import liest
|
||||
beide (fileio `reads_common`) und setzt Nutzung, Oberflächen (Material gleichen Namens → Kennung) und Aufbau. Tests:
|
||||
Rust `room_book` (7: Modell-Rundreise/Alt-Daten, Nassraum aus Nutzung, Reihenfolge, Mengen, lichte Höhe, Unsinn),
|
||||
`belag_aus_raum_statt_decke`, `belag_nassraum_aus_nutzung`, `stempel_belagszeile`, `raumbuch_tabelle`,
|
||||
`space_room_book_props`, fileio `room_book_psets_are_read`; vitest `export/roomBook.test.ts` (Zeilen, CSV, Blatt-Tabelle),
|
||||
IFC-Rundreise in `io/ifcImport.elements.test.ts`. **Offen:** keine IfcCovering-Bauteile (nur Pset-Texte); Wandoberfläche
|
||||
nicht je Wandseite (eine Angabe je Raum), keine Sockel-/Leibungsflächen; lichte Höhe ohne Dachschrägen; Belagsmuster im
|
||||
Raum am ersten Umrisspunkt ausgerichtet (keine Drehung/Ursprung je Raum); Belag im 3D und im Deckenspiegel nicht nach
|
||||
Raum; Raumbuch-Zeilen im Panel nicht klickbar (keine Auswahl); nur Linux, nicht in der Tauri-App angesehen. · M
|
||||
- ◐ **[68] Baugrube / Geländebearbeitung.** (30.10.) Kontext-Objekt `excavation` (Rust-Modell, `ContextObject`):
|
||||
Sohle (`outline`, `bottom` m ±0.00), Böschung `slope` (Standard 45°, je Kante `edgeSlopes`), Schüttung `fillSlope`
|
||||
(33.7°), Bermen `bermWidth`/`bermHeight`. Neues Gelände = clamp(t, b − d·tan β, b + H(d)) mit d = Abstand zum
|
||||
|
||||
@@ -1184,7 +1184,31 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
w_pts(&mut f, &room.boundary);
|
||||
let cat = f.str(&sia_key(room.sia_category));
|
||||
f.nums(&[area.net, area.gross, cat]);
|
||||
w_psets(&mut f, &[Pset { name: "Pset_SpaceCommon", props: common }]);
|
||||
// [158] Raumbuch: Oberflächen als Pset_SpaceCoveringRequirements (IFC2x3: in Pset_SpaceCommon),
|
||||
// Nutzung und Bodenaufbau im eigenen Pset; nur mit Angaben im Modell.
|
||||
let label = |v: Option<&str>| crate::room_book::finish_label(&p, v);
|
||||
let coverings: Vec<Prop> = [("FloorCovering", label(room.floor_finish.as_deref())), ("WallCovering", label(room.wall_finish.as_deref())), ("CeilingCovering", label(room.ceiling_finish.as_deref()))]
|
||||
.into_iter()
|
||||
.filter(|(_, v)| !v.is_empty())
|
||||
.map(|(k, v)| Prop::Label(k, v))
|
||||
.collect();
|
||||
let mut psets = Vec::new();
|
||||
if opt.ifc2x3 {
|
||||
common.extend(coverings);
|
||||
psets.push(Pset { name: "Pset_SpaceCommon", props: common });
|
||||
} else {
|
||||
psets.push(Pset { name: "Pset_SpaceCommon", props: common });
|
||||
if !coverings.is_empty() {
|
||||
psets.push(Pset { name: "Pset_SpaceCoveringRequirements", props: coverings });
|
||||
}
|
||||
}
|
||||
let mut book: Vec<Prop> = Vec::new();
|
||||
book.extend(room.usage.map(|u| u.key()).filter(|k| !k.is_empty()).map(|k| Prop::Label("Usage", k.to_string())));
|
||||
book.extend(room.floor_build_up.as_deref().map(str::trim).filter(|s| !s.is_empty()).map(|s| Prop::Label("FloorBuildUp", s.to_string())));
|
||||
if !book.is_empty() {
|
||||
psets.push(Pset { name: "Dossier_RoomBook", props: book });
|
||||
}
|
||||
w_psets(&mut f, &psets);
|
||||
}
|
||||
f.num(REC_END_SPACES);
|
||||
|
||||
|
||||
@@ -862,10 +862,25 @@ fn elements_ops(root: &Map<String, Value>, meta: &Value, products: &[IfcProduct]
|
||||
let n = boundary.len() as f64;
|
||||
let (sx, sy) = boundary.iter().fold((0.0, 0.0), |(a, b), p| (a + p["x"].as_f64().unwrap_or(f64::NAN), b + p["y"].as_f64().unwrap_or(f64::NAN)));
|
||||
let name = [s.long_name.as_deref(), s.name.as_deref()].into_iter().flatten().find(|x| !x.is_empty()).map(str::to_string).unwrap_or_else(|| format!("Raum {}", rooms_before + rooms.len() + 1));
|
||||
rooms.push(json!({
|
||||
let mut room = json!({
|
||||
"id": ctx.new_id("room"), "type": "room", "floorId": fid, "categoryCode": ROOM_CATEGORY, "siaCategory": sia,
|
||||
"name": name, "boundary": boundary, "color": room_color, "stampAnchor": {"x": js_num(sx / n), "y": js_num(sy / n)},
|
||||
}));
|
||||
});
|
||||
// [158] Raumbuch aus den Psets: Nutzung (bekannte Kennung), Oberflächen (Material gleichen Namens →
|
||||
// seine Kennung, sonst Freitext), Bodenaufbau.
|
||||
if let Some(u) = s.info.text("Usage").and_then(|u| crate::model::RoomUsage::from_key(&u)) {
|
||||
room["usage"] = u.key().into();
|
||||
}
|
||||
for (prop, field) in [("FloorCovering", "floorFinish"), ("WallCovering", "wallFinish"), ("CeilingCovering", "ceilingFinish")] {
|
||||
if let Some(t) = s.info.text(prop) {
|
||||
let comp = root.get("components").and_then(Value::as_array).and_then(|cs| cs.iter().find(|c| c.get("name").and_then(Value::as_str).map(str::trim) == Some(t.as_str()))).and_then(|c| c.get("id")).and_then(Value::as_str);
|
||||
room[field] = comp.map_or_else(|| t.clone(), str::to_string).into();
|
||||
}
|
||||
}
|
||||
if let Some(t) = s.info.text("FloorBuildUp") {
|
||||
room["floorBuildUp"] = t.into();
|
||||
}
|
||||
rooms.push(room);
|
||||
}
|
||||
|
||||
let mut roof_types = list_of(root, "roofTypes");
|
||||
@@ -1175,6 +1190,33 @@ mod tests {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// [158] Raumbuch-Eigenschaften eines IfcSpace: Nutzung, Oberflächen (Material gleichen Namens → Kennung,
|
||||
/// sonst Freitext), Bodenaufbau; unbekannte Nutzung fällt weg.
|
||||
#[test]
|
||||
fn space_room_book_props() {
|
||||
let data = vec![0.0, 2.6, 4.0, 0.0, 0.0, 3.0, 0.0, 3.0, 2.0, 0.0, 2.0];
|
||||
let mut sp = json!({"kind": "space", "at": 0, "n": 11, "storey": 0, "layers": [], "classifications": [], "longName": "Bad",
|
||||
"common": {"Usage": "bath", "FloorCovering": "Feinsteinzeug", "WallCovering": "Abrieb 1 mm", "FloorBuildUp": "UB 80"}});
|
||||
let meta = |sp: &Value| json!({
|
||||
"schema": "IFC4", "lengthScale": 1, "products": [], "skippedItems": {}, "skippedProducts": {},
|
||||
"productsWithoutGeometry": 0, "simplifiedBooleans": 0, "voidsApplied": 0, "voidsIgnored": 0, "parseErrors": 0, "truncated": false,
|
||||
"elements": {"storeys": [{"globalId": "s", "name": "EG", "elevation": 0.0}], "elements": [sp], "kept": {}, "keptReasons": {}},
|
||||
});
|
||||
let mut base = root();
|
||||
base.remove("geoAnchor");
|
||||
base.insert("components".into(), json!([{"id": "fl", "name": "Feinsteinzeug", "color": "#ccc"}]));
|
||||
let opts = IfcOptions { file_name: "a.ifc".into(), group: None, elements: true };
|
||||
let r = ifc_import(&base, &meta(&sp).to_string(), &[], &[], &data, &opts, 0.0).unwrap();
|
||||
let rooms = added(&r.ops, "rooms");
|
||||
assert_eq!(rooms.len(), 1);
|
||||
let room = &rooms[0];
|
||||
assert_eq!((room["usage"].as_str(), room["floorFinish"].as_str(), room["wallFinish"].as_str(), room["floorBuildUp"].as_str()), (Some("bath"), Some("fl"), Some("Abrieb 1 mm"), Some("UB 80")));
|
||||
assert!(room.get("ceilingFinish").is_none());
|
||||
sp["common"] = json!({"Usage": "sauna"});
|
||||
let r = ifc_import(&base, &meta(&sp).to_string(), &[], &[], &data, &opts, 0.0).unwrap();
|
||||
assert!(added(&r.ops, "rooms")[0].get("usage").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn roof_stair_arc_wall_round_opening_type_by_name_and_map_shift() {
|
||||
let (m, data) = meta("Haustür Eiche");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
pub mod export_schedule;
|
||||
pub mod opening_schedule;
|
||||
pub mod room_book;
|
||||
pub mod u_value;
|
||||
pub mod sheet_table;
|
||||
pub mod terrain;
|
||||
|
||||
@@ -3468,6 +3468,10 @@ pub struct RoomStamp {
|
||||
#[serde(rename = "roundingStep", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub rounding_step: Option<f64>,
|
||||
/// [158] Bodenbelag des Raums als Zeile anzeigen (Live-Zeile). Fehlt/false: keine Belagszeile.
|
||||
#[serde(rename = "showFinish", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub show_finish: Option<bool>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
@@ -3531,11 +3535,67 @@ pub struct Room {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub stamp: Option<RoomStamp>,
|
||||
/// [158] Raumbuch: Nutzung (Wohnen, Bad, Verkehr …); Nassraum wird daraus abgeleitet.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub usage: Option<RoomUsage>,
|
||||
/// [158] Bodenbelag: Kennung eines Bauteil-Materials (`components`) oder Freitext. Ein Material mit
|
||||
/// Oberflächenmuster gilt im Grundriss im Raum statt des Belags der Decke.
|
||||
#[serde(rename = "floorFinish", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub floor_finish: Option<String>,
|
||||
/// [158] Wandoberfläche (Material-Kennung oder Freitext).
|
||||
#[serde(rename = "wallFinish", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub wall_finish: Option<String>,
|
||||
/// [158] Deckenoberfläche (Material-Kennung oder Freitext).
|
||||
#[serde(rename = "ceilingFinish", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub ceiling_finish: Option<String>,
|
||||
/// [158] Bodenaufbau als Freitext (z. B. „Parkett 15, UB 80, TSD 20").
|
||||
#[serde(rename = "floorBuildUp", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub floor_build_up: Option<String>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
}
|
||||
|
||||
/// [158] Nutzung eines Raums (Raumbuch). Nassräume: Bad, WC, Dusche, Waschküche.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
pub enum RoomUsage {
|
||||
#[default]
|
||||
#[serde(rename = "living")]
|
||||
Living,
|
||||
#[serde(rename = "sleeping")]
|
||||
Sleeping,
|
||||
#[serde(rename = "kitchen")]
|
||||
Kitchen,
|
||||
#[serde(rename = "dining")]
|
||||
Dining,
|
||||
#[serde(rename = "bath")]
|
||||
Bath,
|
||||
#[serde(rename = "wc")]
|
||||
Wc,
|
||||
#[serde(rename = "shower")]
|
||||
Shower,
|
||||
#[serde(rename = "laundry")]
|
||||
Laundry,
|
||||
#[serde(rename = "circulation")]
|
||||
Circulation,
|
||||
#[serde(rename = "technical")]
|
||||
Technical,
|
||||
#[serde(rename = "storage")]
|
||||
Storage,
|
||||
#[serde(rename = "office")]
|
||||
Office,
|
||||
#[serde(rename = "other")]
|
||||
Other,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
// ── Freie 2D-Zeichengeometrie (Drawing2D) ──────────────────────────────────
|
||||
// Ein semantisches 2D-Element (wie Wall/Door), das beim Rendern abgeleitet wird
|
||||
// (keine vorab erzeugten Plan-Primitive). Siehe docs/design/drawing-tools.md §7.
|
||||
@@ -4534,6 +4594,9 @@ pub enum LayoutTableSource {
|
||||
/// [68] Erdarbeiten: Baugruben mit Abtrag/Auftrag/Hinterfüllung.
|
||||
#[serde(rename = "earthworks")]
|
||||
Earthworks,
|
||||
/// [158] Raumbuch: Oberflächen je Raum.
|
||||
#[serde(rename = "roomBook")]
|
||||
RoomBook,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
|
||||
@@ -115,7 +115,7 @@ pub fn reveal_areas(p: &Project, w: &Wall, o: &Opening) -> Vec<RevealArea> {
|
||||
acc
|
||||
}
|
||||
|
||||
fn in_ring(x: f64, y: f64, ring: &[Vec2]) -> bool {
|
||||
pub(crate) fn in_ring(x: f64, y: f64, ring: &[Vec2]) -> bool {
|
||||
let mut inside = false;
|
||||
let mut j = ring.len().wrapping_sub(1);
|
||||
for i in 0..ring.len() {
|
||||
@@ -139,18 +139,27 @@ fn room_at(p: &Project, floor_id: &str, x: f64, y: f64) -> Option<String> {
|
||||
p.rooms.as_deref().unwrap_or(&[]).iter().find(|r| r.floor_id == floor_id && in_ring(x, y, &r.boundary)).map(room_label)
|
||||
}
|
||||
|
||||
/// Räume links/rechts der Wand an der Achsposition `at` (Meter ab Wandanfang).
|
||||
fn rooms_beside(p: &Project, w: &Wall, at: f64) -> (Option<String>, Option<String>) {
|
||||
/// Prüfpunkte links/rechts der Wand an der Achsposition `at` (Meter ab Wandanfang), je eine halbe
|
||||
/// Wanddicke plus 10 cm neben der Achse; `None` bei entarteter Wand.
|
||||
pub(crate) fn side_points(p: &Project, w: &Wall, at: f64) -> Option<([f64; 2], [f64; 2])> {
|
||||
let (dx, dy) = (w.end.x - w.start.x, w.end.y - w.start.y);
|
||||
let len = hypot2(dx, dy);
|
||||
if !(len > 1e-9) {
|
||||
return (None, None);
|
||||
return None;
|
||||
}
|
||||
let (ux, uy) = (dx / len, dy / len);
|
||||
let (px, py) = (w.start.x + ux * at, w.start.y + uy * at);
|
||||
let (nx, ny) = (-uy, ux);
|
||||
let d = Project::type_thickness(&p.wall_type_or_fallback(w).layers) + 0.1;
|
||||
(room_at(p, &w.floor_id, px + nx * d, py + ny * d), room_at(p, &w.floor_id, px - nx * d, py - ny * d))
|
||||
Some(([px + nx * d, py + ny * d], [px - nx * d, py - ny * d]))
|
||||
}
|
||||
|
||||
/// Räume links/rechts der Wand an der Achsposition `at` (Meter ab Wandanfang).
|
||||
fn rooms_beside(p: &Project, w: &Wall, at: f64) -> (Option<String>, Option<String>) {
|
||||
match side_points(p, w, at) {
|
||||
Some((l, r)) => (room_at(p, &w.floor_id, l[0], l[1]), room_at(p, &w.floor_id, r[0], r[1])),
|
||||
None => (None, None),
|
||||
}
|
||||
}
|
||||
|
||||
fn has_rooms(p: &Project, floor_id: &str) -> bool {
|
||||
|
||||
@@ -365,11 +365,14 @@ fn floor_finishes(c: &Ctx, rooms: &[Primitive], out: &mut Vec<Primitive>) {
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
if ceilings.is_empty() {
|
||||
// [158] Räume mit eigenem Bodenbelag (Bauteil-Material): dort gilt ihr Belag statt dem der Decke.
|
||||
let own = ff::own_finish_rooms(c);
|
||||
if ceilings.is_empty() && own.is_empty() {
|
||||
return;
|
||||
}
|
||||
// Aussparungen und Nassräume erst rechnen, wenn ein Belag gezeichnet wird.
|
||||
let mut excl: Option<Vec<Vec<[f64; 2]>>> = None;
|
||||
let own_rings: Vec<Vec<[f64; 2]>> = own.iter().map(|(_, _, ring)| ring.clone()).collect();
|
||||
// Belag je Quelle nach Darstellung und Regeln: (Stücke, Stärke, Farbe, Ebene).
|
||||
let mut jobs: Vec<(Vec<([f64; 2], [f64; 2])>, f64, String, &str, Option<String>)> = Vec::new();
|
||||
let mut wet: Option<Vec<Vec<[f64; 2]>>> = None;
|
||||
for ce in ceilings {
|
||||
// [33] Schicht-Override mit eigener Schraffur bzw. ohne Muster: kein Belagsmuster.
|
||||
@@ -394,6 +397,31 @@ fn floor_finishes(c: &Ctx, rooms: &[Primitive], out: &mut Vec<Primitive>) {
|
||||
ff::clip_inside_any(&segs, wet.get_or_insert_with(|| ff::wet_rooms(c)))
|
||||
}
|
||||
};
|
||||
let segs = if own_rings.is_empty() { segs } else { ff::clip_outside_all(segs, &own_rings) };
|
||||
let w = ov.lineweight.map_or(w, |x| ff::weight(Some(x)));
|
||||
jobs.push((segs, w, ov.color.unwrap_or(ink), &ce.category_code, ov.linetype_id));
|
||||
}
|
||||
for (room, comp, ring) in &own {
|
||||
let ov = c.overrides(Some("floor_finish"), &room.category_code, Some(&comp.name));
|
||||
let show = match ov.hide {
|
||||
Some(true) => false,
|
||||
Some(false) => true,
|
||||
None => match mode {
|
||||
ff::Show::Off => false,
|
||||
ff::Show::All => true,
|
||||
ff::Show::Wet => ff::is_tile(comp) && ff::is_wet_room(room),
|
||||
},
|
||||
};
|
||||
if !show {
|
||||
continue;
|
||||
}
|
||||
let Some((segs, w)) = ff::room_segments(comp, ring, c.a.scale) else { continue };
|
||||
let w = ov.lineweight.map_or(w, |x| ff::weight(Some(x)));
|
||||
jobs.push((segs, w, ov.color.unwrap_or_else(|| ff::INK.to_string()), &room.category_code, ov.linetype_id));
|
||||
}
|
||||
// Aussparungen erst rechnen, wenn ein Belag gezeichnet wird.
|
||||
let mut excl: Option<Vec<Vec<[f64; 2]>>> = None;
|
||||
for (segs, w, ink, cat, linetype) in jobs {
|
||||
if segs.is_empty() {
|
||||
continue;
|
||||
}
|
||||
@@ -412,10 +440,8 @@ fn floor_finishes(c: &Ctx, rooms: &[Primitive], out: &mut Vec<Primitive>) {
|
||||
v
|
||||
});
|
||||
let segs = ff::clip_outside_all(segs, excl);
|
||||
let w = ov.lineweight.map_or(w, |x| ff::weight(Some(x)));
|
||||
let ink = ov.color.unwrap_or(ink);
|
||||
let dash = overrides::linetype_dash(p, ov.linetype_id.as_deref());
|
||||
let greyed = Some(c.greyed(&ce.category_code));
|
||||
let dash = overrides::linetype_dash(p, linetype.as_deref());
|
||||
let greyed = Some(c.greyed(cat));
|
||||
for (a, b) in segs {
|
||||
out.push(line(pv(a), pv(b), "floor-finish-pattern", w, dash.clone(), &ink, greyed));
|
||||
}
|
||||
@@ -968,6 +994,14 @@ fn rooms(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds, obstacles: &sup
|
||||
(room.stamp_doc.clone().unwrap_or_else(|| doc_from_text(&room.name)), lines)
|
||||
}
|
||||
};
|
||||
// [158] Belagszeile (Einstellung am Stempel, Vorgabe aus): Bodenbelag des Raums.
|
||||
let mut extra_lines = extra_lines;
|
||||
if !overview && room.stamp.as_ref().and_then(|s| s.show_finish) == Some(true) {
|
||||
let label = crate::room_book::finish_label(c.p, room.floor_finish.as_deref());
|
||||
if !label.is_empty() {
|
||||
extra_lines.push(StampLine { text: label, align: Align::Center });
|
||||
}
|
||||
}
|
||||
let candidates = if room.stamp_anchor.is_some() { vec![at] } else { stamp_candidates(&pts, pole) };
|
||||
// [140] Teil 6: ohne eigenen Anker weicht der Stempel anderem Planinhalt im Raum aus (`place_stamp`).
|
||||
let obst = if room.stamp_anchor.is_some() { Default::default() } else { obstacles.within(ring_bounds(&pts)) };
|
||||
@@ -2204,6 +2238,91 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// [158] Raum mit eigenem Bodenbelag (Material mit Muster): im Raum gilt sein Muster, auf den Raum
|
||||
/// beschnitten, statt des Deckenbelags; ausserhalb bleibt der Deckenbelag.
|
||||
#[test]
|
||||
fn belag_aus_raum_statt_decke() {
|
||||
let mut p = belag_projekt(SurfacePatternKind::Grid, 0.3, 0.3);
|
||||
p.components.push(Component { id: "fliese".into(), name: "Feinsteinzeug".into(), surface_pattern: Some(SurfacePattern { kind: SurfacePatternKind::Grid, spacing: 0.6, height: Some(0.6), ..Default::default() }), ..Default::default() });
|
||||
let mut bad = p.rooms.as_ref().unwrap()[0].clone();
|
||||
bad.id = "R-bad".into();
|
||||
bad.floor_id = "og".into();
|
||||
bad.name = "Raum 7".into();
|
||||
bad.stamp_anchor = Some(Vec2 { x: 4.5, y: 3.6 });
|
||||
bad.boundary = vec![Vec2 { x: 3.0, y: 2.0 }, Vec2 { x: 4.8, y: 2.0 }, Vec2 { x: 4.8, y: 3.8 }, Vec2 { x: 3.0, y: 3.8 }];
|
||||
p.rooms.as_mut().unwrap().push(bad.clone());
|
||||
let before = belag(&p, "og", 1.0, 50.0, serde_json::json!({}));
|
||||
let ring: Vec<[f64; 2]> = bad.boundary.iter().map(|v| [v.x, v.y]).collect();
|
||||
let inside = |l: &[(Vec2, Vec2, f64, String)]| l.iter().filter(|(a, b, ..)| crate::surface_pattern::point_in([(a.x + b.x) / 2.0, (a.y + b.y) / 2.0], &ring)).count();
|
||||
let n_before = inside(&before);
|
||||
p.rooms.as_mut().unwrap().last_mut().unwrap().floor_finish = Some("fliese".into());
|
||||
let after = belag(&p, "og", 1.0, 50.0, serde_json::json!({}));
|
||||
let n_after = inside(&after);
|
||||
assert!(n_after > 0 && n_before > 0, "{n_after} / {n_before}");
|
||||
// Im Raum nur noch Linien des 0.6-Rasters (x bzw. y auf 3.0 + k·0.6).
|
||||
for (a, b, ..) in after.iter().filter(|(a, b, ..)| crate::surface_pattern::point_in([(a.x + b.x) / 2.0, (a.y + b.y) / 2.0], &ring)) {
|
||||
let on = |v: f64| ((v - 3.0) / 0.6 - ((v - 3.0) / 0.6).round()).abs() < 1e-6 || ((v - 2.0) / 0.6 - ((v - 2.0) / 0.6).round()).abs() < 1e-6;
|
||||
assert!((a.x - b.x).abs() < 1e-9 && on(a.x) || (a.y - b.y).abs() < 1e-9 && on(a.y), "{a:?}–{b:?}");
|
||||
}
|
||||
// Ausserhalb unverändert der Deckenbelag (gleiche Linienlänge ausserhalb des Raums).
|
||||
let outside_len = |l: &[(Vec2, Vec2, f64, String)]| {
|
||||
let mut rest = Vec::new();
|
||||
for (a, b, ..) in l {
|
||||
crate::surface_pattern::clip_outside_poly([a.x, a.y], [b.x, b.y], &ring, &mut rest);
|
||||
}
|
||||
rest.iter().map(|(a, b)| ((b[0] - a[0]).powi(2) + (b[1] - a[1]).powi(2)).sqrt()).sum::<f64>()
|
||||
};
|
||||
assert!((outside_len(&before) - outside_len(&after)).abs() < 1e-6, "{} {}", outside_len(&before), outside_len(&after));
|
||||
// Freitext-Belag: kein Muster bekannt, der Deckenbelag bleibt.
|
||||
p.rooms.as_mut().unwrap().last_mut().unwrap().floor_finish = Some("Linoleum".into());
|
||||
assert_eq!(belag(&p, "og", 1.0, 50.0, serde_json::json!({})).len(), before.len());
|
||||
}
|
||||
|
||||
/// [158] Nassraum aus der Nutzung: im Modus „Nassräume" (1:100) zeigt der Raum mit Nutzung „Dusche"
|
||||
/// und Plattenbelag sein Muster, auch ohne Deckenbelag und ohne passenden Namen.
|
||||
#[test]
|
||||
fn belag_nassraum_aus_nutzung() {
|
||||
let mut p = belag_projekt(SurfacePatternKind::RunningBond, 0.6, 0.1);
|
||||
p.components.push(Component { id: "fliese".into(), name: "Feinsteinzeug".into(), surface_pattern: Some(SurfacePattern { kind: SurfacePatternKind::Grid, spacing: 0.3, height: Some(0.3), ..Default::default() }), ..Default::default() });
|
||||
let mut r = p.rooms.as_ref().unwrap()[0].clone();
|
||||
r.id = "R-d".into();
|
||||
r.floor_id = "og".into();
|
||||
r.name = "Raum 7".into();
|
||||
r.stamp_anchor = Some(Vec2 { x: 4.5, y: 3.6 });
|
||||
r.boundary = vec![Vec2 { x: 3.0, y: 2.0 }, Vec2 { x: 4.8, y: 2.0 }, Vec2 { x: 4.8, y: 3.8 }, Vec2 { x: 3.0, y: 3.8 }];
|
||||
r.floor_finish = Some("fliese".into());
|
||||
p.rooms.as_mut().unwrap().push(r);
|
||||
set_finish(&mut p, "og", Some(FloorFinishDisplay::Wet));
|
||||
assert!(belag(&p, "og", 1.0, 100.0, serde_json::json!({})).is_empty(), "ohne Nutzung, Name kein Nassraum");
|
||||
p.rooms.as_mut().unwrap().last_mut().unwrap().usage = Some(RoomUsage::Shower);
|
||||
let l = belag(&p, "og", 1.0, 100.0, serde_json::json!({}));
|
||||
assert!(l.len() >= 4, "{}", l.len());
|
||||
// Nutzung „Lager" schlägt den Namen „Bad".
|
||||
let last = p.rooms.as_mut().unwrap().last_mut().unwrap();
|
||||
last.usage = Some(RoomUsage::Storage);
|
||||
last.name = "Bad".into();
|
||||
assert!(belag(&p, "og", 1.0, 100.0, serde_json::json!({})).is_empty());
|
||||
}
|
||||
|
||||
/// [158] Belagszeile im Raumstempel nur mit Einstellung (Vorgabe aus).
|
||||
#[test]
|
||||
fn stempel_belagszeile() {
|
||||
let mut p = sample();
|
||||
p.components.push(Component { id: "par".into(), name: "Parkett Eiche".into(), ..Default::default() });
|
||||
let r = &mut p.rooms.as_mut().unwrap()[0];
|
||||
r.floor_finish = Some("par".into());
|
||||
r.stamp = Some(RoomStamp { name: "Wohnen".into(), show_floor_area: true, ..Default::default() });
|
||||
let (floor, cat) = (r.floor_id.clone(), r.category_code.clone());
|
||||
let lines = |p: &Project| {
|
||||
let t = serde_json::json!({ "floor": floor, "show": [cat], "grey": [], "scale": 50 }).to_string();
|
||||
let d = plan_domains(p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap();
|
||||
d.rooms.iter().find_map(|q| match q { Primitive::Text { extra_lines, room_id: Some(_), .. } => Some(extra_lines.iter().map(|l| l.text.clone()).collect::<Vec<_>>()), _ => None }).unwrap()
|
||||
};
|
||||
assert!(!lines(&p).iter().any(|l| l == "Parkett Eiche"));
|
||||
p.rooms.as_mut().unwrap()[0].stamp.as_mut().unwrap().show_finish = Some(true);
|
||||
assert!(lines(&p).iter().any(|l| l == "Parkett Eiche"), "{:?}", lines(&p));
|
||||
}
|
||||
|
||||
/// [156] Override-Regeln der Bauteilart „floor_finish": ausblenden, erzwingen, färben.
|
||||
#[test]
|
||||
fn belag_regeln() {
|
||||
|
||||
@@ -58,8 +58,13 @@ fn has_any(text: &str, words: &[&str]) -> bool {
|
||||
words.iter().any(|w| t.contains(w))
|
||||
}
|
||||
|
||||
/// Nassraum nach Name (auch Stempel-Name): Bad, WC, Dusche, Nasszelle, Toilette, Sanitär …
|
||||
/// Nassraum: [158] aus der Nutzung (`Room.usage`), ohne Nutzung nach dem Namen ([`is_wet_name`]).
|
||||
pub fn is_wet_room(r: &Room) -> bool {
|
||||
crate::room_book::is_wet(r)
|
||||
}
|
||||
|
||||
/// Nassraum nach Name (auch Stempel-Name): Bad, WC, Dusche, Nasszelle, Toilette, Sanitär …
|
||||
pub fn is_wet_name(r: &Room) -> bool {
|
||||
const WET: [&str; 12] = ["bad", "wc", "dusche", "nasszelle", "toilette", "sanitär", "sanitaer", "waschraum", "bath", "shower", "toilet", "lavabo"];
|
||||
let names = [Some(r.name.as_str()), r.stamp.as_ref().map(|s| s.name.as_str()), r.stamp.as_ref().and_then(|s| s.name_line2.as_deref())];
|
||||
names.into_iter().flatten().any(|n| has_any(n, &WET))
|
||||
@@ -83,6 +88,31 @@ pub fn thinning_scale(scale: f64) -> f64 {
|
||||
s * MIN_PAPER_MM / crate::surface_pattern::MIN_PAPER_MM
|
||||
}
|
||||
|
||||
/// [158] Räume des Geschosses mit eigenem Bodenbelag aus den Bauteil-Materialien (sichtbar, gültiger
|
||||
/// Umriss): Raum, Material, Umriss. Freitext-Beläge gelten nicht (kein Muster bekannt).
|
||||
pub fn own_finish_rooms<'a>(c: &Ctx<'a>) -> Vec<(&'a Room, &'a Component, Vec<P>)> {
|
||||
c.p.rooms
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.filter(|r| r.floor_id == c.a.floor && r.boundary.len() >= 3 && c.vis(&r.category_code, &r.id))
|
||||
.filter_map(|r| {
|
||||
let comp = crate::room_book::finish_component(c.p, r.floor_finish.as_deref())?;
|
||||
let ring: Vec<P> = r.boundary.iter().map(|v| [v.x, v.y]).collect();
|
||||
ring.iter().all(|q| q[0].is_finite() && q[1].is_finite()).then_some((r, comp, ring))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// [158] Belagsmuster eines Raums: Muster des Materials auf dem Raumumriss (Ursprung erster Punkt,
|
||||
/// Ausrichtung am Plan), ausgedünnt wie der Deckenbelag; dazu die Strichstärke.
|
||||
pub fn room_segments(comp: &Component, ring: &[P], scale: f64) -> Option<(Vec<(P, P)>, f64)> {
|
||||
let pat = comp.surface_pattern.as_ref()?;
|
||||
let spec = crate::surface_pattern::spec_of(pat, 0.0)?;
|
||||
let segs = crate::surface_pattern::segments(ring, &spec, *ring.first()?, thinning_scale(scale));
|
||||
Some((segs, weight(pat.weight_mm)))
|
||||
}
|
||||
|
||||
/// Umrisse der Nassräume des Geschosses.
|
||||
pub fn wet_rooms(c: &Ctx) -> Vec<Vec<P>> {
|
||||
c.p.rooms.as_deref().unwrap_or(&[]).iter().filter(|r| r.floor_id == c.a.floor && r.boundary.len() >= 3 && is_wet_room(r)).map(|r| r.boundary.iter().map(|v| [v.x, v.y]).collect()).collect()
|
||||
|
||||
@@ -74,6 +74,7 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
|
||||
("scheduleRows", _) => json(&export_schedule::schedule_rows(p)),
|
||||
("openingSchedule", _) => json(&crate::opening_schedule::opening_schedule(p)),
|
||||
("elementSchedule", _) => json(&crate::u_value::element_schedule(p)),
|
||||
("roomBook", _) => json(&crate::room_book::room_book(p)),
|
||||
("sheetTables", _) => Ok(crate::sheet_table::query(p, text).to_string()),
|
||||
("sheetTableCatalog", _) => Ok(crate::sheet_table::catalog_json().to_string()),
|
||||
("presentationSheet", _) => Ok(crate::presentation_sheet::query(p, text)?.to_string()),
|
||||
|
||||
@@ -0,0 +1,406 @@
|
||||
//! [158] Raumbuch: Oberflächen je Raum (Boden, Wand, Decke), Nutzung und die Mengen daraus.
|
||||
//!
|
||||
//! Je Raum eine Zeile mit Geschoss, Nummer, Name, Fläche, Nutzung (Nassraum abgeleitet), Bodenbelag,
|
||||
//! Wand- und Deckenoberfläche (Bauteil-Material über seine Kennung oder Freitext) und Bodenaufbau.
|
||||
//! Mengen: Bodenfläche = Deckenfläche = Raumfläche (netto); Wandfläche netto = Umfang × lichte Höhe −
|
||||
//! Öffnungen in den Wänden am Raum. Lichte Höhe aus den Decken über/unter dem Raum (Oberkante der Decke
|
||||
//! am Boden bis Unterkante der Decke darüber), sonst Geschosshöhe.
|
||||
//! Die Tabelle wird im Kern gerechnet; CSV/PDF und Blatt-Tabelle formatieren dieselben Zeilen.
|
||||
|
||||
use crate::model::*;
|
||||
use serde::Serialize;
|
||||
|
||||
impl RoomUsage {
|
||||
/// Kennung wie im JSON (`living`, `bath` …); leer für unbekannte Werte.
|
||||
pub fn key(self) -> &'static str {
|
||||
match self {
|
||||
RoomUsage::Living => "living",
|
||||
RoomUsage::Sleeping => "sleeping",
|
||||
RoomUsage::Kitchen => "kitchen",
|
||||
RoomUsage::Dining => "dining",
|
||||
RoomUsage::Bath => "bath",
|
||||
RoomUsage::Wc => "wc",
|
||||
RoomUsage::Shower => "shower",
|
||||
RoomUsage::Laundry => "laundry",
|
||||
RoomUsage::Circulation => "circulation",
|
||||
RoomUsage::Technical => "technical",
|
||||
RoomUsage::Storage => "storage",
|
||||
RoomUsage::Office => "office",
|
||||
RoomUsage::Other => "other",
|
||||
RoomUsage::Unknown => "",
|
||||
}
|
||||
}
|
||||
|
||||
/// Alle wählbaren Nutzungen (Reihenfolge der Auswahl).
|
||||
pub const ALL: [RoomUsage; 13] = [
|
||||
RoomUsage::Living,
|
||||
RoomUsage::Sleeping,
|
||||
RoomUsage::Kitchen,
|
||||
RoomUsage::Dining,
|
||||
RoomUsage::Bath,
|
||||
RoomUsage::Wc,
|
||||
RoomUsage::Shower,
|
||||
RoomUsage::Laundry,
|
||||
RoomUsage::Circulation,
|
||||
RoomUsage::Technical,
|
||||
RoomUsage::Storage,
|
||||
RoomUsage::Office,
|
||||
RoomUsage::Other,
|
||||
];
|
||||
|
||||
pub fn from_key(k: &str) -> Option<RoomUsage> {
|
||||
let k = k.trim().to_lowercase();
|
||||
Self::ALL.into_iter().find(|u| u.key() == k)
|
||||
}
|
||||
|
||||
/// Nassraum: Bad, WC, Dusche, Waschküche.
|
||||
pub fn is_wet(self) -> bool {
|
||||
matches!(self, RoomUsage::Bath | RoomUsage::Wc | RoomUsage::Shower | RoomUsage::Laundry)
|
||||
}
|
||||
}
|
||||
|
||||
/// Bauteil-Material, auf das eine Oberflächen-Angabe verweist (Kennung, sonst gleicher Name).
|
||||
pub fn finish_component<'a>(p: &'a Project, v: Option<&str>) -> Option<&'a Component> {
|
||||
let v = v.map(str::trim).filter(|s| !s.is_empty())?;
|
||||
p.component(v).or_else(|| p.components.iter().find(|c| c.name.trim() == v))
|
||||
}
|
||||
|
||||
/// Anzeigetext einer Oberflächen-Angabe: Name des Materials, sonst der Freitext.
|
||||
pub fn finish_label(p: &Project, v: Option<&str>) -> String {
|
||||
let t = v.map(str::trim).unwrap_or("");
|
||||
match p.component(t) {
|
||||
Some(c) if !t.is_empty() => c.name.clone(),
|
||||
_ => t.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn level_of<'a>(p: &'a Project, id: &str) -> Option<&'a DrawingLevel> {
|
||||
p.drawing_levels.iter().find(|l| l.id == id)
|
||||
}
|
||||
|
||||
fn in_ceiling(ce: &Ceiling, x: f64, y: f64) -> bool {
|
||||
use crate::opening_schedule::in_ring;
|
||||
ce.outline.len() >= 3 && in_ring(x, y, &ce.outline) && !ce.openings.as_deref().unwrap_or(&[]).iter().any(|h| h.len() >= 3 && in_ring(x, y, h))
|
||||
}
|
||||
|
||||
/// Lichte Höhe eines Raums (m): von der Oberkante der Decke unter dem Raum (bis 0.3 m unter bzw. 0.5 m
|
||||
/// über dem Geschossboden, sonst der Geschossboden) bis zur Unterkante der nächsten Decke darüber
|
||||
/// (sonst Geschossoberkante). Ohne Geschosshöhe 2.5 m.
|
||||
pub fn clear_height(p: &Project, r: &Room) -> f64 {
|
||||
let lvl = level_of(p, &r.floor_id);
|
||||
let base = lvl.and_then(|l| l.base_elevation).filter(|v| v.is_finite()).unwrap_or(0.0);
|
||||
let fh = lvl.and_then(|l| l.floor_height).filter(|h| h.is_finite() && *h > 0.0).unwrap_or(2.5);
|
||||
let ring: Vec<[f64; 2]> = r.boundary.iter().map(|v| [v.x, v.y]).collect();
|
||||
if ring.len() < 3 {
|
||||
return fh;
|
||||
}
|
||||
let [x, y] = crate::room_area::label_point(&ring);
|
||||
let over: Vec<(f64, f64)> = p.ceilings.as_deref().unwrap_or(&[]).iter().filter(|ce| in_ceiling(ce, x, y)).map(|ce| p.ceiling_vertical_extent(ce)).filter(|(a, b)| a.is_finite() && b.is_finite()).collect();
|
||||
let floor_z = over.iter().map(|e| e.1).filter(|t| *t >= base - 0.3 && *t <= base + 0.5).fold(f64::NAN, f64::max);
|
||||
let floor_z = if floor_z.is_finite() { floor_z } else { base };
|
||||
let ceil_z = over.iter().map(|e| e.0).filter(|b| *b > floor_z + 1.0).fold(f64::NAN, f64::min);
|
||||
let ceil_z = if ceil_z.is_finite() { ceil_z } else { base + fh };
|
||||
let h = ceil_z - floor_z;
|
||||
if h.is_finite() && h > 0.5 {
|
||||
h
|
||||
} else {
|
||||
fh
|
||||
}
|
||||
}
|
||||
|
||||
/// Fläche der Wand-Öffnungen (Tür, Fenster) am Raum: Öffnungen in Wänden des Geschosses, deren Prüfpunkt
|
||||
/// neben der Wand (eine Seite) im Raum liegt.
|
||||
pub fn opening_area(p: &Project, r: &Room) -> f64 {
|
||||
use crate::opening_schedule::{in_ring, side_points};
|
||||
let mut sum = 0.0;
|
||||
for o in p.openings.as_deref().unwrap_or(&[]) {
|
||||
if crate::opening_shape::is_surface_hosted(o) {
|
||||
continue;
|
||||
}
|
||||
let Some(w) = p.walls.iter().find(|w| w.id == o.host_wall_id && w.floor_id == r.floor_id) else { continue };
|
||||
let Some((a, b)) = side_points(p, w, o.position + o.width / 2.0) else { continue };
|
||||
if in_ring(a[0], a[1], &r.boundary) || in_ring(b[0], b[1], &r.boundary) {
|
||||
let area = o.width * o.height;
|
||||
if area.is_finite() && area > 0.0 {
|
||||
sum += area;
|
||||
}
|
||||
}
|
||||
}
|
||||
sum
|
||||
}
|
||||
|
||||
/// Nassraum: aus der Nutzung, ohne Nutzung nach dem Namen (`plan::floor_finish::is_wet_name`).
|
||||
pub fn is_wet(r: &Room) -> bool {
|
||||
match r.usage {
|
||||
Some(u) if u != RoomUsage::Unknown => u.is_wet(),
|
||||
_ => crate::plan::floor_finish::is_wet_name(r),
|
||||
}
|
||||
}
|
||||
|
||||
/// Eine Zeile des Raumbuchs (JSON-Form: `RoomBookRow` in TS).
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RoomBookRow {
|
||||
pub id: String,
|
||||
pub floor: String,
|
||||
pub floor_id: String,
|
||||
pub number: String,
|
||||
pub name: String,
|
||||
/// Nettofläche (m²) = Boden- und Deckenfläche.
|
||||
pub area: f64,
|
||||
pub perimeter: f64,
|
||||
pub clear_height: f64,
|
||||
/// Nutzungs-Kennung (`living` …), leer ohne Angabe.
|
||||
pub usage: String,
|
||||
pub wet: bool,
|
||||
/// Anzeigetexte (Material-Name oder Freitext), leer ohne Angabe.
|
||||
pub floor_finish: String,
|
||||
pub wall_finish: String,
|
||||
pub ceiling_finish: String,
|
||||
pub floor_build_up: String,
|
||||
/// Wandfläche netto: Umfang × lichte Höhe − Öffnungen (m²).
|
||||
pub wall_area: f64,
|
||||
pub opening_area: f64,
|
||||
}
|
||||
|
||||
/// Menge einer Oberfläche: Fläche je Material/Freitext und Lage.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct FinishQty {
|
||||
/// "floor", "wall" oder "ceiling".
|
||||
pub surface: &'static str,
|
||||
pub finish: String,
|
||||
pub area: f64,
|
||||
pub rooms: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RoomBook {
|
||||
pub rows: Vec<RoomBookRow>,
|
||||
pub quantities: Vec<FinishQty>,
|
||||
}
|
||||
|
||||
/// Raumnummern natürlich vergleichen („1.2" vor „1.10").
|
||||
fn natural_cmp(a: &str, b: &str) -> std::cmp::Ordering {
|
||||
let split = |s: &str| -> Vec<(bool, String)> {
|
||||
let mut out: Vec<(bool, String)> = Vec::new();
|
||||
for ch in s.chars() {
|
||||
let d = ch.is_ascii_digit();
|
||||
match out.last_mut() {
|
||||
Some((k, t)) if *k == d => t.push(ch),
|
||||
_ => out.push((d, ch.to_string())),
|
||||
}
|
||||
}
|
||||
out
|
||||
};
|
||||
let (x, y) = (split(a), split(b));
|
||||
for (p, q) in x.iter().zip(y.iter()) {
|
||||
let o = match (p.0, q.0) {
|
||||
(true, true) => p.1.trim_start_matches('0').len().cmp(&q.1.trim_start_matches('0').len()).then_with(|| p.1.trim_start_matches('0').cmp(q.1.trim_start_matches('0'))),
|
||||
_ => p.1.cmp(&q.1),
|
||||
};
|
||||
if o != std::cmp::Ordering::Equal {
|
||||
return o;
|
||||
}
|
||||
}
|
||||
x.len().cmp(&y.len())
|
||||
}
|
||||
|
||||
/// Raumbuch des Projekts: Zeilen je Geschoss (Ebenen-Reihenfolge), dann nach Raumnummer (natürlich,
|
||||
/// Räume ohne Nummer in Dokumentreihenfolge danach); dazu die Mengen je Oberfläche und Material.
|
||||
pub fn room_book(p: &Project) -> RoomBook {
|
||||
let mut rows = Vec::new();
|
||||
for r in p.rooms.as_deref().unwrap_or(&[]) {
|
||||
if r.boundary.len() < 3 {
|
||||
continue;
|
||||
}
|
||||
let ring: Vec<[f64; 2]> = r.boundary.iter().map(|v| [v.x, v.y]).collect();
|
||||
let ev = crate::room_area::evaluate(&ring, 0.0);
|
||||
let area = if ev.net.is_finite() { ev.net } else { 0.0 };
|
||||
let perimeter = if ev.perimeter.is_finite() { ev.perimeter } else { 0.0 };
|
||||
let h = clear_height(p, r);
|
||||
let open = opening_area(p, r);
|
||||
let number = r.stamp.as_ref().and_then(|s| s.number.as_deref()).map(str::trim).unwrap_or("").to_string();
|
||||
rows.push(RoomBookRow {
|
||||
id: r.id.clone(),
|
||||
floor: level_of(p, &r.floor_id).map_or(r.floor_id.clone(), |l| l.name.clone()),
|
||||
floor_id: r.floor_id.clone(),
|
||||
number,
|
||||
name: r.name.clone(),
|
||||
area,
|
||||
perimeter,
|
||||
clear_height: h,
|
||||
usage: r.usage.map(|u| u.key().to_string()).unwrap_or_default(),
|
||||
wet: is_wet(r),
|
||||
floor_finish: finish_label(p, r.floor_finish.as_deref()),
|
||||
wall_finish: finish_label(p, r.wall_finish.as_deref()),
|
||||
ceiling_finish: finish_label(p, r.ceiling_finish.as_deref()),
|
||||
floor_build_up: r.floor_build_up.as_deref().map(str::trim).unwrap_or("").to_string(),
|
||||
wall_area: (perimeter * h - open).max(0.0),
|
||||
opening_area: open,
|
||||
});
|
||||
}
|
||||
let level_index = |id: &str| p.drawing_levels.iter().position(|l| l.id == id).unwrap_or(usize::MAX);
|
||||
rows.sort_by(|a, b| {
|
||||
level_index(&a.floor_id).cmp(&level_index(&b.floor_id)).then_with(|| match (a.number.is_empty(), b.number.is_empty()) {
|
||||
(false, false) => natural_cmp(&a.number, &b.number),
|
||||
(true, false) => std::cmp::Ordering::Greater,
|
||||
(false, true) => std::cmp::Ordering::Less,
|
||||
(true, true) => std::cmp::Ordering::Equal,
|
||||
})
|
||||
});
|
||||
let mut quantities: Vec<FinishQty> = Vec::new();
|
||||
for surface in ["floor", "wall", "ceiling"] {
|
||||
for r in &rows {
|
||||
let (finish, area) = match surface {
|
||||
"floor" => (&r.floor_finish, r.area),
|
||||
"wall" => (&r.wall_finish, r.wall_area),
|
||||
_ => (&r.ceiling_finish, r.area),
|
||||
};
|
||||
if finish.is_empty() {
|
||||
continue;
|
||||
}
|
||||
match quantities.iter_mut().find(|q| q.surface == surface && &q.finish == finish) {
|
||||
Some(q) => {
|
||||
q.area += area;
|
||||
q.rooms += 1;
|
||||
}
|
||||
None => quantities.push(FinishQty { surface, finish: finish.clone(), area, rooms: 1 }),
|
||||
}
|
||||
}
|
||||
}
|
||||
RoomBook { rows, quantities }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn v(x: f64, y: f64) -> Vec2 {
|
||||
Vec2 { x, y }
|
||||
}
|
||||
|
||||
/// Wohnen 0.15..2.85 × 0.15..3.85 (2.7 × 3.7), Bad 3.15..5.85 × 0.15..2.15 (2.7 × 2.0), Innenwand x = 3
|
||||
/// mit Tür 0.9 × 2.1 zwischen beiden; Südwand mit Fenster 1.2 × 1.4 am Wohnen. Geschoss 2.8 m.
|
||||
fn sample() -> Project {
|
||||
let wall = |id: &str, a: Vec2, b: Vec2| Wall { id: id.into(), floor_id: "eg".into(), start: a, end: b, wall_type_id: "wt".into(), height: 2.8, ..Default::default() };
|
||||
let room = |id: &str, name: &str, pts: Vec<Vec2>| Room { id: id.into(), floor_id: "eg".into(), name: name.into(), boundary: pts, ..Default::default() };
|
||||
Project {
|
||||
drawing_levels: vec![DrawingLevel { id: "eg".into(), name: "EG".into(), floor_height: Some(2.8), ..Default::default() }],
|
||||
wall_types: vec![WallType { id: "wt".into(), name: "W".into(), layers: vec![Layer { thickness: 0.3, ..Default::default() }], ..Default::default() }],
|
||||
components: vec![Component { id: "parkett".into(), name: "Parkett Eiche".into(), ..Default::default() }, Component { id: "fliese".into(), name: "Feinsteinzeug".into(), ..Default::default() }],
|
||||
walls: vec![wall("s", v(0.0, 0.0), v(6.0, 0.0)), wall("m", v(3.0, 0.0), v(3.0, 4.0))],
|
||||
rooms: Some(vec![
|
||||
Room { floor_finish: Some("parkett".into()), wall_finish: Some("Abrieb 1 mm, weiss".into()), ceiling_finish: Some("Weissputz".into()), usage: Some(RoomUsage::Living), stamp: Some(RoomStamp { number: Some("1.10".into()), name: "Wohnen".into(), ..Default::default() }), ..room("r1", "Wohnen", vec![v(0.15, 0.15), v(2.85, 0.15), v(2.85, 3.85), v(0.15, 3.85)]) },
|
||||
Room { floor_finish: Some("fliese".into()), wall_finish: Some("fliese".into()), ceiling_finish: Some("Weissputz".into()), usage: Some(RoomUsage::Bath), stamp: Some(RoomStamp { number: Some("1.2".into()), name: "Nasszelle".into(), ..Default::default() }), ..room("r2", "Nasszelle", vec![v(3.15, 0.15), v(5.85, 0.15), v(5.85, 2.15), v(3.15, 2.15)]) },
|
||||
]),
|
||||
openings: Some(vec![
|
||||
Opening { id: "t1".into(), host_wall_id: "m".into(), kind: ElementKind::Door, position: 1.0, width: 0.9, height: 2.1, ..Default::default() },
|
||||
Opening { id: "f1".into(), host_wall_id: "s".into(), kind: ElementKind::Window, position: 1.0, width: 1.2, height: 1.4, sill_height: 0.9, ..Default::default() },
|
||||
]),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modell_rundreise_und_alte_daten() {
|
||||
let p = sample();
|
||||
let j = serde_json::to_value(&p.rooms.as_ref().unwrap()[1]).unwrap();
|
||||
assert_eq!(j["usage"], "bath");
|
||||
assert_eq!(j["floorFinish"], "fliese");
|
||||
let back: Room = serde_json::from_value(j).unwrap();
|
||||
assert_eq!(back, p.rooms.as_ref().unwrap()[1]);
|
||||
// Ohne Felder: nichts geschrieben (Alt-Daten unverändert).
|
||||
let plain = serde_json::to_value(Room { id: "x".into(), ..Default::default() }).unwrap();
|
||||
for k in ["usage", "floorFinish", "wallFinish", "ceilingFinish", "floorBuildUp"] {
|
||||
assert!(plain.get(k).is_none(), "{k}");
|
||||
}
|
||||
// Unbekannte Nutzung bricht das Laden nicht.
|
||||
let r: Room = serde_json::from_value(serde_json::json!({"id": "y", "usage": "sauna"})).unwrap();
|
||||
assert_eq!(r.usage, Some(RoomUsage::Unknown));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nassraum_aus_nutzung_sonst_name() {
|
||||
let mut r = Room { name: "Nasszelle".into(), usage: Some(RoomUsage::Storage), ..Default::default() };
|
||||
assert!(!is_wet(&r), "Nutzung geht vor dem Namen");
|
||||
r.usage = Some(RoomUsage::Shower);
|
||||
r.name = "Raum 3".into();
|
||||
assert!(is_wet(&r));
|
||||
r.usage = None;
|
||||
assert!(!is_wet(&r));
|
||||
r.name = "Bad/WC".into();
|
||||
assert!(is_wet(&r), "Rückfall Name");
|
||||
for u in RoomUsage::ALL {
|
||||
assert_eq!(RoomUsage::from_key(u.key()), Some(u));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zeilen_und_reihenfolge() {
|
||||
let b = room_book(&sample());
|
||||
let ids: Vec<&str> = b.rows.iter().map(|r| r.id.as_str()).collect();
|
||||
assert_eq!(ids, vec!["r2", "r1"], "1.2 vor 1.10");
|
||||
let w = b.rows.iter().find(|r| r.id == "r1").unwrap();
|
||||
assert_eq!((w.floor.as_str(), w.number.as_str(), w.usage.as_str(), w.wet), ("EG", "1.10", "living", false));
|
||||
assert_eq!((w.floor_finish.as_str(), w.wall_finish.as_str(), w.ceiling_finish.as_str()), ("Parkett Eiche", "Abrieb 1 mm, weiss", "Weissputz"));
|
||||
let bad = b.rows.iter().find(|r| r.id == "r2").unwrap();
|
||||
assert!(bad.wet);
|
||||
assert_eq!(bad.floor_finish, "Feinsteinzeug");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mengen_boden_wand_decke() {
|
||||
let b = room_book(&sample());
|
||||
let w = b.rows.iter().find(|r| r.id == "r1").unwrap();
|
||||
assert!((w.area - 2.7 * 3.7).abs() < 1e-9);
|
||||
assert!((w.clear_height - 2.8).abs() < 1e-9);
|
||||
// Wohnen: Tür 0.9 × 2.1 und Fenster 1.2 × 1.4.
|
||||
assert!((w.opening_area - (0.9 * 2.1 + 1.2 * 1.4)).abs() < 1e-9, "{}", w.opening_area);
|
||||
assert!((w.wall_area - (2.0 * (2.7 + 3.7) * 2.8 - 0.9 * 2.1 - 1.2 * 1.4)).abs() < 1e-9);
|
||||
let bad = b.rows.iter().find(|r| r.id == "r2").unwrap();
|
||||
assert!((bad.wall_area - (2.0 * (2.7 + 2.0) * 2.8 - 0.9 * 2.1)).abs() < 1e-9, "{}", bad.wall_area);
|
||||
let q = |s: &str, f: &str| b.quantities.iter().find(|q| q.surface == s && q.finish == f).map(|q| (q.area, q.rooms));
|
||||
let (a, n) = q("floor", "Parkett Eiche").unwrap();
|
||||
assert!((a - 2.7 * 3.7).abs() < 1e-9 && n == 1);
|
||||
let (a, n) = q("ceiling", "Weissputz").unwrap();
|
||||
assert!((a - (2.7 * 3.7 + 2.7 * 2.0)).abs() < 1e-9 && n == 2);
|
||||
let (a, _) = q("wall", "Feinsteinzeug").unwrap();
|
||||
assert!((a - bad.wall_area).abs() < 1e-9);
|
||||
assert!(q("floor", "").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lichte_hoehe_aus_decken() {
|
||||
let mut p = sample();
|
||||
// Decke unter dem Raum (OK 0.0 + Belag 0.1 über Boden) und darüber (UK 2.6).
|
||||
let ce = |id: &str, bottom: f64, top: f64| -> Ceiling {
|
||||
serde_json::from_value(serde_json::json!({ "id": id, "type": "ceiling", "floorId": "eg", "categoryCode": "50",
|
||||
"outline": [{"x": 0, "y": 0}, {"x": 6, "y": 0}, {"x": 6, "y": 4}, {"x": 0, "y": 4}],
|
||||
"bottom": {"mode": "custom", "z": bottom}, "top": {"mode": "custom", "z": top} })).unwrap()
|
||||
};
|
||||
p.ceilings = Some(vec![ce("unten", -0.25, 0.1), ce("oben", 2.6, 2.8)]);
|
||||
let r = &p.rooms.as_ref().unwrap()[0];
|
||||
assert_eq!(p.ceiling_vertical_extent(&p.ceilings.as_ref().unwrap()[0]), (-0.25, 0.1));
|
||||
assert!((clear_height(&p, r) - 2.5).abs() < 1e-9, "{}", clear_height(&p, r));
|
||||
assert!(clear_height(&Project::default(), &Room::default()) > 0.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn leeres_projekt_und_unsinn() {
|
||||
assert!(room_book(&Project::default()).rows.is_empty());
|
||||
let mut p = sample();
|
||||
p.rooms.as_mut().unwrap()[0].boundary = vec![v(f64::NAN, 0.0), v(1.0, f64::INFINITY), v(0.0, 1.0)];
|
||||
let b = room_book(&p);
|
||||
assert!(b.rows.iter().all(|r| r.area.is_finite() && r.wall_area.is_finite()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn natuerliche_nummern() {
|
||||
use std::cmp::Ordering::*;
|
||||
assert_eq!(natural_cmp("1.2", "1.10"), Less);
|
||||
assert_eq!(natural_cmp("E01", "E1"), Equal);
|
||||
assert_eq!(natural_cmp("2.01", "10.01"), Less);
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,23 @@ const EARTHWORKS: &[Col] = &[
|
||||
c("backfill", "sheetTable.col.backfill", 1.6, true, true),
|
||||
];
|
||||
|
||||
/// [158] Raumbuch: Oberflächen je Raum.
|
||||
const ROOM_BOOK: &[Col] = &[
|
||||
c("floor", "openings.col.floor", 1.2, false, true),
|
||||
c("number", "roomBook.col.number", 1.0, false, true),
|
||||
c("name", "sheetTable.col.room", 2.4, false, true),
|
||||
c("area", "sheetTable.col.area", 1.2, true, true),
|
||||
c("usage", "roomBook.col.usage", 1.6, false, true),
|
||||
c("floorFinish", "roomBook.col.floorFinish", 2.4, false, true),
|
||||
c("wallFinish", "roomBook.col.wallFinish", 2.4, false, true),
|
||||
c("ceilingFinish", "roomBook.col.ceilingFinish", 2.4, false, true),
|
||||
c("buildUp", "roomBook.col.buildUp", 3.0, false, false),
|
||||
c("clearHeight", "roomBook.col.clearHeight", 1.2, true, false),
|
||||
c("wallArea", "roomBook.col.wallArea", 1.3, true, false),
|
||||
c("perimeter", "roomBook.col.perimeter", 1.2, true, false),
|
||||
c("wet", "roomBook.col.wet", 1.0, false, false),
|
||||
];
|
||||
|
||||
/// Schlüssel der Werttexte (Art, aussen/innen, Aufschlag …).
|
||||
pub const VALUE_KEYS: &[&str] = &[
|
||||
"sheetTable.v.window",
|
||||
@@ -112,6 +129,20 @@ pub const VALUE_KEYS: &[&str] = &[
|
||||
"openings.swing.right",
|
||||
"openings.dir.in",
|
||||
"openings.dir.out",
|
||||
"roomBook.usage.living",
|
||||
"roomBook.usage.sleeping",
|
||||
"roomBook.usage.kitchen",
|
||||
"roomBook.usage.dining",
|
||||
"roomBook.usage.bath",
|
||||
"roomBook.usage.wc",
|
||||
"roomBook.usage.shower",
|
||||
"roomBook.usage.laundry",
|
||||
"roomBook.usage.circulation",
|
||||
"roomBook.usage.technical",
|
||||
"roomBook.usage.storage",
|
||||
"roomBook.usage.office",
|
||||
"roomBook.usage.other",
|
||||
"roomBook.wet",
|
||||
];
|
||||
|
||||
pub fn catalog(source: LayoutTableSource) -> &'static [Col] {
|
||||
@@ -121,6 +152,7 @@ pub fn catalog(source: LayoutTableSource) -> &'static [Col] {
|
||||
LayoutTableSource::Rooms => ROOMS,
|
||||
LayoutTableSource::Elements => ELEMENTS,
|
||||
LayoutTableSource::Earthworks => EARTHWORKS,
|
||||
LayoutTableSource::RoomBook => ROOM_BOOK,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +160,7 @@ pub fn catalog(source: LayoutTableSource) -> &'static [Col] {
|
||||
pub fn catalog_json() -> Value {
|
||||
let one = |s: &[Col]| s.iter().map(|k| json!({"id": k.id, "key": k.key, "numeric": k.numeric, "default": k.default})).collect::<Vec<_>>();
|
||||
json!({
|
||||
"sources": {"openings": one(OPENINGS), "areas": one(AREAS), "rooms": one(ROOMS), "elements": one(ELEMENTS), "earthworks": one(EARTHWORKS)},
|
||||
"sources": {"openings": one(OPENINGS), "areas": one(AREAS), "rooms": one(ROOMS), "elements": one(ELEMENTS), "earthworks": one(EARTHWORKS), "roomBook": one(ROOM_BOOK)},
|
||||
"valueKeys": VALUE_KEYS,
|
||||
})
|
||||
}
|
||||
@@ -261,9 +293,36 @@ fn data_of(p: &Project, t: &LayoutTable, lb: &Labels) -> Data {
|
||||
LayoutTableSource::Rooms => rooms_data(p),
|
||||
LayoutTableSource::Elements => elements_data(p, lb),
|
||||
LayoutTableSource::Earthworks => earthworks_data(p, lb),
|
||||
LayoutTableSource::RoomBook => room_book_data(p, lb),
|
||||
}
|
||||
}
|
||||
|
||||
/// [158] Raumbuch: eine Zeile je Raum (Reihenfolge wie `room_book`).
|
||||
fn room_book_data(p: &Project, lb: &Labels) -> Data {
|
||||
let rows = crate::room_book::room_book(p)
|
||||
.rows
|
||||
.into_iter()
|
||||
.map(|r| {
|
||||
vec![
|
||||
txt(r.floor),
|
||||
txt(r.number),
|
||||
txt(r.name),
|
||||
num(r.area, 2),
|
||||
txt(if r.usage.is_empty() { String::new() } else { lb.get(&format!("roomBook.usage.{}", r.usage)) }),
|
||||
txt(r.floor_finish),
|
||||
txt(r.wall_finish),
|
||||
txt(r.ceiling_finish),
|
||||
txt(r.floor_build_up),
|
||||
num(r.clear_height, 2),
|
||||
num(r.wall_area, 2),
|
||||
num(r.perimeter, 2),
|
||||
txt(if r.wet { lb.get("roomBook.wet") } else { String::new() }),
|
||||
]
|
||||
})
|
||||
.collect();
|
||||
Data { rows, total_last: false }
|
||||
}
|
||||
|
||||
/// [68] Erdarbeiten je Baugrube (m³ gegen das gewachsene Terrain) mit Summenzeile.
|
||||
fn earthworks_data(p: &Project, lb: &Labels) -> Data {
|
||||
let q = crate::excavation::quantities(p);
|
||||
@@ -612,6 +671,35 @@ mod tests {
|
||||
assert!(r[0].total >= 1, "Summenzeile");
|
||||
}
|
||||
|
||||
/// [158] Raumbuch als Blatt-Tabelle: Standard-Spalten, Nutzung beschriftet, Material-Name.
|
||||
#[test]
|
||||
fn raumbuch_tabelle() {
|
||||
let mut t = table("rb", None);
|
||||
t.source = LayoutTableSource::RoomBook;
|
||||
let mut p = project(0, vec![t]);
|
||||
p.components = vec![Component { id: "par".into(), name: "Parkett".into(), ..Default::default() }];
|
||||
p.rooms = Some(vec![Room {
|
||||
id: "r".into(),
|
||||
floor_id: "eg".into(),
|
||||
name: "Wohnen".into(),
|
||||
usage: Some(RoomUsage::Living),
|
||||
floor_finish: Some("par".into()),
|
||||
wall_finish: Some("Abrieb".into()),
|
||||
boundary: vec![Vec2 { x: 0.0, y: 0.0 }, Vec2 { x: 4.0, y: 0.0 }, Vec2 { x: 4.0, y: 5.0 }, Vec2 { x: 0.0, y: 5.0 }],
|
||||
stamp: Some(RoomStamp { number: Some("0.01".into()), name: "Wohnen".into(), ..Default::default() }),
|
||||
..Default::default()
|
||||
}]);
|
||||
let lb = Labels::parse(&json!({"roomBook.usage.living": "WOHN", "roomBook.col.floorFinish": "Boden"}));
|
||||
let r = render(&p, &p.layouts.as_ref().unwrap()[0], &lb);
|
||||
assert_eq!(r[0].total, 1);
|
||||
let tx = texts(&r[0]);
|
||||
for s in ["Boden", "EG", "0.01", "Wohnen", "20.00", "WOHN", "Parkett", "Abrieb"] {
|
||||
assert!(tx.contains(&s.to_string()), "{s}: {tx:?}");
|
||||
}
|
||||
assert_eq!(catalog_json()["sources"]["roomBook"].as_array().unwrap().iter().filter(|c| c["default"] == true).count(), 8);
|
||||
assert_eq!(serde_json::to_value(LayoutTableSource::RoomBook).unwrap(), "roomBook");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ohne_tabellen_und_abfrage() {
|
||||
let p = project(1, vec![]);
|
||||
|
||||
@@ -95,8 +95,27 @@ pub struct Info {
|
||||
pub common: BTreeMap<String, String>,
|
||||
}
|
||||
|
||||
/// Eigenschaften der gemeinsamen Psets, die ins Modell übernommen werden.
|
||||
const COMMON_PROPS: [&str; 7] = ["IsExternal", "LoadBearing", "FireRating", "AcousticRating", "ThermalTransmittance", "SecurityRating", "Reference"];
|
||||
/// Eigenschaften der gemeinsamen Psets, die ins Modell übernommen werden; [158] dazu die Raum-Oberflächen
|
||||
/// (`Pset_SpaceCoveringRequirements`, IFC2x3 `Pset_SpaceCommon`) und Nutzung/Bodenaufbau (`Dossier_RoomBook`).
|
||||
const COMMON_PROPS: [&str; 12] = [
|
||||
"IsExternal",
|
||||
"LoadBearing",
|
||||
"FireRating",
|
||||
"AcousticRating",
|
||||
"ThermalTransmittance",
|
||||
"SecurityRating",
|
||||
"Reference",
|
||||
"FloorCovering",
|
||||
"WallCovering",
|
||||
"CeilingCovering",
|
||||
"Usage",
|
||||
"FloorBuildUp",
|
||||
];
|
||||
|
||||
/// Psets, deren Eigenschaften aus [`COMMON_PROPS`] gelesen werden: `Pset_*Common` und die Raumbuch-Psets.
|
||||
fn reads_common(name: &str) -> bool {
|
||||
(name.starts_with("Pset_") && name.ends_with("Common")) || name == "Pset_SpaceCoveringRequirements" || name == "Dossier_RoomBook"
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Wall {
|
||||
@@ -1514,7 +1533,7 @@ pub(crate) fn analyze(r: &mut Reader, rels: &Rels, ids: &[u64]) -> Semantic {
|
||||
if ps.ty != "IFCPROPERTYSET" {
|
||||
continue;
|
||||
}
|
||||
let is_common = ps.arg(2).and_then(|v| v.as_str()).is_some_and(|n| n.starts_with("Pset_") && n.ends_with("Common"));
|
||||
let is_common = ps.arg(2).and_then(|v| v.as_str()).is_some_and(reads_common);
|
||||
for p in refs(ps.arg(4)) {
|
||||
let Some(pe) = f.get(p) else { continue };
|
||||
if is_common && pe.ty == "IFCPROPERTYSINGLEVALUE" {
|
||||
@@ -2222,6 +2241,20 @@ ENDSEC;\nEND-ISO-10303-21;\n"
|
||||
assert!(!c.contains_key("Fremd"), "nur bekannte Eigenschaften");
|
||||
}
|
||||
|
||||
/// [158] Raumbuch-Psets: Oberflächen (Pset_SpaceCoveringRequirements), Nutzung/Bodenaufbau (Dossier_RoomBook).
|
||||
#[test]
|
||||
fn room_book_psets_are_read() {
|
||||
let psets = "#620=IFCPROPERTYSINGLEVALUE('FloorCovering',$,IFCLABEL('Parkett Eiche'),$);#621=IFCPROPERTYSINGLEVALUE('WallCovering',$,IFCLABEL('Abrieb'),$);\
|
||||
#622=IFCPROPERTYSINGLEVALUE('CeilingCovering',$,IFCLABEL('Weissputz'),$);#623=IFCPROPERTYSET('cp',$,'Pset_SpaceCoveringRequirements',$,(#620,#621,#622));\
|
||||
#624=IFCRELDEFINESBYPROPERTIES('cr',$,$,$,(#500),#623);#630=IFCPROPERTYSINGLEVALUE('Usage',$,IFCLABEL('bath'),$);\
|
||||
#631=IFCPROPERTYSINGLEVALUE('FloorBuildUp',$,IFCLABEL('UB 80'),$);#632=IFCPROPERTYSET('rb',$,'Dossier_RoomBook',$,(#630,#631));\
|
||||
#633=IFCRELDEFINESBYPROPERTIES('rr',$,$,$,(#500),#632);";
|
||||
let (_, s) = sem(&space_file(psets));
|
||||
let c = &s.spaces[0].info.common;
|
||||
let g = |k: &str| c.get(k).map(String::as_str);
|
||||
assert_eq!((g("FloorCovering"), g("WallCovering"), g("CeilingCovering"), g("Usage"), g("FloorBuildUp")), (Some("Parkett Eiche"), Some("Abrieb"), Some("Weissputz"), Some("bath"), Some("UB 80")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn classification_references_of_element_type_and_mesh() {
|
||||
// Stütze (Bauteil) mit eBKP-H, Raum mit Klassifikation über verschachtelte Referenz, BKP am Typ,
|
||||
|
||||
+17
-1
@@ -16,7 +16,7 @@
|
||||
// das Massstab-Kriterium einer Regel (ab/bis 1:n) gilt nach --scale
|
||||
// dossier-cli <projekt.obp> ifc [--ebkph] [--ebenen] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation)
|
||||
// --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0)
|
||||
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei]
|
||||
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements|--rooms] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei]
|
||||
// glb/gltf = glTF 2.0 (Y-up, Meter, Geschoss als Eltern; --flat ohne Geschoss-Knoten)
|
||||
// dossier-cli convert <eingabe> <ausgabe> [--cmd "befehl"]… Format nach Endung: dxf/dwg/ifc/obp → obp-Import,
|
||||
// obp → dxf/dwg/ifc/obj/stl/glb/gltf/step; --cmd: weitere Befehle
|
||||
@@ -75,6 +75,8 @@ import {
|
||||
buildOpeningReport,
|
||||
openingSchedule,
|
||||
elementSchedule,
|
||||
roomBook,
|
||||
buildRoomBookReport,
|
||||
buildElementReport,
|
||||
areaReportToCsv,
|
||||
areaReportToSvg,
|
||||
@@ -840,6 +842,20 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// --rooms: Raumbuch mit Oberflächen und Mengen ([158]) [--format json|csv|svg|pdf] (Default csv)
|
||||
if (args.flags.has("rooms")) {
|
||||
const format = args.flags.get("format") ?? "csv";
|
||||
const stem = `${project.name || "projekt"}-raumbuch`;
|
||||
if (format === "json") out(args, JSON.stringify(roomBook(project), null, 2), `${stem}.json`);
|
||||
else {
|
||||
const report = buildRoomBookReport(project);
|
||||
if (format === "csv") out(args, areaReportToCsv(report), `${stem}.csv`);
|
||||
else if (format === "svg") out(args, areaReportToSvg(report), `${stem}.svg`);
|
||||
else if (format === "pdf") out(args, new Uint8Array(buildAreaReportPdf(report).output("arraybuffer")), `${stem}.pdf`);
|
||||
else throw new Error("--format: json, csv, svg oder pdf");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// --elements: Bauteilliste mit U-Werten aus den Schichten ([71]) [--format json|csv|svg|pdf] (Default csv)
|
||||
if (args.flags.has("elements")) {
|
||||
const format = args.flags.get("format") ?? "csv";
|
||||
|
||||
@@ -148,6 +148,7 @@ export type QueryName =
|
||||
| "roofCutLayers"
|
||||
| "openingSchedule"
|
||||
| "elementSchedule"
|
||||
| "roomBook"
|
||||
| "uValue"
|
||||
| "componentLayerFunctions"
|
||||
| "sheetTables"
|
||||
|
||||
@@ -37,6 +37,8 @@ export { revealColumns, revealArea } from "../export/openingSchedule";
|
||||
export type { RevealArea } from "../export/openingSchedule";
|
||||
export { elementSchedule, uValueOf, uValueText, buildElementReport } from "../export/elementSchedule";
|
||||
export type { ElementScheduleRow, UValueResult, ElementKind } from "../export/elementSchedule";
|
||||
export { roomBook, buildRoomBookReport, usageLabel, ROOM_USAGES } from "../export/roomBook";
|
||||
export type { RoomBook, RoomBookRow, FinishQty } from "../export/roomBook";
|
||||
export { sheetTables, createTable, drawTablesPdf, tableCatalog, tableLabels, tableSourceLabel, TABLE_SOURCES } from "../export/sheetTable";
|
||||
export type { TableOut, TablePrim, TableColumn } from "../export/sheetTable";
|
||||
export { computeAreaTable, computeIvhb } from "../analysis/areaTable";
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// [158] Raumbuch: Zeilen aus dem Kern, Bericht (CSV-Rundreise) und Blatt-Tabelle.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { Layout, Project, Room } from "../model/types";
|
||||
import { areaReportToCsv, parseAreaReportCsv } from "./areaReport";
|
||||
import { buildRoomBookReport, roomBook, usageLabel } from "./roomBook";
|
||||
import { sheetTables, tableLabels } from "./sheetTable";
|
||||
import { t } from "../i18n/translate";
|
||||
|
||||
const base = sampleProject.rooms![0]!;
|
||||
const bad: Room = {
|
||||
...base,
|
||||
id: "R-bad",
|
||||
name: "Bad",
|
||||
usage: "bath",
|
||||
floorFinish: "Feinsteinzeug 30×60",
|
||||
wallFinish: "Plattenbelag",
|
||||
ceilingFinish: "Weissputz",
|
||||
boundary: [
|
||||
{ x: 6, y: 0 },
|
||||
{ x: 8, y: 0 },
|
||||
{ x: 8, y: 2 },
|
||||
{ x: 6, y: 2 },
|
||||
],
|
||||
stamp: { number: "0.02", name: "Bad", showFloorArea: true, showUsage: false },
|
||||
};
|
||||
const p: Project = {
|
||||
...sampleProject,
|
||||
name: "Test",
|
||||
rooms: [
|
||||
{ ...base, usage: "living", floorFinish: sampleProject.components[0]!.id, ceilingFinish: "Weissputz", stamp: { number: "0.01", name: "Wohnen", showFloorArea: true, showUsage: true } },
|
||||
bad,
|
||||
],
|
||||
};
|
||||
|
||||
describe("Raumbuch ([158])", () => {
|
||||
it("eine Zeile je Raum mit Oberflächen, Nassraum aus der Nutzung, Mengen je Material", () => {
|
||||
const b = roomBook(p);
|
||||
expect(b.rows.map((r) => r.number)).toEqual(["0.01", "0.02"]);
|
||||
const w = b.rows[0]!;
|
||||
expect(w).toMatchObject({ usage: "living", wet: false, floorFinish: sampleProject.components[0]!.name, ceilingFinish: "Weissputz" });
|
||||
expect(w.wallArea).toBeGreaterThan(0);
|
||||
expect(w.wallArea).toBeLessThan(w.perimeter * w.clearHeight);
|
||||
expect(b.rows[1]).toMatchObject({ wet: true, floorFinish: "Feinsteinzeug 30×60", area: 4 });
|
||||
const ceil = b.quantities.find((q) => q.surface === "ceiling" && q.finish === "Weissputz")!;
|
||||
expect(ceil.rooms).toBe(2);
|
||||
expect(ceil.area).toBeCloseTo(w.area + 4, 9);
|
||||
});
|
||||
|
||||
it("Bericht: Raumbuch und Mengen, CSV-Rundreise", () => {
|
||||
const rep = buildRoomBookReport(p);
|
||||
expect(rep.sections.map((s) => s.heading)).toEqual([t("roomBook.title"), t("roomBook.quantities")]);
|
||||
const parsed = parseAreaReportCsv(areaReportToCsv(rep));
|
||||
const rows = parsed.sections[0]!.rows;
|
||||
expect(rows.length).toBe(2);
|
||||
expect(rows[1]).toContain("Feinsteinzeug 30×60");
|
||||
expect(rows[1]).toContain(usageLabel("bath"));
|
||||
expect(parsed.sections[1]!.rows.some((r) => r.includes("Weissputz"))).toBe(true);
|
||||
});
|
||||
|
||||
it("ohne Räume: leerer Bericht ohne Abschnitte", () => {
|
||||
expect(buildRoomBookReport({ ...p, rooms: [] }).sections).toEqual([]);
|
||||
});
|
||||
|
||||
it("als Tabelle auf dem Blatt", () => {
|
||||
const layout: Layout = { id: "L1", name: "Blatt", paper: "a3", orientation: "landscape", viewports: [], tables: [{ id: "rb", source: "roomBook", xMm: 10, yMm: 20, widthMm: 260 }] };
|
||||
const q: Project = { ...p, layouts: [layout] };
|
||||
const [tb] = sheetTables(q, "L1");
|
||||
expect(tb!.total).toBe(2);
|
||||
const texts = tb!.prims.filter((x) => x.k === "text").map((x) => (x as { s: string }).s);
|
||||
expect(texts).toContain(tableLabels(q)["roomBook.col.floorFinish"]);
|
||||
expect(texts).toContain("0.02");
|
||||
expect(texts).toContain(usageLabel("bath"));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,103 @@
|
||||
// [158] Raumbuch: Oberflächen je Raum (Boden, Wand, Decke), Nutzung, Bodenaufbau und die Mengen daraus.
|
||||
// Gerechnet wird im Rust-Kern (`src-tauri/core/src/room_book.rs`, Abfrage `roomBook`); hier nur die
|
||||
// Beschriftung mit `t()` und der Berichtsaufbau, damit CSV, SVG und PDF dieselbe Quelle haben wie die
|
||||
// Fenster-/Türliste (`openingSchedule.ts`). Die Blatt-Tabelle (Quelle `roomBook`) rechnet der Kern selbst.
|
||||
|
||||
import type { Project, RoomUsage } from "../model/types";
|
||||
import { t } from "../i18n/translate";
|
||||
import type { TranslationKey } from "../i18n/translate";
|
||||
import { documentFor } from "../core/document";
|
||||
import type { AreaReport, Cell, ReportSection } from "./areaReport";
|
||||
|
||||
/** Eine Zeile des Raumbuchs (Form wie `RoomBookRow` im Kern). */
|
||||
export interface RoomBookRow {
|
||||
id: string;
|
||||
floor: string;
|
||||
floorId: string;
|
||||
number: string;
|
||||
name: string;
|
||||
/** Nettofläche (m²) = Boden- und Deckenfläche. */
|
||||
area: number;
|
||||
perimeter: number;
|
||||
/** Lichte Höhe (m) aus den Decken, sonst Geschosshöhe. */
|
||||
clearHeight: number;
|
||||
/** Nutzungs-Kennung, leer ohne Angabe. */
|
||||
usage: RoomUsage | "";
|
||||
wet: boolean;
|
||||
/** Anzeigetexte (Material-Name oder Freitext). */
|
||||
floorFinish: string;
|
||||
wallFinish: string;
|
||||
ceilingFinish: string;
|
||||
floorBuildUp: string;
|
||||
/** Wandfläche netto: Umfang × lichte Höhe − Öffnungen (m²). */
|
||||
wallArea: number;
|
||||
openingArea: number;
|
||||
}
|
||||
|
||||
/** Menge einer Oberfläche je Material/Freitext. */
|
||||
export interface FinishQty {
|
||||
surface: "floor" | "wall" | "ceiling";
|
||||
finish: string;
|
||||
area: number;
|
||||
rooms: number;
|
||||
}
|
||||
|
||||
export interface RoomBook {
|
||||
rows: RoomBookRow[];
|
||||
quantities: FinishQty[];
|
||||
}
|
||||
|
||||
/** Wählbare Nutzungen (Reihenfolge der Auswahl, wie `RoomUsage::ALL` im Kern). */
|
||||
export const ROOM_USAGES: readonly RoomUsage[] = ["living", "sleeping", "kitchen", "dining", "bath", "wc", "shower", "laundry", "circulation", "technical", "storage", "office", "other"];
|
||||
|
||||
export function usageLabel(u: RoomUsage | ""): string {
|
||||
return u ? t(`roomBook.usage.${u}` as TranslationKey) : "";
|
||||
}
|
||||
|
||||
/** Raumbuch des Projekts (Kern-Abfrage). */
|
||||
export function roomBook(project: Project): RoomBook {
|
||||
return documentFor(project).query<RoomBook>("roomBook");
|
||||
}
|
||||
|
||||
const num = (n: number, d: number): Cell => ({ n: Number.isFinite(n) ? n : null, d });
|
||||
|
||||
function roomSection(rows: RoomBookRow[]): ReportSection {
|
||||
return {
|
||||
heading: t("roomBook.title"),
|
||||
columns: [
|
||||
t("openings.col.floor"),
|
||||
t("roomBook.col.number"),
|
||||
t("sheetTable.col.room"),
|
||||
t("sheetTable.col.area"),
|
||||
t("roomBook.col.usage"),
|
||||
t("roomBook.col.floorFinish"),
|
||||
t("roomBook.col.wallFinish"),
|
||||
t("roomBook.col.ceilingFinish"),
|
||||
t("roomBook.col.buildUp"),
|
||||
t("roomBook.col.clearHeight"),
|
||||
t("roomBook.col.wallArea"),
|
||||
],
|
||||
widths: [1.2, 1, 2.4, 1.2, 1.6, 2.4, 2.4, 2.4, 3, 1.2, 1.3],
|
||||
rows: rows.map((r) => ({
|
||||
cells: [r.floor, r.number, r.name, num(r.area, 2), usageLabel(r.usage), r.floorFinish, r.wallFinish, r.ceilingFinish, r.floorBuildUp, num(r.clearHeight, 2), num(r.wallArea, 2)],
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
function quantitySection(qs: FinishQty[]): ReportSection {
|
||||
return {
|
||||
heading: t("roomBook.quantities"),
|
||||
columns: [t("roomBook.col.surface"), t("roomBook.col.finish"), t("roomBook.col.rooms"), t("sheetTable.col.area")],
|
||||
widths: [1.6, 4, 1.2, 1.4],
|
||||
rows: qs.map((q) => ({ cells: [t(`roomBook.surface.${q.surface}`), q.finish, num(q.rooms, 0), num(q.area, 2)] })),
|
||||
};
|
||||
}
|
||||
|
||||
/** Bericht „Raumbuch": Räume und (falls Oberflächen angegeben) die Mengen je Material. */
|
||||
export function buildRoomBookReport(project: Project): AreaReport {
|
||||
const b = roomBook(project);
|
||||
const sections: ReportSection[] = [];
|
||||
if (b.rows.length) sections.push(roomSection(b.rows));
|
||||
if (b.quantities.length) sections.push(quantitySection(b.quantities));
|
||||
return { title: t("roomBook.title"), projectName: project.name ?? "", sections, notes: [t("roomBook.foot")] };
|
||||
}
|
||||
@@ -55,10 +55,10 @@ describe("Tabellen auf dem Blatt ([111])", () => {
|
||||
|
||||
it("alle Quellen liefern Primitive; Katalog nennt die Spalten", () => {
|
||||
const cat = tableCatalog(sampleProject);
|
||||
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "earthworks", "elements", "openings", "rooms"]);
|
||||
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks"] as const).map((source) => table({ id: source, source })));
|
||||
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "earthworks", "elements", "openings", "roomBook", "rooms"]);
|
||||
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks", "roomBook"] as const).map((source) => table({ id: source, source })));
|
||||
const out = sheetTables(p, "L1");
|
||||
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks"]);
|
||||
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks", "roomBook"]);
|
||||
for (const o of out) expect(o.prims.some((x) => x.k === "text")).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ interface Catalog {
|
||||
valueKeys: string[];
|
||||
}
|
||||
|
||||
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks"];
|
||||
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks", "roomBook"];
|
||||
|
||||
export function tableSourceLabel(s: LayoutTableSource): string {
|
||||
return t(`sheetTable.source.${s}`);
|
||||
|
||||
@@ -883,6 +883,15 @@ export const de = {
|
||||
"objinfo.room.area": "Fläche",
|
||||
"objinfo.room.perimeter": "Umfang",
|
||||
"objinfo.room.refFloor": "Referenzgeschoss",
|
||||
"objinfo.room.usage": "Nutzung",
|
||||
"objinfo.room.usageNone": "—",
|
||||
"objinfo.room.wet": "Nassraum",
|
||||
"objinfo.room.floorFinish": "Boden",
|
||||
"objinfo.room.wallFinish": "Wand",
|
||||
"objinfo.room.ceilingFinish": "Decke",
|
||||
"objinfo.room.buildUp": "Aufbau",
|
||||
"objinfo.room.finishes": "Oberflächen (Raumbuch)",
|
||||
"objinfo.room.finishHint": "Material wählen oder Freitext eingeben",
|
||||
"objinfo.room.editStamp": "Stempel bearbeiten …",
|
||||
// ── Extrusions-Attribute (truck-Integration, Object-Info-Panel) ─────────
|
||||
"objinfo.sectionLine.section": "Schnittlinie",
|
||||
@@ -3017,6 +3026,7 @@ export const de = {
|
||||
"roomStamp.showFloorArea": "Bodenfläche anzeigen",
|
||||
"roomStamp.floorAreaPrefix": "Präfix Bodenfläche",
|
||||
"roomStamp.showUsage": "Nutzung anzeigen",
|
||||
"roomStamp.showFinish": "Bodenbelag anzeigen",
|
||||
"roomStamp.roundingStep": "Flächen-Rundung",
|
||||
"roomStamp.roundingStepDefault": "Standard (2 Nachkommastellen)",
|
||||
"roomStamp.occupancy": "Personenzahl",
|
||||
@@ -3142,6 +3152,44 @@ export const de = {
|
||||
"sheetTable.source.rooms": "Raumprogramm Soll/Ist",
|
||||
"sheetTable.source.elements": "Bauteile mit U-Wert",
|
||||
"sheetTable.source.earthworks": "Erdarbeiten (Baugruben)",
|
||||
"sheetTable.source.roomBook": "Raumbuch (Oberflächen)",
|
||||
"roomBook.title": "Raumbuch",
|
||||
"roomBook.empty": "Keine Räume.",
|
||||
"roomBook.quantities": "Mengen je Oberfläche",
|
||||
"roomBook.foot": "Bodenfläche = Deckenfläche = Raumfläche (netto). Wandfläche = Umfang × lichte Höhe − Öffnungen; lichte Höhe aus den Decken über und unter dem Raum, sonst Geschosshöhe.",
|
||||
"roomBook.exportCsv": "CSV",
|
||||
"roomBook.exportPdf": "PDF",
|
||||
"roomBook.exportPdf.fail": "PDF des Raumbuchs konnte nicht erstellt werden.",
|
||||
"roomBook.col.number": "Nr.",
|
||||
"roomBook.col.usage": "Nutzung",
|
||||
"roomBook.col.floorFinish": "Boden",
|
||||
"roomBook.col.wallFinish": "Wand",
|
||||
"roomBook.col.ceilingFinish": "Decke",
|
||||
"roomBook.col.buildUp": "Bodenaufbau",
|
||||
"roomBook.col.clearHeight": "Lichte Höhe [m]",
|
||||
"roomBook.col.wallArea": "Wandfläche [m²]",
|
||||
"roomBook.col.perimeter": "Umfang [m]",
|
||||
"roomBook.col.wet": "Nassraum",
|
||||
"roomBook.col.surface": "Oberfläche",
|
||||
"roomBook.col.finish": "Belag / Material",
|
||||
"roomBook.col.rooms": "Räume",
|
||||
"roomBook.surface.floor": "Boden",
|
||||
"roomBook.surface.wall": "Wand",
|
||||
"roomBook.surface.ceiling": "Decke",
|
||||
"roomBook.wet": "ja",
|
||||
"roomBook.usage.living": "Wohnen",
|
||||
"roomBook.usage.sleeping": "Schlafen",
|
||||
"roomBook.usage.kitchen": "Küche",
|
||||
"roomBook.usage.dining": "Essen",
|
||||
"roomBook.usage.bath": "Bad",
|
||||
"roomBook.usage.wc": "WC",
|
||||
"roomBook.usage.shower": "Dusche",
|
||||
"roomBook.usage.laundry": "Waschküche",
|
||||
"roomBook.usage.circulation": "Verkehr",
|
||||
"roomBook.usage.technical": "Technik",
|
||||
"roomBook.usage.storage": "Lager / Abstellraum",
|
||||
"roomBook.usage.office": "Büro / Arbeiten",
|
||||
"roomBook.usage.other": "Übrige",
|
||||
"sheetTable.filter": "Zeigen",
|
||||
"sheetTable.filter.all": "Fenster und Türen",
|
||||
"sheetTable.filter.window": "Nur Fenster",
|
||||
|
||||
@@ -879,6 +879,15 @@ export const en: Record<TranslationKey, string> = {
|
||||
"objinfo.room.area": "Area",
|
||||
"objinfo.room.perimeter": "Perimeter",
|
||||
"objinfo.room.refFloor": "Reference floor",
|
||||
"objinfo.room.usage": "Use",
|
||||
"objinfo.room.usageNone": "—",
|
||||
"objinfo.room.wet": "Wet room",
|
||||
"objinfo.room.floorFinish": "Floor",
|
||||
"objinfo.room.wallFinish": "Wall",
|
||||
"objinfo.room.ceilingFinish": "Ceiling",
|
||||
"objinfo.room.buildUp": "Build-up",
|
||||
"objinfo.room.finishes": "Finishes (room book)",
|
||||
"objinfo.room.finishHint": "Choose a material or type free text",
|
||||
"objinfo.room.editStamp": "Edit stamp …",
|
||||
// ── Extruded solid attributes (truck integration, object info panel) ────
|
||||
"objinfo.sectionLine.section": "Section line",
|
||||
@@ -3005,6 +3014,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"roomStamp.showFloorArea": "Show floor area",
|
||||
"roomStamp.floorAreaPrefix": "Floor area prefix",
|
||||
"roomStamp.showUsage": "Show usage",
|
||||
"roomStamp.showFinish": "Show floor finish",
|
||||
"roomStamp.roundingStep": "Area rounding",
|
||||
"roomStamp.roundingStepDefault": "Default (2 decimal places)",
|
||||
"roomStamp.occupancy": "Occupancy",
|
||||
@@ -3129,6 +3139,44 @@ export const en: Record<TranslationKey, string> = {
|
||||
"sheetTable.source.rooms": "Room program target/actual",
|
||||
"sheetTable.source.elements": "Elements with U-value",
|
||||
"sheetTable.source.earthworks": "Earthworks (excavations)",
|
||||
"sheetTable.source.roomBook": "Room book (finishes)",
|
||||
"roomBook.title": "Room book",
|
||||
"roomBook.empty": "No rooms.",
|
||||
"roomBook.quantities": "Quantities per finish",
|
||||
"roomBook.foot": "Floor area = ceiling area = room area (net). Wall area = perimeter × clear height − openings; clear height from the slabs above and below the room, otherwise storey height.",
|
||||
"roomBook.exportCsv": "CSV",
|
||||
"roomBook.exportPdf": "PDF",
|
||||
"roomBook.exportPdf.fail": "Could not create the room book PDF.",
|
||||
"roomBook.col.number": "No.",
|
||||
"roomBook.col.usage": "Use",
|
||||
"roomBook.col.floorFinish": "Floor",
|
||||
"roomBook.col.wallFinish": "Wall",
|
||||
"roomBook.col.ceilingFinish": "Ceiling",
|
||||
"roomBook.col.buildUp": "Floor build-up",
|
||||
"roomBook.col.clearHeight": "Clear height [m]",
|
||||
"roomBook.col.wallArea": "Wall area [m²]",
|
||||
"roomBook.col.perimeter": "Perimeter [m]",
|
||||
"roomBook.col.wet": "Wet room",
|
||||
"roomBook.col.surface": "Surface",
|
||||
"roomBook.col.finish": "Finish / material",
|
||||
"roomBook.col.rooms": "Rooms",
|
||||
"roomBook.surface.floor": "Floor",
|
||||
"roomBook.surface.wall": "Wall",
|
||||
"roomBook.surface.ceiling": "Ceiling",
|
||||
"roomBook.wet": "yes",
|
||||
"roomBook.usage.living": "Living",
|
||||
"roomBook.usage.sleeping": "Sleeping",
|
||||
"roomBook.usage.kitchen": "Kitchen",
|
||||
"roomBook.usage.dining": "Dining",
|
||||
"roomBook.usage.bath": "Bathroom",
|
||||
"roomBook.usage.wc": "WC",
|
||||
"roomBook.usage.shower": "Shower",
|
||||
"roomBook.usage.laundry": "Laundry",
|
||||
"roomBook.usage.circulation": "Circulation",
|
||||
"roomBook.usage.technical": "Technical",
|
||||
"roomBook.usage.storage": "Storage",
|
||||
"roomBook.usage.office": "Office",
|
||||
"roomBook.usage.other": "Other",
|
||||
"sheetTable.filter": "Show",
|
||||
"sheetTable.filter.all": "Windows and doors",
|
||||
"sheetTable.filter.window": "Windows only",
|
||||
|
||||
@@ -118,6 +118,25 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
|
||||
expect(p.walls.filter((x) => x.isExternal === true && x.loadBearing === true).length).toBe(1);
|
||||
});
|
||||
|
||||
it("[158] Raumbuch: Nutzung, Oberflächen und Bodenaufbau am IfcSpace (Rundreise)", async () => {
|
||||
const comp = sampleProject.components[0]!;
|
||||
const room0 = sampleProject.rooms![0]!;
|
||||
const src: Project = {
|
||||
...sampleProject,
|
||||
rooms: [{ ...room0, usage: "bath", floorFinish: comp.id, wallFinish: "Abrieb 1 mm", ceilingFinish: "Weissputz", floorBuildUp: "UB 80, TSD 20" }],
|
||||
};
|
||||
const spf = exportIfcSpf(src);
|
||||
expect(spf).toContain("Pset_SpaceCoveringRequirements");
|
||||
expect(spf).toContain("Dossier_RoomBook");
|
||||
// In ein Projekt mit demselben Material: Verweis über den Namen; sonst Freitext.
|
||||
const { project: p } = await importInto({ ...emptyProject, components: [comp] }, src);
|
||||
expect(p.rooms![0]).toMatchObject({ usage: "bath", floorFinish: comp.id, wallFinish: "Abrieb 1 mm", ceilingFinish: "Weissputz", floorBuildUp: "UB 80, TSD 20" });
|
||||
const { project: q } = await importInto({ ...emptyProject, components: [] }, src);
|
||||
expect(q.rooms![0]!.floorFinish).toBe(comp.name);
|
||||
// Ohne Angaben: keine Raumbuch-Psets.
|
||||
expect(exportIfcSpf(sampleProject)).not.toContain("Dossier_RoomBook");
|
||||
});
|
||||
|
||||
it("Tür-Anschlag/Aufschlag und Fensterteilung aus OperationType/PartitioningType (Rundreise)", async () => {
|
||||
// Lage im Raum vergleichen (die Wand kann umgekehrt ankommen): Scharnierpunkt und Aufschlagrichtung.
|
||||
const physical = (o: Opening, w: Wall) => {
|
||||
|
||||
@@ -1807,7 +1807,7 @@ export type LayoutTable = {
|
||||
};
|
||||
|
||||
/** Quelle einer Blatt-Tabelle ([111]). */
|
||||
export type LayoutTableSource = "openings" | "areas" | "rooms" | "elements" | "earthworks";
|
||||
export type LayoutTableSource = "openings" | "areas" | "rooms" | "elements" | "earthworks" | "roomBook";
|
||||
|
||||
/**
|
||||
* Einfache Textfelder des Titelblocks (Master). Alle optional — leere Felder
|
||||
@@ -2849,6 +2849,19 @@ export type Room = {
|
||||
* Zeilen (Bodenfläche/Nutzung) aus den Flags. Fehlt er, gilt der Alt-Pfad.
|
||||
*/
|
||||
stamp?: RoomStamp;
|
||||
/** [158] Raumbuch: Nutzung (Wohnen, Bad, Verkehr …); Nassraum wird daraus abgeleitet. */
|
||||
usage?: RoomUsage;
|
||||
/**
|
||||
* [158] Bodenbelag: Kennung eines Bauteil-Materials (`components`) oder Freitext. Ein Material mit
|
||||
* Oberflächenmuster gilt im Grundriss im Raum statt des Belags der Decke.
|
||||
*/
|
||||
floorFinish?: string;
|
||||
/** [158] Wandoberfläche (Material-Kennung oder Freitext). */
|
||||
wallFinish?: string;
|
||||
/** [158] Deckenoberfläche (Material-Kennung oder Freitext). */
|
||||
ceilingFinish?: string;
|
||||
/** [158] Bodenaufbau als Freitext (z. B. „Parkett 15, UB 80, TSD 20"). */
|
||||
floorBuildUp?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2913,8 +2926,26 @@ export type RoomStamp = {
|
||||
* Schrittrundung.
|
||||
*/
|
||||
roundingStep?: number;
|
||||
/** [158] Bodenbelag des Raums als Zeile anzeigen (Live-Zeile). Fehlt/false: keine Belagszeile. */
|
||||
showFinish?: boolean;
|
||||
};
|
||||
|
||||
/** [158] Nutzung eines Raums (Raumbuch). Nassräume: Bad, WC, Dusche, Waschküche. */
|
||||
export type RoomUsage =
|
||||
| "living"
|
||||
| "sleeping"
|
||||
| "kitchen"
|
||||
| "dining"
|
||||
| "bath"
|
||||
| "wc"
|
||||
| "shower"
|
||||
| "laundry"
|
||||
| "circulation"
|
||||
| "technical"
|
||||
| "storage"
|
||||
| "office"
|
||||
| "other";
|
||||
|
||||
/**
|
||||
* Ein Eintrag der Flügeleinteilung eines Fensters (VW „Flügeltabelle"): entweder
|
||||
* ein Flügel (verglaste, ggf. öffenbare Einheit) oder ein Pfosten (feste vertikale
|
||||
|
||||
@@ -33,7 +33,9 @@ import type {
|
||||
Dormer,
|
||||
DormerKind,
|
||||
DrawingLevel,
|
||||
Project,
|
||||
RoofShape,
|
||||
Room,
|
||||
SiaCategory,
|
||||
SliceTermination,
|
||||
StairShape,
|
||||
@@ -46,6 +48,7 @@ import type {
|
||||
WallReferenceLine,
|
||||
} from "../model/types";
|
||||
import { SIA_CATEGORIES, siaLabelFull, surfaceOpeningInfo } from "../core";
|
||||
import { ROOM_USAGES, roomBook, usageLabel } from "../core";
|
||||
import type { EdgeSpec, RoofEdge } from "../core";
|
||||
import { Dropdown } from "../ui/Dropdown";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
@@ -465,6 +468,9 @@ export function RoomSection({
|
||||
<span className="objinfo-fval">{room.floorName}</span>
|
||||
</div>
|
||||
|
||||
{/* [158] Raumbuch: Nutzung und Oberflächen. */}
|
||||
<RoomFinishFields roomId={roomId} host={host} />
|
||||
|
||||
{/* Stempel bearbeiten (öffnet den Rich-Text-Editor). */}
|
||||
<button
|
||||
type="button"
|
||||
@@ -477,6 +483,74 @@ export function RoomSection({
|
||||
);
|
||||
}
|
||||
|
||||
type RoomFinishField = "floorFinish" | "wallFinish" | "ceilingFinish" | "floorBuildUp";
|
||||
|
||||
/** [158] Nutzung (Nassraum abgeleitet) und Oberflächen Boden/Wand/Decke (Material aus dem Projekt oder
|
||||
* Freitext; ein eingegebener Material-Name wird als Verweis gespeichert) und Bodenaufbau. */
|
||||
function RoomFinishFields({ roomId, host }: { roomId: string; host: ReturnType<typeof usePanelHost> }) {
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const project = host.project;
|
||||
const room = (project.rooms ?? []).find((r) => r.id === roomId);
|
||||
if (!room) return null;
|
||||
const comps = project.components;
|
||||
const listId = `room-finish-materials-${roomId}`;
|
||||
const shown = (v: string | undefined) => comps.find((c) => c.id === v)?.name ?? v ?? "";
|
||||
const set = (field: RoomFinishField | "usage", value: string | undefined) =>
|
||||
applyChange((p: Project) => patchItem(p, "rooms", roomId, { [field]: value } as Partial<Room>), `room:${roomId}:${field}`);
|
||||
const setFinish = (field: RoomFinishField, text: string) => {
|
||||
const v = text.trim();
|
||||
if (!v) return set(field, undefined);
|
||||
const comp = field === "floorBuildUp" ? undefined : comps.find((c) => c.name.trim() === v);
|
||||
set(field, comp ? comp.id : text);
|
||||
};
|
||||
// Nassraum wie im Kern (Nutzung, sonst Name), für [156] „Nassräume" im Grundriss.
|
||||
const wet = roomBook(project).rows.find((r) => r.id === roomId)?.wet ?? false;
|
||||
const finishInput = (field: RoomFinishField, label: TranslationKey) => (
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t(label)}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="objinfo-text"
|
||||
list={field === "floorBuildUp" ? undefined : listId}
|
||||
value={shown(room[field])}
|
||||
placeholder={field === "floorBuildUp" ? undefined : t("objinfo.room.finishHint")}
|
||||
onChange={(e) => setFinish(field, e.target.value)}
|
||||
title={t(label)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.room.usage")}</span>
|
||||
<Dropdown
|
||||
value={room.usage ?? ""}
|
||||
onChange={(v) => set("usage", v || undefined)}
|
||||
options={[{ value: "", label: t("objinfo.room.usageNone") }, ...ROOM_USAGES.map((u) => ({ value: u, label: usageLabel(u) }))]}
|
||||
title={t("objinfo.room.usage")}
|
||||
width={170}
|
||||
/>
|
||||
</div>
|
||||
{wet && (
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.room.wet")}</span>
|
||||
<span className="objinfo-fval">✓</span>
|
||||
</div>
|
||||
)}
|
||||
<div className="objinfo-section-label">{t("objinfo.room.finishes")}</div>
|
||||
<datalist id={listId}>
|
||||
{comps.map((c) => (
|
||||
<option key={c.id} value={c.name} />
|
||||
))}
|
||||
</datalist>
|
||||
{finishInput("floorFinish", "objinfo.room.floorFinish")}
|
||||
{finishInput("wallFinish", "objinfo.room.wallFinish")}
|
||||
{finishInput("ceilingFinish", "objinfo.room.ceilingFinish")}
|
||||
{finishInput("floorBuildUp", "objinfo.room.buildUp")}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// ── Schnitt-/Ansichtslinien-Abschnitt (Object-Info; nur die gewählte Linie) ──
|
||||
// Name (editierbar), Blickrichtung umkehren (directionSign-Flip), Endpunkt-
|
||||
// Koordinaten (editierbar) + Schnitt-Tiefe; Löschen setzt linePoints zurück
|
||||
|
||||
@@ -16,6 +16,7 @@ import { KennzahlenSection } from "./KennzahlenSection";
|
||||
import { AreaTableSection } from "./AreaTableSection";
|
||||
import { OpeningScheduleSection } from "./OpeningScheduleSection";
|
||||
import { ElementScheduleSection } from "./ElementScheduleSection";
|
||||
import { RoomBookSection } from "./RoomBookSection";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
|
||||
/** Löst je Raum die anrechenbare (Netto-)Fläche + Kategorie auf. */
|
||||
@@ -87,6 +88,9 @@ export function RoomBalancePanel() {
|
||||
{/* Bauteilliste mit U-Werten ([71]). */}
|
||||
<ElementScheduleSection />
|
||||
|
||||
{/* Raumbuch: Oberflächen je Raum ([158]). */}
|
||||
<RoomBookSection />
|
||||
|
||||
{/* Raumliste (je Raum: Name · Geschoss · SIA · Fläche). */}
|
||||
<div className="balance-section-label">{t("balance.rooms")}</div>
|
||||
<div className="balance-table">
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
// [158] Raumbuch im Flächenbilanz-Panel: eine Zeile je Raum mit Geschoss, Nummer, Name, Fläche, Nutzung und
|
||||
// den Oberflächen (Boden, Wand, Decke), dazu die Mengen je Material. Die Zeilen rechnet der Kern
|
||||
// (`roomBook`); bearbeitet werden die Angaben in der Objekt-Info des Raums. CSV und PDF kommen aus
|
||||
// demselben Berichtsmodell wie die Fenster-/Türliste.
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { usePanelHost } from "./host";
|
||||
import { areaReportToCsv, buildAreaReportPdf, buildRoomBookReport, roomBook, usageLabel } from "../core";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
import { useStore } from "../state/appStore";
|
||||
|
||||
const m2 = (v: number) => v.toFixed(2);
|
||||
|
||||
export function RoomBookSection() {
|
||||
const project = usePanelHost().project;
|
||||
const notify = useStore((s) => s.notify);
|
||||
const book = useMemo(() => roomBook(project), [project]);
|
||||
const stem = `${project.name || "projekt"}-raumbuch`;
|
||||
|
||||
const exportPdf = () => {
|
||||
try {
|
||||
buildAreaReportPdf(buildRoomBookReport(project)).save(`${stem}.pdf`);
|
||||
} catch {
|
||||
notify(t("roomBook.exportPdf.fail"));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="area-section opening-section">
|
||||
<div className="balance-head">
|
||||
<span className="balance-section-label">{t("roomBook.title")}</span>
|
||||
{book.rows.length > 0 && (
|
||||
<span className="area-actions">
|
||||
<button type="button" className="balance-export" onClick={() => downloadCsv(`${stem}.csv`, areaReportToCsv(buildRoomBookReport(project)))}>
|
||||
{t("roomBook.exportCsv")}
|
||||
</button>
|
||||
<button type="button" className="balance-export" onClick={exportPdf}>
|
||||
{t("roomBook.exportPdf")}
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{book.rows.length === 0 ? (
|
||||
<div className="balance-empty">{t("roomBook.empty")}</div>
|
||||
) : (
|
||||
<div className="area-scroll">
|
||||
<table className="area-table opening-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("openings.col.floor")}</th>
|
||||
<th>{t("roomBook.col.number")}</th>
|
||||
<th>{t("sheetTable.col.room")}</th>
|
||||
<th className="num">{t("sheetTable.col.area")}</th>
|
||||
<th>{t("roomBook.col.usage")}</th>
|
||||
<th>{t("roomBook.col.floorFinish")}</th>
|
||||
<th>{t("roomBook.col.wallFinish")}</th>
|
||||
<th>{t("roomBook.col.ceilingFinish")}</th>
|
||||
<th className="num">{t("roomBook.col.clearHeight")}</th>
|
||||
<th className="num">{t("roomBook.col.wallArea")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{book.rows.map((r) => (
|
||||
<tr key={r.id}>
|
||||
<td>{r.floor}</td>
|
||||
<td>{r.number}</td>
|
||||
<td>{r.name}</td>
|
||||
<td className="num">{m2(r.area)}</td>
|
||||
<td>{usageLabel(r.usage)}</td>
|
||||
<td>{r.floorFinish}</td>
|
||||
<td>{r.wallFinish}</td>
|
||||
<td>{r.ceilingFinish}</td>
|
||||
<td className="num">{m2(r.clearHeight)}</td>
|
||||
<td className="num">{m2(r.wallArea)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{book.quantities.length > 0 && (
|
||||
<table className="area-table opening-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("roomBook.col.surface")}</th>
|
||||
<th>{t("roomBook.col.finish")}</th>
|
||||
<th className="num">{t("roomBook.col.rooms")}</th>
|
||||
<th className="num">{t("sheetTable.col.area")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{book.quantities.map((q) => (
|
||||
<tr key={`${q.surface}:${q.finish}`}>
|
||||
<td>{t(`roomBook.surface.${q.surface}`)}</td>
|
||||
<td>{q.finish}</td>
|
||||
<td className="num">{q.rooms}</td>
|
||||
<td className="num">{m2(q.area)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<ul className="area-notes">
|
||||
<li>{t("roomBook.foot")}</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -220,6 +220,13 @@ export function RoomStampEditor({ value, onApply, onCancel }: RoomStampEditorPro
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="roomstamp-row">
|
||||
<label className="roomstamp-check">
|
||||
<input type="checkbox" checked={draft.showFinish === true} onChange={(e) => patch({ showFinish: e.target.checked ? true : undefined })} />
|
||||
<span>{t("roomStamp.showFinish")}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label className="roomstamp-field">
|
||||
<span className="roomstamp-label">{t("roomStamp.occupancy")}</span>
|
||||
<input
|
||||
|
||||
Reference in new issue
Block a user