Skip to content

Commit

Permalink
Debug export not working
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Aug 12, 2024
1 parent b4e9262 commit 0d73292
Show file tree
Hide file tree
Showing 6 changed files with 91,877 additions and 91,830 deletions.
Binary file modified .DS_Store
Binary file not shown.
183,646 changes: 91,829 additions & 91,817 deletions index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/tnviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1557,10 +1557,10 @@ function __wbg_get_imports() {
getInt32Memory0()[arg0 / 4 + 1] = len1;
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
};
imports.wbg.__wbg_random_4bc01a1f182e92dc = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
imports.wbg.__wbg_log_5bb5f88f245d7762 = function(arg0) {
console.log(getObject(arg0));
};
imports.wbg.__wbg_random_4bc01a1f182e92dc = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
imports.wbg.__wbindgen_memory = function() {
const ret = wasm.memory;
return addHeapObject(ret);
Expand Down
Binary file modified pkg/tnviewer_bg.wasm
Binary file not shown.
44 changes: 34 additions & 10 deletions src/geograf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,24 @@ pub fn export_aenderungen_geograf(
risse_extente: &RissMap,
) -> Vec<u8> {

web_sys::console::log_1(&format!("ok 1").as_str().into());

let mut files = Vec::new();

let aenderungen = match reproject_aenderungen_into_target_space(&aenderungen, &split_nas.crs) {
Ok(o) => o,
Err(e) => return Vec::new(),
};

web_sys::console::log_1(&format!("ok 2").as_str().into());

// RISSE -> risse.shp
if !risse.is_empty() {
append_shp(&mut files, "RISSE", None, generate_risse_shp(&risse_extente, &split_nas.crs));
}

web_sys::console::log_1(&format!("ok 3").as_str().into());

// Anschlussrisse PDFs
let len = risse.len();
for (i, _) in risse.iter().enumerate() {
Expand All @@ -137,6 +143,8 @@ pub fn export_aenderungen_geograf(
files.push((None, format!("VERT_{i}_von_{len}.pdf").into(), pdf_vert));
}

web_sys::console::log_1(&format!("ok 4").as_str().into());

let splitflaechen = calc_splitflaechen(&aenderungen, split_nas, nas_xml);
web_sys::console::log_1(&format!("RISSE ::: {risse:?}").as_str().into());
web_sys::console::log_1(&format!("RISSE EXTENTE ::: {risse_extente:?}").as_str().into());
Expand Down Expand Up @@ -207,10 +215,19 @@ pub fn calc_splitflaechen(
original_xml: &NasXMLFile,
) -> Vec<AenderungenIntersection> {

let aenderungen = aenderungen
.clean_stage4(split_nas, &mut Vec::new())
.clean_stage5(split_nas, &mut Vec::new())
.clean_stage6(split_nas, &mut Vec::new());
web_sys::console::log_1(&format!("cleaning stage 4...").as_str().into());

let aenderungen = aenderungen.clean_stage4(split_nas, &mut Vec::new());

web_sys::console::log_1(&format!("cleaning stage 5...").as_str().into());

let aenderungen = aenderungen.clean_stage5(split_nas, &mut Vec::new());

web_sys::console::log_1(&format!("cleaning stage 6...").as_str().into());

let aenderungen = aenderungen.clean_stage6(split_nas, &mut Vec::new());

web_sys::console::log_1(&format!("ok!").as_str().into());

let qt = split_nas.create_quadtree();

Expand All @@ -223,12 +240,13 @@ pub fn calc_splitflaechen(
map: aenderungen_merged_by_typ,
};

web_sys::console::log_1(&format!("getting intersections...").as_str().into());

let cs = aenderungen.get_aenderungen_intersections();

web_sys::console::log_1(&format!("CALC SPLITFLAECHEN").as_str().into());
for c in cs.iter() {
web_sys::console::log_1(&format!("{c:?}").as_str().into());
}
web_sys::console::log_1(&format!("intersections ok!").as_str().into());

web_sys::console::log_1(&format!("{} SPLITFLAECHEN", cs.len()).as_str().into());

cs
}
Expand Down Expand Up @@ -451,8 +469,14 @@ pub fn generate_header_pdf(
.. Default::default()
}));

let times_roman = doc.add_builtin_font(BuiltinFont::TimesRoman).unwrap();
let times_roman_bold = doc.add_builtin_font(BuiltinFont::TimesBold).unwrap();
let times_roman = match doc.add_builtin_font(BuiltinFont::TimesRoman) {
Ok(o) => o,
Err(_) => return Vec::new(),
};
let times_roman_bold = match doc.add_builtin_font(BuiltinFont::TimesBold) {
Ok(o) => o,
Err(_) => return Vec::new(),
};
let page1 = doc.get_page(page1);
let layer1 = page1.get_layer(layer1);

Expand Down
15 changes: 13 additions & 2 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,8 @@ impl Aenderungen {

let aenderungen_merged_by_typ_clone = aenderungen_merged_by_typ.clone();

web_sys::console::log_1(&format!("clean stage 5 1!").as_str().into());

// 3. Alle komplett geänderte Flächen: In Änderungen einfügen
for (flst_part_id, neue_nutzung) in changed_mut.na_definiert.iter() {
let flst_part = match split_nas.get_flst_part_by_id(&flst_part_id) {
Expand All @@ -1477,25 +1479,34 @@ impl Aenderungen {

let flst_part_rect = flst_part.get_rect();

web_sys::console::log_1(&format!("clean stage 5 2!").as_str().into());

// Teilflächen abziehen vom Flurstück, die von Änderungen überlappt werden
let aenderungen_overlaps_polygon =
aenderungen_merged_by_typ_clone.values()
.filter(|f| f.get_rect().overlaps_rect(&flst_part_rect))
.collect::<Vec<_>>();

web_sys::console::log_1(&format!("clean stage 5 3!").as_str().into());

let poly = subtract_from_poly(&flst_part.poly, &aenderungen_overlaps_polygon);

web_sys::console::log_1(&format!("clean stage 5 4!").as_str().into());

aenderungen_merged_by_typ
.entry(neue_nutzung.clone())
.and_modify(|ep: &mut SvgPolygon| {
web_sys::console::log_1(&format!("merging... {flst_part_id}").as_str().into());
*ep = join_polys(&[ep.clone(), poly.clone()]);
web_sys::console::log_1(&format!("merged {flst_part_id}!").as_str().into());

web_sys::console::log_1(&format!("merged {flst_part_id}!").as_str().into());
})
.or_insert_with(|| poly);

web_sys::console::log_1(&format!("clean stage 5 5!").as_str().into());
}

web_sys::console::log_1(&format!("clean stage 5 done!").as_str().into());

Aenderungen {
gebaeude_loeschen: changed_mut.gebaeude_loeschen.clone(),
na_definiert: changed_mut.na_definiert.clone(),
Expand Down

0 comments on commit 0d73292

Please sign in to comment.