[K4] S2: typisiertes Rust-Modell (generiert aus TS-Typen), Document::project(), Kennzahlen rechnen auf dem Dokument; TS-Sammler entfernt
This commit is contained in:
1 parent
8a120329ee
commit
8d4952e5d0
16 files changed
+3700
-119
No files matched your search
Generated
+1
@@ -31,6 +31,7 @@ dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"i_overlay",
|
||||
"kernel2d",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
@@ -19,6 +19,7 @@ web = ["dep:wasm-bindgen", "dep:console_error_panic_hook"]
|
||||
|
||||
[dependencies]
|
||||
i_overlay = { version = "9.1", default-features = false }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = { version = "1", features = ["preserve_order", "float_roundtrip"] }
|
||||
kernel2d = { path = "../kernel2d" }
|
||||
wasm-bindgen = { version = "0.2", optional = true }
|
||||
|
||||
@@ -7,8 +7,11 @@
|
||||
//! JSON kennt weder `undefined` noch NaN: fehlende Felder fehlen, nicht endliche Zahlen prüft TS
|
||||
//! vor dem Senden (`validateOps`).
|
||||
|
||||
use crate::model::Project;
|
||||
use serde::Deserialize;
|
||||
use serde_json::{Map, Value};
|
||||
use std::collections::HashSet;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// Eine Änderung am Projekt (Spiegel von `CoreOp` in `core/ops.ts`).
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -90,12 +93,14 @@ fn has_dup(v: Option<&Value>) -> bool {
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Document {
|
||||
root: Map<String, Value>,
|
||||
/// Typisierte Sicht (Cache); jede Änderung verwirft sie.
|
||||
typed: Option<Rc<Project>>,
|
||||
}
|
||||
|
||||
impl Document {
|
||||
pub fn from_json(text: &str) -> Result<Document, String> {
|
||||
match serde_json::from_str::<Value>(text) {
|
||||
Ok(Value::Object(root)) => Ok(Document { root }),
|
||||
Ok(Value::Object(root)) => Ok(Document { root, typed: None }),
|
||||
Ok(_) => Err("Projekt ist kein JSON-Objekt".into()),
|
||||
Err(e) => Err(e.to_string()),
|
||||
}
|
||||
@@ -105,6 +110,23 @@ impl Document {
|
||||
serde_json::to_string(&self.root).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Typisierte Sicht des Projekts (gecacht bis zur nächsten Änderung). Fehler = Feld, das dem
|
||||
/// Modell widerspricht (Meldung von serde).
|
||||
pub fn project(&mut self) -> Result<Rc<Project>, String> {
|
||||
if let Some(p) = &self.typed {
|
||||
return Ok(p.clone());
|
||||
}
|
||||
// Die Map wird nur ausgeliehen: `Value::Object` braucht Besitz, daher temporär herausnehmen.
|
||||
let value = Value::Object(std::mem::take(&mut self.root));
|
||||
let parsed = Project::deserialize(&value).map_err(|e| e.to_string());
|
||||
if let Value::Object(m) = value {
|
||||
self.root = m;
|
||||
}
|
||||
let p = Rc::new(parsed?);
|
||||
self.typed = Some(p.clone());
|
||||
Ok(p)
|
||||
}
|
||||
|
||||
pub fn field(&self, key: &str) -> Option<&Value> {
|
||||
self.root.get(key)
|
||||
}
|
||||
@@ -167,6 +189,7 @@ impl Document {
|
||||
|
||||
/// Wendet `ops` atomar an. Verstösse (neue doppelte ids) → `Err(Meldungen)`, Dokument unverändert.
|
||||
pub fn apply(&mut self, ops: &[Op]) -> Result<(), Vec<String>> {
|
||||
self.typed = None;
|
||||
// Zustand der berührten Felder sichern (Rücknahme) und Alt-Doppelungen merken.
|
||||
let mut saved: Vec<(String, Option<Value>)> = Vec::new();
|
||||
let mut had_dup: HashSet<String> = HashSet::new();
|
||||
@@ -259,6 +282,17 @@ mod tests {
|
||||
d.apply(&ops(json!([{"kind":"add","collection":"walls","items":[{"id":"z"}]}]))).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn typisierte_sicht_folgt_den_ops() {
|
||||
let text = include_str!("../tests/fixtures/sample_project.json");
|
||||
let mut d = Document::from_json(text).unwrap();
|
||||
let n = d.project().unwrap().walls.len();
|
||||
assert!(n > 0);
|
||||
let id = d.project().unwrap().walls[0].id.clone();
|
||||
d.apply(&ops(json!([{"kind":"remove","collection":"walls","ids":[id]}]))).unwrap();
|
||||
assert_eq!(d.project().unwrap().walls.len(), n - 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn kaputte_ops_sind_fehler() {
|
||||
assert!(Op::from_json(&json!({"kind":"add","collection":"w","items":[{"x":1}]})).is_err());
|
||||
|
||||
@@ -133,3 +133,122 @@ mod tests {
|
||||
assert_eq!(area_sums(0, &[], &[], f64::NAN, &[]), AreaSums { by_level: vec![], gv: 0.0, parcel: None });
|
||||
}
|
||||
}
|
||||
|
||||
// ── Kennzahlen aus dem Projekt-Dokument ([K4] S2) ───────────────────────────
|
||||
|
||||
use crate::model::{DrawingLevelKind, Project, SiaCategory};
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct LevelKennzahlen {
|
||||
pub level_id: String,
|
||||
pub name: String,
|
||||
/// Geschossfläche (SIA 416 GF) aus den Räumen.
|
||||
pub gf: f64,
|
||||
/// Anrechenbare Fläche ≈ Nettogeschossfläche NGF.
|
||||
pub agf: f64,
|
||||
pub rooms: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
pub struct Kennzahlen {
|
||||
pub levels: Vec<LevelKennzahlen>,
|
||||
pub gf: f64,
|
||||
pub agf: f64,
|
||||
pub gv: f64,
|
||||
pub footprint: f64,
|
||||
pub az: Option<f64>,
|
||||
pub uez: Option<f64>,
|
||||
}
|
||||
|
||||
fn category_index(c: SiaCategory) -> usize {
|
||||
match c {
|
||||
SiaCategory::HNF => 0,
|
||||
SiaCategory::NNF => 1,
|
||||
SiaCategory::VF => 2,
|
||||
SiaCategory::FF => 3,
|
||||
SiaCategory::KGF => 4,
|
||||
SiaCategory::AGF => 5,
|
||||
}
|
||||
}
|
||||
|
||||
/// Flächen je Geschoss (SIA 416), Gebäudevolumen, Ausnützungs- und Überbauungsziffer.
|
||||
pub fn compute(p: &Project) -> Kennzahlen {
|
||||
let mut floors: Vec<&crate::model::DrawingLevel> = p.drawing_levels.iter().filter(|l| l.kind == DrawingLevelKind::Floor).collect();
|
||||
floors.sort_by(|a, b| a.base_elevation.unwrap_or(0.0).partial_cmp(&b.base_elevation.unwrap_or(0.0)).unwrap_or(std::cmp::Ordering::Equal));
|
||||
let mut level_index: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
|
||||
for (i, l) in floors.iter().enumerate() {
|
||||
level_index.entry(l.id.as_str()).or_insert(i);
|
||||
}
|
||||
let all_rooms = p.rooms.as_deref().unwrap_or(&[]);
|
||||
let rooms: Vec<&crate::model::Room> = all_rooms.iter().filter(|r| level_index.contains_key(r.floor_id.as_str())).collect();
|
||||
let rooms_in: Vec<RoomIn> = rooms
|
||||
.iter()
|
||||
.map(|r| RoomIn {
|
||||
level: level_index[r.floor_id.as_str()],
|
||||
category: category_index(r.sia_category),
|
||||
boundary: r.boundary.iter().map(|v| [v.x, v.y]).collect(),
|
||||
})
|
||||
.collect();
|
||||
let solids: Vec<SolidIn> = p
|
||||
.extruded_solids
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.map(|s| SolidIn {
|
||||
subtract: s.operation.as_deref() == Some("subtract"),
|
||||
points: if s.circle.is_some() { vec![] } else { s.points.iter().map(|v| [v.x, v.y]).collect() },
|
||||
circle_r: s.circle.as_ref().map_or(f64::NAN, |c| c.r),
|
||||
height: s.height,
|
||||
taper: s.taper.unwrap_or(0.0),
|
||||
})
|
||||
.collect();
|
||||
let parcel_ring: Vec<[f64; 2]> = p.site_rules.as_ref().map(|r| r.parcel.iter().map(|v| [v.x, v.y]).collect()).unwrap_or_default();
|
||||
let sums = area_sums(floors.len(), &rooms_in, &solids, p.parcel_area.unwrap_or(f64::NAN), &parcel_ring);
|
||||
let levels: Vec<LevelKennzahlen> = floors
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, l)| {
|
||||
let entries: Vec<(usize, f64)> = (0..CATEGORIES).map(|k| (k, sums.by_level[i][k])).collect();
|
||||
let b = crate::room_area::balance(&entries);
|
||||
LevelKennzahlen {
|
||||
level_id: l.id.clone(),
|
||||
name: l.name.clone(),
|
||||
gf: b.agg_area[2],
|
||||
agf: b.agg_area[1],
|
||||
rooms: rooms.iter().filter(|r| r.floor_id == l.id).count(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let gf: f64 = levels.iter().map(|l| l.gf).sum();
|
||||
let agf: f64 = levels.iter().map(|l| l.agf).sum();
|
||||
let footprint = levels.iter().find(|l| l.gf > 0.0).map_or(0.0, |l| l.gf);
|
||||
Kennzahlen {
|
||||
levels,
|
||||
gf,
|
||||
agf,
|
||||
gv: sums.gv,
|
||||
footprint,
|
||||
az: sums.parcel.filter(|x| *x != 0.0).map(|x| agf / x),
|
||||
uez: sums.parcel.filter(|x| *x != 0.0).map(|x| footprint / x),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod doc_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn kennzahlen_des_beispielprojekts() {
|
||||
let p: Project = serde_json::from_str(include_str!("../tests/fixtures/sample_project.json")).unwrap();
|
||||
let k = compute(&p);
|
||||
assert!(!k.levels.is_empty());
|
||||
let sum: f64 = k.levels.iter().map(|l| l.gf).sum();
|
||||
assert!((k.gf - sum).abs() < 1e-9);
|
||||
assert!(k.az.is_none() && k.uez.is_none());
|
||||
let with_parcel = Project { parcel_area: Some(1000.0), ..p };
|
||||
let k2 = compute(&with_parcel);
|
||||
assert!((k2.az.unwrap() - k2.agf / 1000.0).abs() < 1e-12);
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ pub mod plan_openings;
|
||||
pub mod delaunay;
|
||||
pub mod document;
|
||||
pub mod mesh_section;
|
||||
pub mod model;
|
||||
pub mod plan_elevation;
|
||||
pub mod plan_misc;
|
||||
pub mod plan_section;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,273 @@
|
||||
//! Von Hand geschriebene Teile des Modells: Typen mit Tag (diskriminierte Unions) und `Vec2`.
|
||||
//! Gegenstück zu den entsprechenden Typen in `src/model/types.ts`.
|
||||
|
||||
use super::generated::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(test, serde(deny_unknown_fields))]
|
||||
pub struct Vec2 {
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "mode")]
|
||||
pub enum VerticalAnchor {
|
||||
#[serde(rename = "floor")]
|
||||
Floor {
|
||||
#[serde(rename = "floorId")]
|
||||
floor_id: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
offset: Option<f64>,
|
||||
},
|
||||
#[serde(rename = "custom")]
|
||||
Custom { z: f64 },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "kind")]
|
||||
pub enum ColumnProfile {
|
||||
#[serde(rename = "rect")]
|
||||
Rect { width: f64, depth: f64 },
|
||||
#[serde(rename = "round")]
|
||||
Round { radius: f64 },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Offset2 {
|
||||
pub along: f64,
|
||||
pub perp: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum KoteKind {
|
||||
#[serde(rename = "okFertig")]
|
||||
OkFertig,
|
||||
#[serde(rename = "ukFertig")]
|
||||
UkFertig,
|
||||
#[serde(rename = "okRoh")]
|
||||
OkRoh,
|
||||
#[serde(rename = "ukRoh")]
|
||||
UkRoh,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum SplineMode {
|
||||
Fit,
|
||||
Control,
|
||||
}
|
||||
|
||||
/// Geometrie eines 2D-Zeichenelements (Tag `shape`).
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "shape")]
|
||||
pub enum Drawing2DGeom {
|
||||
#[serde(rename = "line")]
|
||||
Line { a: Vec2, b: Vec2 },
|
||||
#[serde(rename = "xline")]
|
||||
Xline { a: Vec2, b: Vec2 },
|
||||
#[serde(rename = "ray")]
|
||||
Ray { a: Vec2, b: Vec2 },
|
||||
#[serde(rename = "polyline")]
|
||||
Polyline {
|
||||
pts: Vec<Vec2>,
|
||||
closed: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
bulge: Option<Vec<f64>>,
|
||||
},
|
||||
#[serde(rename = "rect")]
|
||||
Rect { min: Vec2, max: Vec2 },
|
||||
#[serde(rename = "circle")]
|
||||
Circle { center: Vec2, r: f64 },
|
||||
#[serde(rename = "arc")]
|
||||
Arc { center: Vec2, r: f64, a0: f64, a1: f64 },
|
||||
#[serde(rename = "ellipse")]
|
||||
Ellipse { center: Vec2, rx: f64, ry: f64, rotation: f64 },
|
||||
#[serde(rename = "bezier")]
|
||||
Bezier { pts: Vec<Vec2> },
|
||||
#[serde(rename = "spline")]
|
||||
Spline {
|
||||
pts: Vec<Vec2>,
|
||||
closed: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
mode: Option<SplineMode>,
|
||||
},
|
||||
#[serde(rename = "dimension")]
|
||||
Dimension {
|
||||
pts: Vec<Vec2>,
|
||||
offset: f64,
|
||||
#[serde(rename = "gapMm", default, skip_serializing_if = "Option::is_none")]
|
||||
gap_mm: Option<f64>,
|
||||
#[serde(rename = "overshootMm", default, skip_serializing_if = "Option::is_none")]
|
||||
overshoot_mm: Option<f64>,
|
||||
#[serde(rename = "tickLenMm", default, skip_serializing_if = "Option::is_none")]
|
||||
tick_len_mm: Option<f64>,
|
||||
#[serde(rename = "textHeightMm", default, skip_serializing_if = "Option::is_none")]
|
||||
text_height_mm: Option<f64>,
|
||||
#[serde(rename = "lineWeightMm", default, skip_serializing_if = "Option::is_none")]
|
||||
line_weight_mm: Option<f64>,
|
||||
#[serde(rename = "extWeightMm", default, skip_serializing_if = "Option::is_none")]
|
||||
ext_weight_mm: Option<f64>,
|
||||
#[serde(rename = "tickWeightMm", default, skip_serializing_if = "Option::is_none")]
|
||||
tick_weight_mm: Option<f64>,
|
||||
#[serde(rename = "textOffsetsMm", default, skip_serializing_if = "Option::is_none")]
|
||||
text_offsets_mm: Option<Vec<Offset2>>,
|
||||
},
|
||||
#[serde(rename = "kote")]
|
||||
Kote { at: Vec2, value: f64, kind: KoteKind, rotation: f64 },
|
||||
#[serde(rename = "detailref")]
|
||||
Detailref {
|
||||
at: Vec2,
|
||||
label: String,
|
||||
#[serde(rename = "sheetLayoutId", default, skip_serializing_if = "Option::is_none")]
|
||||
sheet_layout_id: Option<String>,
|
||||
#[serde(rename = "sheetLabel", default, skip_serializing_if = "Option::is_none")]
|
||||
sheet_label: Option<String>,
|
||||
},
|
||||
#[serde(rename = "scalebar")]
|
||||
Scalebar {
|
||||
at: Vec2,
|
||||
#[serde(rename = "segmentLength")]
|
||||
segment_length: f64,
|
||||
segments: f64,
|
||||
},
|
||||
#[serde(rename = "pointmarker")]
|
||||
Pointmarker { at: Vec2 },
|
||||
#[serde(rename = "text")]
|
||||
Text {
|
||||
at: Vec2,
|
||||
text: String,
|
||||
height: f64,
|
||||
angle: f64,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
width: Option<f64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
marks: Option<Marks>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
doc: Option<RichTextDoc>,
|
||||
#[serde(rename = "leaderTarget", default, skip_serializing_if = "Option::is_none")]
|
||||
leader_target: Option<Vec2>,
|
||||
#[serde(rename = "leaderBendPoints", default, skip_serializing_if = "Option::is_none")]
|
||||
leader_bend_points: Option<Vec<Vec2>>,
|
||||
#[serde(rename = "pathPts", default, skip_serializing_if = "Option::is_none")]
|
||||
path_pts: Option<Vec<Vec2>>,
|
||||
},
|
||||
#[serde(rename = "block")]
|
||||
Block {
|
||||
#[serde(rename = "blockDefId")]
|
||||
block_def_id: String,
|
||||
at: Vec2,
|
||||
rotation: f64,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
scale: Option<f64>,
|
||||
},
|
||||
#[serde(rename = "image")]
|
||||
Image {
|
||||
min: Vec2,
|
||||
max: Vec2,
|
||||
src: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
opacity: Option<f64>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Layout-Beschriftung (Tag `kind`).
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "kind")]
|
||||
pub enum LayoutAnnotation {
|
||||
#[serde(rename = "line")]
|
||||
Line {
|
||||
id: String,
|
||||
#[serde(rename = "x1Mm")]
|
||||
x1_mm: f64,
|
||||
#[serde(rename = "y1Mm")]
|
||||
y1_mm: f64,
|
||||
#[serde(rename = "x2Mm")]
|
||||
x2_mm: f64,
|
||||
#[serde(rename = "y2Mm")]
|
||||
y2_mm: f64,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
color: Option<String>,
|
||||
#[serde(rename = "weightMm", default, skip_serializing_if = "Option::is_none")]
|
||||
weight_mm: Option<f64>,
|
||||
},
|
||||
#[serde(rename = "rect")]
|
||||
Rect {
|
||||
id: String,
|
||||
#[serde(rename = "xMm")]
|
||||
x_mm: f64,
|
||||
#[serde(rename = "yMm")]
|
||||
y_mm: f64,
|
||||
#[serde(rename = "widthMm")]
|
||||
width_mm: f64,
|
||||
#[serde(rename = "heightMm")]
|
||||
height_mm: f64,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
color: Option<String>,
|
||||
#[serde(rename = "weightMm", default, skip_serializing_if = "Option::is_none")]
|
||||
weight_mm: Option<f64>,
|
||||
},
|
||||
#[serde(rename = "text")]
|
||||
Text {
|
||||
id: String,
|
||||
#[serde(rename = "xMm")]
|
||||
x_mm: f64,
|
||||
#[serde(rename = "yMm")]
|
||||
y_mm: f64,
|
||||
text: String,
|
||||
#[serde(rename = "heightMm")]
|
||||
height_mm: f64,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
color: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
doc: Option<RichTextDoc>,
|
||||
#[serde(rename = "widthMm", default, skip_serializing_if = "Option::is_none")]
|
||||
width_mm: Option<f64>,
|
||||
},
|
||||
#[serde(rename = "image")]
|
||||
Image {
|
||||
id: String,
|
||||
#[serde(rename = "xMm")]
|
||||
x_mm: f64,
|
||||
#[serde(rename = "yMm")]
|
||||
y_mm: f64,
|
||||
#[serde(rename = "widthMm")]
|
||||
width_mm: f64,
|
||||
#[serde(rename = "heightMm")]
|
||||
height_mm: f64,
|
||||
src: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
opacity: Option<f64>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Parametrische Wandregel (Tag `type`).
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum ParametricRule {
|
||||
#[serde(rename = "grid")]
|
||||
Grid(GridRule),
|
||||
#[serde(rename = "module")]
|
||||
Module(ModuleRule),
|
||||
#[serde(rename = "conditional-thickness")]
|
||||
ConditionalThickness(ConditionalThicknessRule),
|
||||
#[serde(rename = "reference-line")]
|
||||
ReferenceLine(ReferenceLineRule),
|
||||
#[serde(rename = "sequence")]
|
||||
Sequence(SequenceRule),
|
||||
}
|
||||
|
||||
/// Kontext-Objekt (Tag `type`).
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum ContextObject {
|
||||
#[serde(rename = "importedMesh")]
|
||||
ImportedMesh(ImportedMesh),
|
||||
#[serde(rename = "contourSet")]
|
||||
ContourSet(ContourSet),
|
||||
#[serde(rename = "terrainMesh")]
|
||||
TerrainMesh(TerrainMesh),
|
||||
#[serde(rename = "image")]
|
||||
Image(ContextImage),
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//! Typisiertes Projektmodell ([K4] S2): Rust-Gegenstück zu `src/model/types.ts`. `generated.rs`
|
||||
//! entstand aus den TS-Typen (`scripts/gen-rust-model.py`) und wird ab jetzt von Hand gepflegt;
|
||||
//! Typen mit Tag stehen in `manual.rs`.
|
||||
|
||||
pub mod generated;
|
||||
pub mod manual;
|
||||
|
||||
pub use generated::*;
|
||||
pub use manual::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use serde_json::Value;
|
||||
|
||||
/// Zahlen als f64 vergleichbar machen (JS kennt keinen Unterschied zwischen 3 und 3.0).
|
||||
fn norm(v: &Value) -> Value {
|
||||
match v {
|
||||
Value::Number(n) => serde_json::Number::from_f64(n.as_f64().unwrap()).map_or(Value::Null, Value::Number),
|
||||
Value::Array(a) => Value::Array(a.iter().map(norm).collect()),
|
||||
Value::Object(o) => Value::Object(o.iter().map(|(k, v)| (k.clone(), norm(v))).collect()),
|
||||
other => other.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn roundtrip(name: &str, text: &str) {
|
||||
let raw: Value = serde_json::from_str(text).unwrap();
|
||||
// `deny_unknown_fields` (nur im Test) meldet jedes Feld, das dem Modell fehlt.
|
||||
let p: Project = serde_json::from_value(raw.clone()).unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let back = serde_json::to_value(&p).unwrap();
|
||||
assert_eq!(norm(&back), norm(&raw), "{name}: Hin-und-zurück weicht ab");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn beispielprojekt_hin_und_zurueck() {
|
||||
roundtrip("sample_project", include_str!("../../tests/fixtures/sample_project.json"));
|
||||
}
|
||||
}
|
||||
@@ -61,3 +61,11 @@ pub fn doc_apply(h: u32, ops_json: &str) -> String {
|
||||
pub fn doc_json(h: u32) -> String {
|
||||
with_doc(h, |d| d.to_json()).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Kennzahlen des Projekts als JSON (leer bei Fehler: Dokument nicht offen oder Modell passt nicht).
|
||||
#[wasm_bindgen]
|
||||
pub fn doc_kennzahlen(h: u32) -> String {
|
||||
with_doc(h, |d| d.project().ok().map(|p| serde_json::to_string(&crate::kennzahlen::compute(&p)).unwrap_or_default()))
|
||||
.flatten()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
//! Bindungen der Kennzahlen-Rechenteile (`crate::kennzahlen`).
|
||||
|
||||
use crate::flat_read::pairs;
|
||||
use crate::flat_read::Reader;
|
||||
use crate::kennzahlen::{self, RoomIn, SolidIn};
|
||||
use crate::kennzahlen;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
/// Grundriss `[x0, y0, …]`, Kreisradius (NaN = kein Kreis), Höhe, Verjüngung → m³.
|
||||
@@ -10,41 +9,3 @@ use wasm_bindgen::prelude::wasm_bindgen;
|
||||
pub fn kz_solid_volume(points: &[f64], circle_r: f64, height: f64, taper: f64) -> f64 {
|
||||
kennzahlen::solid_volume(&pairs(points), circle_r, height, taper)
|
||||
}
|
||||
|
||||
fn read_rooms(buf: &[f64]) -> Option<Vec<RoomIn>> {
|
||||
let mut r = Reader::new(buf);
|
||||
let n = r.count()?;
|
||||
let mut out = Vec::with_capacity(n.min(1 << 16));
|
||||
for _ in 0..n {
|
||||
let (level, category) = (r.count()?, r.count()?);
|
||||
out.push(RoomIn { level, category, boundary: r.ring()? });
|
||||
}
|
||||
Some(out)
|
||||
}
|
||||
|
||||
fn read_solids(buf: &[f64]) -> Option<Vec<SolidIn>> {
|
||||
let mut r = Reader::new(buf);
|
||||
let n = r.count()?;
|
||||
let mut out = Vec::with_capacity(n.min(1 << 16));
|
||||
for _ in 0..n {
|
||||
let subtract = r.num()? != 0.0;
|
||||
let (circle_r, height, taper) = (r.num()?, r.num()?, r.num()?);
|
||||
out.push(SolidIn { subtract, points: r.ring()?, circle_r, height, taper });
|
||||
}
|
||||
Some(out)
|
||||
}
|
||||
|
||||
/// Räume `[n, (geschoss, kategorie, nPkt, x, y, …)…]`, Körper
|
||||
/// `[n, (abzug 0/1, radius|NaN, höhe, verjüngung, nPkt, x, y, …)…]`, Parzellenzahl, Parzellenring
|
||||
/// `[x0, y0, …]` → `[gv, parzelle|NaN, (6 Kategorie-Summen je Geschoss)…]`.
|
||||
#[wasm_bindgen]
|
||||
pub fn kz_area_sums(n_levels: u32, rooms: &[f64], solids: &[f64], parcel_area: f64, parcel_ring: &[f64]) -> Vec<f64> {
|
||||
let rooms = read_rooms(rooms).unwrap_or_default();
|
||||
let solids = read_solids(solids).unwrap_or_default();
|
||||
let s = kennzahlen::area_sums(n_levels.min(1 << 16) as usize, &rooms, &solids, parcel_area, &pairs(parcel_ring));
|
||||
let mut out = vec![s.gv, s.parcel.unwrap_or(f64::NAN)];
|
||||
for l in s.by_level {
|
||||
out.extend(l);
|
||||
}
|
||||
out
|
||||
}
|
||||
+936
@@ -0,0 +1,936 @@
|
||||
{
|
||||
"id": "demo",
|
||||
"name": "Demo-Haus",
|
||||
"lineStyles": [
|
||||
{
|
||||
"id": "hatch-hair",
|
||||
"name": "Volllinie 0.02",
|
||||
"weight": 0.02,
|
||||
"color": "#1a1a1a",
|
||||
"dash": null
|
||||
},
|
||||
{
|
||||
"id": "thin",
|
||||
"name": "Volllinie 0.13",
|
||||
"weight": 0.13,
|
||||
"color": "#1a1a1a",
|
||||
"dash": null
|
||||
},
|
||||
{
|
||||
"id": "medium",
|
||||
"name": "Volllinie 0.25",
|
||||
"weight": 0.25,
|
||||
"color": "#1a1a1a",
|
||||
"dash": null
|
||||
},
|
||||
{
|
||||
"id": "thick",
|
||||
"name": "Volllinie 0.5",
|
||||
"weight": 0.5,
|
||||
"color": "#0a0a0a",
|
||||
"dash": null
|
||||
},
|
||||
{
|
||||
"id": "hatch-dash",
|
||||
"name": "Dämmungsstrich",
|
||||
"weight": 0.02,
|
||||
"color": "#1a1a1a",
|
||||
"dash": [
|
||||
0.35,
|
||||
0.3
|
||||
]
|
||||
}
|
||||
],
|
||||
"hatches": [
|
||||
{
|
||||
"id": "none",
|
||||
"name": "Ohne",
|
||||
"pattern": "none",
|
||||
"scale": 1,
|
||||
"angle": 0,
|
||||
"color": "#1a1a1a"
|
||||
},
|
||||
{
|
||||
"id": "insulation",
|
||||
"name": "Wärmedämmung",
|
||||
"pattern": "insulation",
|
||||
"scale": 1,
|
||||
"angle": 0,
|
||||
"color": "#1a1a1a",
|
||||
"lineStyleId": "thin"
|
||||
},
|
||||
{
|
||||
"id": "diagonal",
|
||||
"name": "Diagonal",
|
||||
"pattern": "diagonal",
|
||||
"scale": 1,
|
||||
"angle": 45,
|
||||
"color": "#1a1a1a",
|
||||
"lineStyleId": "thin"
|
||||
},
|
||||
{
|
||||
"id": "crosshatch",
|
||||
"name": "Kreuzschraffur",
|
||||
"pattern": "crosshatch",
|
||||
"scale": 1,
|
||||
"angle": 0,
|
||||
"color": "#1a1a1a",
|
||||
"lineStyleId": "thin"
|
||||
},
|
||||
{
|
||||
"id": "solid-concrete",
|
||||
"name": "Beton (voll)",
|
||||
"pattern": "solid",
|
||||
"scale": 1,
|
||||
"angle": 0,
|
||||
"color": "#9aa0a6",
|
||||
"lineStyleId": "thin"
|
||||
},
|
||||
{
|
||||
"id": "sia-concrete",
|
||||
"name": "Beton (Kreuz)",
|
||||
"pattern": "crosshatch",
|
||||
"scale": 0.5,
|
||||
"angle": 45,
|
||||
"color": "#1a1a1a",
|
||||
"lineStyleId": "hatch-hair"
|
||||
},
|
||||
{
|
||||
"id": "sia-brick",
|
||||
"name": "Backstein (Diagonal)",
|
||||
"pattern": "diagonal",
|
||||
"scale": 0.5,
|
||||
"angle": 45,
|
||||
"relativeToWall": true,
|
||||
"color": "#1a1a1a",
|
||||
"lineStyleId": "hatch-hair"
|
||||
},
|
||||
{
|
||||
"id": "sia-insulation",
|
||||
"name": "Dämmung (Strich)",
|
||||
"pattern": "diagonal",
|
||||
"scale": 0.45,
|
||||
"angle": 0,
|
||||
"relativeToWall": true,
|
||||
"color": "#1a1a1a",
|
||||
"lineStyleId": "hatch-hair"
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"id": "render-ext",
|
||||
"name": "Aussenputz",
|
||||
"color": "#d8d2c7",
|
||||
"hatchId": "none",
|
||||
"joinPriority": 10,
|
||||
"material": {
|
||||
"libraryId": "Plaster001",
|
||||
"color": "/assets/materials/Plaster001/color.jpg",
|
||||
"normal": "/assets/materials/Plaster001/normal.jpg",
|
||||
"roughness": "/assets/materials/Plaster001/roughness.jpg",
|
||||
"displacement": "/assets/materials/Plaster001/displacement.jpg",
|
||||
"sizeM": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "insulation",
|
||||
"name": "Wärmedämmung",
|
||||
"color": "#ffffff",
|
||||
"hatchId": "sia-insulation",
|
||||
"joinPriority": 20
|
||||
},
|
||||
{
|
||||
"id": "brick",
|
||||
"name": "Backstein",
|
||||
"color": "#8c5544",
|
||||
"hatchId": "sia-brick",
|
||||
"joinPriority": 50,
|
||||
"material": {
|
||||
"libraryId": "Bricks104",
|
||||
"color": "/assets/materials/Bricks104/color.jpg",
|
||||
"normal": "/assets/materials/Bricks104/normal.jpg",
|
||||
"roughness": "/assets/materials/Bricks104/roughness.jpg",
|
||||
"displacement": "/assets/materials/Bricks104/displacement.jpg",
|
||||
"ao": "/assets/materials/Bricks104/ao.jpg",
|
||||
"sizeM": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "render-int",
|
||||
"name": "Innenputz",
|
||||
"color": "#efece6",
|
||||
"hatchId": "none",
|
||||
"joinPriority": 10,
|
||||
"material": {
|
||||
"libraryId": "Plaster001",
|
||||
"color": "/assets/materials/Plaster001/color.jpg",
|
||||
"normal": "/assets/materials/Plaster001/normal.jpg",
|
||||
"roughness": "/assets/materials/Plaster001/roughness.jpg",
|
||||
"displacement": "/assets/materials/Plaster001/displacement.jpg",
|
||||
"sizeM": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "roof-tiles",
|
||||
"name": "Dachziegel",
|
||||
"color": "#b8735c",
|
||||
"hatchId": "sia-brick",
|
||||
"joinPriority": 15,
|
||||
"material": {
|
||||
"libraryId": "RoofingTiles013A",
|
||||
"color": "/assets/materials/RoofingTiles013A/color.jpg",
|
||||
"normal": "/assets/materials/RoofingTiles013A/normal.jpg",
|
||||
"roughness": "/assets/materials/RoofingTiles013A/roughness.jpg",
|
||||
"displacement": "/assets/materials/RoofingTiles013A/displacement.jpg",
|
||||
"ao": "/assets/materials/RoofingTiles013A/ao.jpg",
|
||||
"sizeM": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "concrete",
|
||||
"name": "Beton",
|
||||
"color": "#9aa0a6",
|
||||
"hatchId": "sia-concrete",
|
||||
"joinPriority": 100,
|
||||
"material": {
|
||||
"libraryId": "Concrete048",
|
||||
"color": "/assets/materials/Concrete048/color.jpg",
|
||||
"normal": "/assets/materials/Concrete048/normal.jpg",
|
||||
"roughness": "/assets/materials/Concrete048/roughness.jpg",
|
||||
"displacement": "/assets/materials/Concrete048/displacement.jpg",
|
||||
"ao": "/assets/materials/Concrete048/ao.jpg",
|
||||
"sizeM": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "screed",
|
||||
"name": "Zementestrich",
|
||||
"color": "#c9c2b3",
|
||||
"hatchId": "diagonal",
|
||||
"joinPriority": 30
|
||||
}
|
||||
],
|
||||
"wallTypes": [
|
||||
{
|
||||
"id": "aw",
|
||||
"name": "Aussenwand 34.5 cm",
|
||||
"layers": [
|
||||
{
|
||||
"componentId": "render-ext",
|
||||
"thickness": 0.02
|
||||
},
|
||||
{
|
||||
"componentId": "insulation",
|
||||
"thickness": 0.16,
|
||||
"jointLineStyleId": "thin"
|
||||
},
|
||||
{
|
||||
"componentId": "brick",
|
||||
"thickness": 0.15
|
||||
},
|
||||
{
|
||||
"componentId": "render-int",
|
||||
"thickness": 0.015
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "iw",
|
||||
"name": "Innenwand Mauerwerk verputzt 15 cm",
|
||||
"layers": [
|
||||
{
|
||||
"componentId": "render-int",
|
||||
"thickness": 0.015
|
||||
},
|
||||
{
|
||||
"componentId": "brick",
|
||||
"thickness": 0.12
|
||||
},
|
||||
{
|
||||
"componentId": "render-int",
|
||||
"thickness": 0.015
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"ceilingTypes": [
|
||||
{
|
||||
"id": "dg-massiv",
|
||||
"name": "Geschossdecke mehrschichtig",
|
||||
"layers": [
|
||||
{
|
||||
"componentId": "screed",
|
||||
"thickness": 0.06
|
||||
},
|
||||
{
|
||||
"componentId": "insulation",
|
||||
"thickness": 0.04,
|
||||
"jointLineStyleId": "thin"
|
||||
},
|
||||
{
|
||||
"componentId": "concrete",
|
||||
"thickness": 0.2
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"roofTypes": [
|
||||
{
|
||||
"id": "roof-warm",
|
||||
"name": "Steildach gedämmt",
|
||||
"layers": [
|
||||
{
|
||||
"componentId": "roof-tiles",
|
||||
"thickness": 0.04
|
||||
},
|
||||
{
|
||||
"componentId": "insulation",
|
||||
"thickness": 0.22,
|
||||
"jointLineStyleId": "thin"
|
||||
},
|
||||
{
|
||||
"componentId": "render-int",
|
||||
"thickness": 0.0125
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"doorTypes": [
|
||||
{
|
||||
"id": "door-standard",
|
||||
"name": "Zimmertür 0.9 m",
|
||||
"kind": "dreh",
|
||||
"leafCount": 1,
|
||||
"leafStyle": "glatt",
|
||||
"frameThickness": 0.05,
|
||||
"frameKind": "zarge",
|
||||
"frameWidth": 0.06,
|
||||
"defaultWidth": 0.9,
|
||||
"defaultHeight": 2
|
||||
},
|
||||
{
|
||||
"id": "door-entry",
|
||||
"name": "Haustür Blockrahmen (Oberlicht)",
|
||||
"kind": "dreh",
|
||||
"leafCount": 1,
|
||||
"leafStyle": "glas",
|
||||
"glazingRatio": 0.35,
|
||||
"frameThickness": 0.07,
|
||||
"frameKind": "blockrahmen",
|
||||
"frameWidth": 0.09,
|
||||
"insetFromFace": 0.14,
|
||||
"insetFace": "aussen",
|
||||
"transomHeight": 0.45,
|
||||
"threshold": true,
|
||||
"defaultWidth": 1.1,
|
||||
"defaultHeight": 2.1
|
||||
}
|
||||
],
|
||||
"windowTypes": [
|
||||
{
|
||||
"id": "window-standard",
|
||||
"name": "Fenster 1.2 × 1.4 m",
|
||||
"kind": "drehkipp",
|
||||
"wingCount": 1,
|
||||
"glazing": "zweifach",
|
||||
"frameThickness": 0.06,
|
||||
"frameWidth": 0.06,
|
||||
"defaultSillHeight": 0.9,
|
||||
"defaultWidth": 1.2,
|
||||
"defaultHeight": 1.4
|
||||
},
|
||||
{
|
||||
"id": "window-double",
|
||||
"name": "Fenster 2-flügl. + Oberlicht",
|
||||
"kind": "drehkipp",
|
||||
"wingCount": 2,
|
||||
"mullionRows": 1,
|
||||
"glazing": "dreifach",
|
||||
"frameThickness": 0.07,
|
||||
"frameWidth": 0.07,
|
||||
"insetFromFace": 0.12,
|
||||
"insetFace": "aussen",
|
||||
"transomHeight": 0.4,
|
||||
"defaultSillHeight": 0.85,
|
||||
"defaultWidth": 1.8,
|
||||
"defaultHeight": 1.9
|
||||
}
|
||||
],
|
||||
"stairTypes": [
|
||||
{
|
||||
"id": "stair-standard",
|
||||
"name": "Betontreppe 1.0 m",
|
||||
"structure": "beton",
|
||||
"closedRisers": true,
|
||||
"treadThickness": 0.05,
|
||||
"nosing": 0.03,
|
||||
"railing": "keine",
|
||||
"defaultWidth": 1
|
||||
},
|
||||
{
|
||||
"id": "stair-massiv",
|
||||
"name": "Massivtreppe (auf Sockel)",
|
||||
"structure": "massiv",
|
||||
"closedRisers": true,
|
||||
"treadThickness": 0.04,
|
||||
"nosing": 0.03,
|
||||
"railing": "keine",
|
||||
"defaultWidth": 1
|
||||
},
|
||||
{
|
||||
"id": "stair-wange-holz",
|
||||
"name": "Wangentreppe Holz (offen)",
|
||||
"structure": "wange",
|
||||
"closedRisers": false,
|
||||
"treadThickness": 0.05,
|
||||
"nosing": 0.03,
|
||||
"railing": "keine",
|
||||
"defaultWidth": 1
|
||||
},
|
||||
{
|
||||
"id": "stair-aufgesattelt",
|
||||
"name": "Aufgesattelt (Setzstufen)",
|
||||
"structure": "aufgesattelt",
|
||||
"closedRisers": true,
|
||||
"treadThickness": 0.05,
|
||||
"nosing": 0.025,
|
||||
"railing": "keine",
|
||||
"defaultWidth": 1
|
||||
}
|
||||
],
|
||||
"drawingLevels": [
|
||||
{
|
||||
"id": "eg",
|
||||
"name": "Erdgeschoss",
|
||||
"kind": "floor",
|
||||
"visible": true,
|
||||
"locked": false,
|
||||
"floorHeight": 2.6,
|
||||
"cutHeight": 1,
|
||||
"baseElevation": 0
|
||||
},
|
||||
{
|
||||
"id": "og",
|
||||
"name": "Obergeschoss",
|
||||
"kind": "floor",
|
||||
"visible": true,
|
||||
"locked": false,
|
||||
"floorHeight": 2.6,
|
||||
"cutHeight": 1,
|
||||
"baseElevation": 2.6
|
||||
},
|
||||
{
|
||||
"id": "schnitt-a",
|
||||
"name": "Schnitt A",
|
||||
"kind": "section",
|
||||
"visible": true,
|
||||
"locked": false,
|
||||
"linePoints": [
|
||||
{
|
||||
"x": -1,
|
||||
"y": 2
|
||||
},
|
||||
{
|
||||
"x": 6,
|
||||
"y": 2
|
||||
}
|
||||
],
|
||||
"directionSign": 1
|
||||
},
|
||||
{
|
||||
"id": "ansicht-sued",
|
||||
"name": "Ansicht Süd",
|
||||
"kind": "elevation",
|
||||
"visible": true,
|
||||
"locked": false,
|
||||
"linePoints": [
|
||||
{
|
||||
"x": -1,
|
||||
"y": -2
|
||||
},
|
||||
{
|
||||
"x": 6,
|
||||
"y": -2
|
||||
}
|
||||
],
|
||||
"directionSign": 1,
|
||||
"shadows": true
|
||||
},
|
||||
{
|
||||
"id": "detail-1",
|
||||
"name": "Detail 1",
|
||||
"kind": "drawing",
|
||||
"visible": true,
|
||||
"locked": false
|
||||
}
|
||||
],
|
||||
"layers": [
|
||||
{
|
||||
"code": "00",
|
||||
"name": "Raster",
|
||||
"color": "#484850",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "01",
|
||||
"name": "Vermessung",
|
||||
"color": "#707078",
|
||||
"lw": 0.18,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "05",
|
||||
"name": "Kontext",
|
||||
"color": "#707078",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false,
|
||||
"children": [
|
||||
{
|
||||
"code": "10",
|
||||
"name": "Situation",
|
||||
"color": "#909090",
|
||||
"lw": 0.18,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "11",
|
||||
"name": "Strasse",
|
||||
"color": "#a89070",
|
||||
"lw": 0.18,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "12",
|
||||
"name": "Gebäude",
|
||||
"color": "#888888",
|
||||
"lw": 0.25,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "13",
|
||||
"name": "Bäume",
|
||||
"color": "#50a050",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "14",
|
||||
"name": "Höhenlinien",
|
||||
"color": "#909050",
|
||||
"lw": 0.18,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "20",
|
||||
"name": "Wände",
|
||||
"color": "#0a0a0a",
|
||||
"lw": 0.35,
|
||||
"visible": true,
|
||||
"locked": false,
|
||||
"children": [
|
||||
{
|
||||
"code": "21",
|
||||
"name": "Türen/Fenster",
|
||||
"color": "#5080c8",
|
||||
"lw": 0.25,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "22",
|
||||
"name": "Möbel",
|
||||
"color": "#909090",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "25",
|
||||
"name": "Stützen",
|
||||
"color": "#c87050",
|
||||
"lw": 0.5,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "30",
|
||||
"name": "Decken",
|
||||
"color": "#605850",
|
||||
"lw": 0.35,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "31",
|
||||
"name": "Dächer",
|
||||
"color": "#7a4a3a",
|
||||
"lw": 0.35,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "40",
|
||||
"name": "Treppen",
|
||||
"color": "#4a6a58",
|
||||
"lw": 0.35,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "35",
|
||||
"name": "Träger",
|
||||
"color": "#a87858",
|
||||
"lw": 0.5,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "50",
|
||||
"name": "Text",
|
||||
"color": "#d0d0d0",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "60",
|
||||
"name": "Räume",
|
||||
"color": "#5a7a9a",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "90",
|
||||
"name": "Referenzen",
|
||||
"color": "#585860",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"code": "99",
|
||||
"name": "Konstruktion",
|
||||
"color": "#404048",
|
||||
"lw": 0.13,
|
||||
"visible": true,
|
||||
"locked": false
|
||||
}
|
||||
],
|
||||
"walls": [
|
||||
{
|
||||
"id": "W1",
|
||||
"type": "wall",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"end": {
|
||||
"x": 5,
|
||||
"y": 0
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W2",
|
||||
"type": "wall",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 5,
|
||||
"y": 0
|
||||
},
|
||||
"end": {
|
||||
"x": 5,
|
||||
"y": 4
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W3",
|
||||
"type": "wall",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 5,
|
||||
"y": 4
|
||||
},
|
||||
"end": {
|
||||
"x": 0,
|
||||
"y": 4
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W4",
|
||||
"type": "wall",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 0,
|
||||
"y": 4
|
||||
},
|
||||
"end": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W9",
|
||||
"type": "wall",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 2.4,
|
||||
"y": 0
|
||||
},
|
||||
"end": {
|
||||
"x": 2.4,
|
||||
"y": 4
|
||||
},
|
||||
"wallTypeId": "iw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W5",
|
||||
"type": "wall",
|
||||
"floorId": "og",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"end": {
|
||||
"x": 5,
|
||||
"y": 0
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W6",
|
||||
"type": "wall",
|
||||
"floorId": "og",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 5,
|
||||
"y": 0
|
||||
},
|
||||
"end": {
|
||||
"x": 5,
|
||||
"y": 3
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W7",
|
||||
"type": "wall",
|
||||
"floorId": "og",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 5,
|
||||
"y": 3
|
||||
},
|
||||
"end": {
|
||||
"x": 0,
|
||||
"y": 3
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
},
|
||||
{
|
||||
"id": "W8",
|
||||
"type": "wall",
|
||||
"floorId": "og",
|
||||
"categoryCode": "20",
|
||||
"start": {
|
||||
"x": 0,
|
||||
"y": 3
|
||||
},
|
||||
"end": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"wallTypeId": "aw",
|
||||
"height": 2.6
|
||||
}
|
||||
],
|
||||
"openings": [
|
||||
{
|
||||
"id": "D1",
|
||||
"type": "opening",
|
||||
"hostWallId": "W1",
|
||||
"categoryCode": "21",
|
||||
"kind": "door",
|
||||
"typeId": "door-standard",
|
||||
"position": 0.8,
|
||||
"width": 0.9,
|
||||
"height": 2.1,
|
||||
"sillHeight": 0,
|
||||
"swing": "left",
|
||||
"hinge": "start"
|
||||
},
|
||||
{
|
||||
"id": "O1",
|
||||
"type": "opening",
|
||||
"hostWallId": "W1",
|
||||
"categoryCode": "21",
|
||||
"kind": "window",
|
||||
"typeId": "window-standard",
|
||||
"position": 3,
|
||||
"width": 1,
|
||||
"height": 1.2,
|
||||
"sillHeight": 0.9
|
||||
},
|
||||
{
|
||||
"id": "O2",
|
||||
"type": "opening",
|
||||
"hostWallId": "W3",
|
||||
"categoryCode": "21",
|
||||
"kind": "window",
|
||||
"typeId": "window-standard",
|
||||
"position": 0.6,
|
||||
"width": 1.4,
|
||||
"height": 1.3,
|
||||
"sillHeight": 0.9
|
||||
}
|
||||
],
|
||||
"ceilings": [
|
||||
{
|
||||
"id": "C1",
|
||||
"type": "ceiling",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "30",
|
||||
"outline": [
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 5,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 5,
|
||||
"y": 4
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 4
|
||||
}
|
||||
],
|
||||
"wallTypeId": "aw",
|
||||
"ceilingTypeId": "dg-massiv"
|
||||
}
|
||||
],
|
||||
"roofs": [
|
||||
{
|
||||
"id": "RF1",
|
||||
"type": "roof",
|
||||
"floorId": "og",
|
||||
"categoryCode": "31",
|
||||
"outline": [
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 5,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 5,
|
||||
"y": 4
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 4
|
||||
}
|
||||
],
|
||||
"shape": "sattel",
|
||||
"pitchDeg": 30,
|
||||
"overhang": 0.4,
|
||||
"ridgeAxis": "x",
|
||||
"thickness": 0.2
|
||||
}
|
||||
],
|
||||
"stairs": [
|
||||
{
|
||||
"id": "ST1",
|
||||
"type": "stair",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "40",
|
||||
"shape": "straight",
|
||||
"typeId": "stair-standard",
|
||||
"start": {
|
||||
"x": 3.7,
|
||||
"y": 0.4
|
||||
},
|
||||
"dir": {
|
||||
"x": 0,
|
||||
"y": 1
|
||||
},
|
||||
"runLength": 3.2,
|
||||
"width": 1,
|
||||
"totalRise": 2.6,
|
||||
"stepCount": 15,
|
||||
"up": true
|
||||
}
|
||||
],
|
||||
"rooms": [
|
||||
{
|
||||
"id": "R1",
|
||||
"type": "room",
|
||||
"floorId": "eg",
|
||||
"categoryCode": "60",
|
||||
"siaCategory": "HNF",
|
||||
"name": "Wohnen",
|
||||
"boundary": [
|
||||
{
|
||||
"x": 0.1725,
|
||||
"y": 0.1725
|
||||
},
|
||||
{
|
||||
"x": 4.8275,
|
||||
"y": 0.1725
|
||||
},
|
||||
{
|
||||
"x": 4.8275,
|
||||
"y": 3.8275
|
||||
},
|
||||
{
|
||||
"x": 0.1725,
|
||||
"y": 3.8275
|
||||
}
|
||||
],
|
||||
"color": "#6b7280",
|
||||
"stampAnchor": {
|
||||
"x": 2.5,
|
||||
"y": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"drawings2d": [],
|
||||
"context": []
|
||||
}
|
||||
Reference in new issue
Block a user