@@ -352,6 +352,7 @@ def processAlgorithm(self, parameters, context, feedback):
352
352
file_transects = self .parameterAsString (parameters , self .FILE_TRANSECTS , context )
353
353
file_streets = self .parameterAsString (parameters , self .FILE_STREETS , context )
354
354
355
+
355
356
# options table
356
357
if file_options != '' :
357
358
raw_data_dict ['options_df' ] = read_data_from_table_direct (
@@ -448,6 +449,42 @@ def get_annotations_from_raw_df(df_raw):
448
449
)
449
450
options_df , main_infiltration_method = get_options_from_table (raw_data_dict ['options_df' ].copy ())
450
451
inp_dict ['OPTIONS' ] = {'data' : options_df }
452
+
453
+
454
+ # main handler
455
+ def layers_export_handler (section ):
456
+ # data/section in raw_data_dict.keys?
457
+ # check columns
458
+ ## what to check
459
+ if tables :
460
+ cols_to_check = list (def_tables_dict [section ]['tables' ][subtable ].keys ())
461
+ f_name = str (section )+ ' file' # replace with filename
462
+ else :
463
+ cols_to_check = list (def_qgis_fields_dict [section ].keys ())
464
+ check_columns (
465
+ f_name ,
466
+ cols_to_check ,
467
+ raw_data_dict ['options_df' ].keys ()
468
+ )
469
+ # data preparation
470
+ processed_df = None
471
+ if geometry :
472
+ # extract geometry
473
+ sections_coords = get_coords_from_geometry (raw_df )
474
+ use_z_if_available ()
475
+ adjust_geometry ()
476
+ # annotations
477
+ annotations_df = get_annotations_from_raw_df (
478
+ raw_data_dict ['conduits_raw' ].copy ()
479
+ )
480
+ if annotations_df is not None :
481
+ annotations = True
482
+ else :
483
+ annotations = False
484
+ # write to inp dict
485
+ inp_dict [section ] = {'data' : processed_df }
486
+ if annotations :
487
+ inp_dict [section ]['annotations' ] = annotations_df
451
488
452
489
# subcatchments
453
490
if 'subcatchments_raw' in raw_data_dict .keys ():
@@ -496,7 +533,7 @@ def get_annotations_from_raw_df(df_raw):
496
533
conduits_verts ,
497
534
use_z_bool ,
498
535
feedback ,
499
- 'Lines ' ,
536
+ 'lines ' ,
500
537
layer_name = 'conduits_layer'
501
538
)
502
539
conduits_verts = {k : del_first_last_vt (v ) for k , v in conduits_verts .items () if len (v ) > 2 } # first and last vertices are in nodes coordinates anyway
@@ -525,6 +562,7 @@ def get_annotations_from_raw_df(df_raw):
525
562
pumps_verts ,
526
563
False ,
527
564
feedback ,
565
+ geom_type = 'lines'
528
566
)
529
567
pumps_verts = {k : del_first_last_vt (v ) for k , v in pumps_verts .items () if len (v ) > 2 }
530
568
pumps_inp_cols = def_sections_dict ['PUMPS' ]
@@ -548,6 +586,7 @@ def get_annotations_from_raw_df(df_raw):
548
586
weirs_verts ,
549
587
False ,
550
588
feedback ,
589
+ geom_type = 'lines'
551
590
)
552
591
weirs_verts = {k : del_first_last_vt (v ) for k , v in weirs_verts .items () if len (v ) > 2 } # first and last vertices are in nodes coordinates anyway
553
592
inp_dict ['VERTICES' ]['data' ].update (weirs_verts )
@@ -578,6 +617,7 @@ def get_annotations_from_raw_df(df_raw):
578
617
outlets_verts ,
579
618
False ,
580
619
feedback ,
620
+ geom_type = 'lines'
581
621
)
582
622
outlets_verts = {k : del_first_last_vt (v ) for k , v in outlets_verts .items () if len (v ) > 2 }
583
623
inp_dict ['VERTICES' ]['data' ].update (outlets_verts )
@@ -611,6 +651,7 @@ def get_annotations_from_raw_df(df_raw):
611
651
orifices_verts ,
612
652
False ,
613
653
feedback ,
654
+ geom_type = 'lines'
614
655
)
615
656
orifices_verts = {k : del_first_last_vt (v ) for k , v in orifices_verts .items () if len (v ) > 2 } # first and last vertices are in nodes coordinates anyway
616
657
inp_dict ['VERTICES' ]['data' ].update (orifices_verts )
@@ -647,8 +688,7 @@ def get_annotations_from_raw_df(df_raw):
647
688
junctions_annot = get_annotations_from_raw_df (
648
689
raw_data_dict ['junctions_raw' ].copy ()
649
690
)
650
- junctions_df ['X_Coord' ], junctions_df ['Y_Coord' ] = get_coords_from_geometry (junctions_df )
651
- junctions_coords = junctions_df [['Name' , 'X_Coord' , 'Y_Coord' ]]
691
+ junctions_coords = get_coords_from_geometry (junctions_df )
652
692
junctions_inp_cols = def_sections_dict ['JUNCTIONS' ]
653
693
junctions_df , junctions_coords = use_z_if_available (
654
694
junctions_df ,
@@ -678,8 +718,7 @@ def get_annotations_from_raw_df(df_raw):
678
718
)
679
719
from .g_s_nodes import get_outfalls_from_shapefile
680
720
outfalls_df = get_outfalls_from_shapefile (raw_data_dict ['outfalls_raw' ].copy ())
681
- outfalls_df ['X_Coord' ], outfalls_df ['Y_Coord' ] = get_coords_from_geometry (outfalls_df )
682
- outfalls_coords = outfalls_df [['Name' , 'X_Coord' , 'Y_Coord' ]]
721
+ outfalls_coords = get_coords_from_geometry (outfalls_df )
683
722
outfalls_annot = get_annotations_from_raw_df (
684
723
raw_data_dict ['outfalls_raw' ].copy ()
685
724
)
0 commit comments