[208] Anonyme Abgabe vollständig: Berichte, IFC, DXF-Blattnamen, STEP, Blender-Paket, Dateinamen über zentrale competitionIdentity; Test über alle Formate
This commit is contained in:
29 files changed
+488
-72
No files matched your search
@@ -84,6 +84,7 @@ Neues Modul: `<modul>.rs` und `mod` in `lib.rs`, Bindungen in `web/<modul>.rs` u
|
||||
| `layers.rs`, `levels.rs`, `groups.rs`, `pens.rs`, `reorder.rs`, `folder_tree.rs` | Ebenen, Geschosse, Gruppen, Stiftsätze, Z-Reihenfolge, Ordner |
|
||||
| `layout_model.rs`, `sheet_viewports.rs`, `sheet_table.rs`, `presentation_sheet.rs` | Layout-Blätter, Viewports, Tabellen, Präsentationsplan |
|
||||
| `layout_image.rs`, `layout_poster.rs` | Bilder auf Blättern (Dateikopf, Zuschnitt, dpi) und Plakat-Vorlagen mit Raster und Kopfzeile ([208]) |
|
||||
| `competition.rs` | Anonyme Abgabe ([208]): `anonymous_keyword`, neutraler Zeitstempel für IFC-Sammler und DXF-Blattnamen (TS-Gegenstück `export/competitionIdentity.ts`) |
|
||||
| `parametric_walls.rs`, `geo_translate.rs`, `geo_rebase.rs` | parametrische Wände; Projekt verschieben; Ursprung für Exporte |
|
||||
| `auto_lines.rs` | [221] Standard-Schnitt/-Ansicht folgen dem Gebauten (im `commit` nachgeführt, wie `dim_assoc`) |
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// Anonyme Wettbewerbs-Abgabe ([208]): was die Ausgaben über die Herkunft sagen dürfen. Ist
|
||||
// `Project.competition` anonym, trägt keine Ausgabe Büro, Bearbeiter:in, Projektname, Projektnummer, Adresse
|
||||
// oder Benutzername — nur das Kennwort. Gegenstück in TS: `src/export/competitionIdentity.ts` (dieselbe Regel für
|
||||
// PDF, Berichte, STEP, Blender-Paket, Dateinamen). Der Plankopf löst das selbst auf (`layout_model.rs`).
|
||||
|
||||
use crate::model::Project;
|
||||
|
||||
/// Fester Zeitstempel anonymer Ausgaben: 2000-01-01 00:00:00 UTC (Sekunden seit 1970).
|
||||
pub const NEUTRAL_EPOCH: f64 = 946_684_800.0;
|
||||
/// Derselbe Zeitstempel als ISO-Text ohne Zone.
|
||||
pub const NEUTRAL_ISO: &str = "2000-01-01T00:00:00";
|
||||
|
||||
/// Kennwort der Abgabe, wenn sie anonym ist (getrimmt; leer = anonym ohne Kennwort); `None` = nicht anonym.
|
||||
pub fn anonymous_keyword(p: &Project) -> Option<String> {
|
||||
p.competition.as_ref().filter(|c| c.anonymous).map(|c| c.keyword.trim().to_string())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::model::CompetitionSettings;
|
||||
|
||||
#[test]
|
||||
fn nur_anonym_liefert_kennwort() {
|
||||
let mut p = Project::default();
|
||||
assert_eq!(anonymous_keyword(&p), None);
|
||||
p.competition = Some(CompetitionSettings { anonymous: false, keyword: "K".into(), ..Default::default() });
|
||||
assert_eq!(anonymous_keyword(&p), None);
|
||||
p.competition = Some(CompetitionSettings { anonymous: true, keyword: " FALKE 7 ".into(), ..Default::default() });
|
||||
assert_eq!(anonymous_keyword(&p).as_deref(), Some("FALKE 7"));
|
||||
}
|
||||
}
|
||||
@@ -881,12 +881,15 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
// Kopf: RefElevation = reale Datumshöhe (informativ), RefLatitude/-Longitude des Bezugspunkts.
|
||||
let anchor = p.geo_anchor.clone();
|
||||
let lat_lon = anchor.as_ref().map(|a| (a.lv95.e, a.lv95.n)).filter(|(e, n)| e.is_finite() && n.is_finite()).map(|(e, n)| lv95_to_wgs84(e, n)).filter(|(la, lo)| la.is_finite() && lo.is_finite());
|
||||
let (pid, pname) = (f.str(&p.id), f.str(&p.name));
|
||||
let iso = f.str(&opt.iso);
|
||||
// Anonyme Abgabe ([208]): Kennwort statt Projektname, fester Zeitstempel; leerer `iso` heisst für den Schreiber
|
||||
// „anonym" (neutrale Erzeuger-/Autorangaben, `fileio/ifc_export`).
|
||||
let anon = crate::competition::anonymous_keyword(&p);
|
||||
let (pid, pname) = (f.str(&p.id), f.str(anon.as_deref().unwrap_or(&p.name)));
|
||||
let (now, iso) = if anon.is_some() { (crate::competition::NEUTRAL_EPOCH, f.str("")) } else { (opt.now, f.str(&opt.iso)) };
|
||||
f.nums(&[
|
||||
pid,
|
||||
pname,
|
||||
opt.now,
|
||||
now,
|
||||
iso,
|
||||
if anchor.is_some() { 1.0 } else { 0.0 },
|
||||
anchor.as_ref().and_then(|a| a.height).unwrap_or(f64::NAN),
|
||||
@@ -1725,6 +1728,23 @@ mod tests {
|
||||
text.split('\0').map(String::from).collect()
|
||||
}
|
||||
|
||||
/// [208] Anonyme Abgabe: Kopf trägt Kennwort, festen Zeitstempel und leeren ISO-Text, nie den Projektnamen.
|
||||
#[test]
|
||||
fn anonyme_abgabe_kopf() {
|
||||
let mut p = sample();
|
||||
p.name = "BUEROXY Haus".into();
|
||||
let opt = IfcOptions { now: 1_794_583_435.0, iso: "2026-11-13T15:23:55".into(), ..Default::default() };
|
||||
let plain = ifc_export_data(&p, &opt).unwrap();
|
||||
assert!(strings(&plain).iter().any(|s| s == "BUEROXY Haus"));
|
||||
p.competition = Some(crate::model::CompetitionSettings { anonymous: true, keyword: "FALKE 7".into(), ..Default::default() });
|
||||
let f = ifc_export_data(&p, &opt).unwrap();
|
||||
let s = strings(&f);
|
||||
assert!(!s.iter().any(|x| x.contains("BUEROXY")), "{s:?}");
|
||||
assert!(s.iter().any(|x| x == "FALKE 7"));
|
||||
assert!(!s.iter().any(|x| x.starts_with("2026-")));
|
||||
assert_eq!(f.nums[3], crate::competition::NEUTRAL_EPOCH);
|
||||
}
|
||||
|
||||
/// [149] Baum als eigener Datensatz (nach den Stützen): Name = Art, Netz Stamm + Krone relativ zur
|
||||
/// Geschoss-UK, Höhe als Menge.
|
||||
#[test]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//!
|
||||
//! Datenübergabe: flache `f64`-Puffer (s. [`flat`]), kein JSON — schnell und ohne Serde-Kosten.
|
||||
|
||||
pub mod competition;
|
||||
pub mod export_schedule;
|
||||
pub mod opening_schedule;
|
||||
pub mod room_book;
|
||||
|
||||
@@ -1599,7 +1599,8 @@ fn sheets(cx: &mut Ctx, main: &mut Buf, layer_by_code: &HashMap<&str, String>) {
|
||||
.and_then(|v| crate::layout_model::effective_sheet_size(&v));
|
||||
let Some((pw, ph)) = size else { continue };
|
||||
// Eindeutiger Name (gleichnamige Blätter, Kollision mit dem Plan-Layout).
|
||||
let base = if js_trim(&layout.name).is_empty() { format!("Blatt {}", n + 1) } else { layout.name.clone() };
|
||||
// Anonyme Abgabe ([208]): Blattnamen sind frei wählbar und können Büro- oder Projektangaben tragen.
|
||||
let base = if js_trim(&layout.name).is_empty() || crate::competition::anonymous_keyword(p).is_some() { format!("Blatt {}", n + 1) } else { layout.name.clone() };
|
||||
let mut name = base.clone();
|
||||
let mut k = 2;
|
||||
while used.contains(&name) {
|
||||
@@ -1778,6 +1779,27 @@ mod tests {
|
||||
assert!(!f2.nums.windows(2).any(|w| w[0] == REC_SHEET_VP && f2.strings.get(w[1] as usize).is_some_and(|s| s == "Blatt")));
|
||||
}
|
||||
|
||||
/// [208] Anonyme Abgabe: Blattnamen (frei wählbar) kommen nicht in die Datei, das Blatt heisst „Blatt n".
|
||||
#[test]
|
||||
fn anonyme_abgabe_blattnamen() {
|
||||
let mut p: Project = serde_json::from_value(crate::sheet_viewports::tests::json()).unwrap();
|
||||
p.layouts.as_mut().unwrap()[0].name = "BUEROXY Plan".into();
|
||||
let a = crate::plan::domains::PlanArgs::parse(1.0, r#"{"floor":"eg","show":["20"],"scale":100}"#).unwrap();
|
||||
let buf = crate::plan::domains::plan_domains_buf(&p, &a).unwrap();
|
||||
let o = DxfOptions { scale: 100.0, include_hatches: true, dim_cm: false, paper_layout: true, bounds: [0.0, 0.0, 10.0, 4.0], default_font: "Arial".into(), floor: "eg".into(), table_labels: String::new() };
|
||||
let run = |p: &Project| {
|
||||
let view = View::parse(&buf).unwrap();
|
||||
let len = view.len();
|
||||
let mut parts = [Part::new(view, 0, len).unwrap()];
|
||||
collect(&mut parts, p, &o).unwrap().strings
|
||||
};
|
||||
assert!(run(&p).iter().any(|s| s == "BUEROXY Plan"));
|
||||
p.competition = Some(crate::model::CompetitionSettings { anonymous: true, keyword: "FALKE 7".into(), ..Default::default() });
|
||||
let s = run(&p);
|
||||
assert!(!s.iter().any(|x| x.contains("BUEROXY")), "{s:?}");
|
||||
assert!(s.iter().any(|x| x == "Blatt 1"));
|
||||
}
|
||||
|
||||
/// [111] Blatt-Tabelle als Block mit Text und Linien, eingefügt oben links.
|
||||
#[test]
|
||||
fn blatt_tabelle_im_dxf() {
|
||||
|
||||
Reference in new issue
Block a user