[K4] Objekt-Info im Kern: deriveSelection rechnet selection_info.rs
Die Objekt-Info der Auswahl (effektive Attribute, bbox, Wand/Decke/Dach/Öffnung/Treppe/Raum/ Extrusion/Stütze/Kontext/Detailverweis) ist die Wurzel-Abfrage selectionInfo; state/selectionInfo.ts hält Kontrakt und Fassade (B-Rep-Beschreibung der Extrusion aus TS). geomBBox ist gelöscht, Ausrichten/Verteilen fragt drawingBBoxes. Schneller in Griffen und Objekt-Info: Felder kleiner Objekte linear statt über den Map-Hash, Griff-Anfrage typisiert, Antworten direkt als Text, js_fmt::to_fixed mit Schnellweg. Gleichheit über 174 360 Auswahlen und 24 000 Ausricht-Fälle (einmaliger Test, gelöscht); TODO.md nachgeführt. Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
11 files changed
+1705
-958
No files matched your search
+22
-2
@@ -245,7 +245,7 @@ export class ProjectDocument {
|
||||
commitGrip(base: Project, req: object, coalesceKey: string | undefined, now: number): { project: Project; ops: CoreOp[]; notice?: string } | { problems: string[] } {
|
||||
this.ensure(base);
|
||||
if (!this.handle) return { problems: ["Projekt-Dokument im Kern nicht offen."] };
|
||||
const out = core().doc_grip_commit(this.handle, toMarkedJson(req), coalesceKey ?? "", now);
|
||||
const out = core().doc_grip_commit(this.handle, gripJson(req), coalesceKey ?? "", now);
|
||||
if (out.startsWith("\u0001")) throw new Error(out.slice(1));
|
||||
const r = fromMarkedJson<{ ops: CoreOp[]; notice?: string } | { problems: string[] }>(out);
|
||||
if ("problems" in r) return r;
|
||||
@@ -255,10 +255,21 @@ export class ProjectDocument {
|
||||
return { project, ops: r.ops, notice: r.notice };
|
||||
}
|
||||
|
||||
/**
|
||||
* Wie {@link queryRoot} für Abfragen, deren Antwort nicht endliche Zahlen als Marken trägt
|
||||
* (`selectionInfo`, `drawingBBoxes`); die Marken werden wieder Zahlen.
|
||||
*/
|
||||
queryRootMarked<T>(name: "selectionInfo" | "drawingBBoxes", text = ""): T {
|
||||
if (!this.handle) throw new Error(`Kern-Abfrage „${name}": Dokument nicht offen`);
|
||||
const out = core().doc_query_root(this.handle, name, text);
|
||||
if (out.startsWith("\u0001")) throw new Error(out.slice(1));
|
||||
return fromMarkedJson<T>(out);
|
||||
}
|
||||
|
||||
/** Wie {@link commitGrip}, aber nur rechnen (ohne Anwenden): die Ops und ggf. der Hinweis. */
|
||||
gripOps(req: object): { ops: CoreOp[]; notice?: string } {
|
||||
if (!this.handle) throw new Error("Kern-Abfrage „gripOps“: Dokument nicht offen");
|
||||
const out = core().doc_query_root(this.handle, "gripOps", toMarkedJson(req));
|
||||
const out = core().doc_query_root(this.handle, "gripOps", gripJson(req));
|
||||
if (out.startsWith("\u0001")) throw new Error(out.slice(1));
|
||||
return fromMarkedJson(out);
|
||||
}
|
||||
@@ -320,6 +331,15 @@ export class ProjectDocument {
|
||||
}
|
||||
}
|
||||
|
||||
/** Griff-Anfrage als JSON; Marken nur bei nicht endlichen Zahlen (der Ersetzer kostet je Wert einen Aufruf). */
|
||||
function gripJson(req: object): string {
|
||||
for (const v of Object.values(req)) {
|
||||
const bad = typeof v === "number" ? !Number.isFinite(v) : Array.isArray(v) && v.some((x) => typeof x === "number" && !Number.isFinite(x));
|
||||
if (bad) return toMarkedJson(req);
|
||||
}
|
||||
return JSON.stringify(req);
|
||||
}
|
||||
|
||||
let shared: ProjectDocument | null = null;
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user