@@ -3243,16 +3243,32 @@ def _export_label_positions(self):
3243
3243
"vw_tww_wastewater_structure" : {},
3244
3244
"catchment_area" : {},
3245
3245
}
3246
+
3246
3247
for row in self .abwasser_session .query (self .model_classes_interlis .haltung ):
3247
3248
tid_for_obj_id ["vw_tww_reach" ][row .t_ili_tid ] = row .t_id
3248
3249
for row in self .abwasser_session .query (
3249
3250
self .model_classes_interlis .abwasserbauwerk
3250
3251
):
3251
3252
tid_for_obj_id ["vw_tww_wastewater_structure" ][row .t_ili_tid ] = row .t_id
3252
- for row in self .abwasser_session .query (
3253
- self .model_classes_interlis .einzugsgebiet
3254
- ):
3255
- tid_for_obj_id ["catchment_area" ][row .t_ili_tid ] = row .t_id
3253
+
3254
+ if self .model in [config .MODEL_NAME_DSS ,config .MODEL_NAME_AG96 ]:
3255
+ for row in self .abwasser_session .query (self .model_classes_interlis .einzugsgebiet ):
3256
+ tid_for_obj_id ["catchment_area" ][row .t_ili_tid ] = row .t_id
3257
+
3258
+ if self .is_ag_xx_model :
3259
+ tid_for_obj_id .update ({
3260
+ "building_group" : {},
3261
+ "measure_line" : {},
3262
+ "measure_point" : {},
3263
+ "measure_polygon" : {},
3264
+ })
3265
+ for row in self .abwasser_session .query (self .model_classes_interlis .bautenausserhalbbaugebiet ):
3266
+ tid_for_obj_id ["building_group" ][row .t_ili_tid ] = row .t_id
3267
+ for row in self .abwasser_session .query (self .model_classes_interlis .gepmassnahme ):
3268
+ tid_for_obj_id ["measure_line" ][row .t_ili_tid ] = row .t_id
3269
+ tid_for_obj_id ["measure_point" ][row .t_ili_tid ] = row .t_id
3270
+ tid_for_obj_id ["measure_polygon" ][row .t_ili_tid ] = row .t_id
3271
+
3256
3272
3257
3273
with open (self .labels_file ) as labels_file_handle :
3258
3274
labels = json .load (labels_file_handle )
@@ -3267,7 +3283,7 @@ def _export_label_positions(self):
3267
3283
3268
3284
if self .subset_ids and obj_id not in self .subset_ids :
3269
3285
logger .warning (
3270
- f"Label for { layer_name } `{ obj_id } ` exists, but that object is not part of the export"
3286
+ f"Label for { layer_name } `{ obj_id } ` exists, but that object is not part of the subset export"
3271
3287
)
3272
3288
continue
3273
3289
@@ -3284,43 +3300,96 @@ def _export_label_positions(self):
3284
3300
)
3285
3301
continue
3286
3302
3287
- if layer_name == "vw_tww_reach" :
3288
- ili_label = self .model_classes_interlis .haltung_text (
3289
- ** self ._textpos_common (
3290
- label , "haltung_text" , geojson_crs_def , "RX" , self .oid_prefix
3291
- ),
3292
- haltungref = t_id ,
3293
- )
3294
-
3295
- elif layer_name == "vw_tww_wastewater_structure" :
3296
- ili_label = self .model_classes_interlis .abwasserbauwerk_text (
3297
- ** self ._textpos_common (
3298
- label ,
3299
- "abwasserbauwerk_text" ,
3300
- geojson_crs_def ,
3301
- "WX" ,
3302
- self .oid_prefix ,
3303
- ),
3304
- abwasserbauwerkref = t_id ,
3305
- )
3303
+ if not self .is_ag_xx_model :
3304
+ if layer_name == "vw_tww_reach" :
3305
+ ili_label = self .model_classes_interlis .haltung_text (
3306
+ ** self ._textpos_common (label , "haltung_text" , geojson_crs_def , "RX" , self .oid_prefix ),
3307
+ haltungref = t_id ,
3308
+ )
3306
3309
3307
- elif layer_name == "catchment_area" :
3308
- ili_label = self .model_classes_interlis .einzugsgebiet_text (
3309
- ** self ._textpos_common (
3310
- label ,
3311
- "einzugsgebiet_text" ,
3312
- geojson_crs_def ,
3313
- "CX" ,
3314
- self .oid_prefix ,
3315
- ),
3316
- einzugsgebietref = t_id ,
3317
- )
3310
+ elif layer_name == "vw_tww_wastewater_structure" :
3311
+ ili_label = self .model_classes_interlis .abwasserbauwerk_text (
3312
+ ** self ._textpos_common (label , "abwasserbauwerk_text" , geojson_crs_def , "WX" , self .oid_prefix ),
3313
+ abwasserbauwerkref = t_id ,
3314
+ )
3318
3315
3316
+ elif layer_name == "catchment_area" :
3317
+ ili_label = self .model_classes_interlis .einzugsgebiet_text (
3318
+ ** self ._textpos_common (label , "einzugsgebiet_text" , geojson_crs_def , "CX" , self .oid_prefix ),
3319
+ einzugsgebietref = t_id ,
3320
+ )
3321
+ else :
3322
+ logger .warning (
3323
+ f"Unknown layer `{ layer_name } ` for label with id '{ obj_id } '. Label will be ignored" ,
3324
+ )
3325
+ continue
3319
3326
else :
3320
- logger .warning (
3321
- f"Unknown layer `{ layer_name } ` for label with id '{ obj_id } '. Label will be ignored" ,
3322
- )
3323
- continue
3327
+ if self .model == config .MODEL_NAME_AG64 :
3328
+ if layer_name == "vw_tww_reach" :
3329
+ ili_label = self .model_classes_interlis .haltung_text (
3330
+ ** self ._textpos_common (label , "infrastrukturhaltung_text" , geojson_crs_def , "RX" , self .oid_prefix ),
3331
+ infrastrukturhaltung = t_id ,
3332
+ )
3333
+
3334
+ elif layer_name == "vw_tww_wastewater_structure" :
3335
+ ili_label = self .model_classes_interlis .abwasserbauwerk_text (
3336
+ ** self ._textpos_common (label , "infrastrukturknoten_text" , geojson_crs_def , "WX" , self .oid_prefix ),
3337
+ infrastrukturknotenref = t_id ,
3338
+ )
3339
+
3340
+ else :
3341
+ logger .warning (
3342
+ f"Unknown layer `{ layer_name } ` for label with id '{ obj_id } '. Label will be ignored" ,
3343
+ )
3344
+ continue
3345
+ else : # AG-96
3346
+ if layer_name == "vw_tww_reach" :
3347
+ ili_label = self .model_classes_interlis .haltung_text (
3348
+ ** self ._textpos_common (label , "gephaltung_text" , geojson_crs_def , "RX" , self .oid_prefix ),
3349
+ gephaltungref = t_id ,
3350
+ )
3351
+
3352
+ elif layer_name == "vw_tww_wastewater_structure" :
3353
+ ili_label = self .model_classes_interlis .abwasserbauwerk_text (
3354
+ ** self ._textpos_common (label , "gepknoten_text" , geojson_crs_def , "WX" , self .oid_prefix ),
3355
+ gepknotenref = t_id ,
3356
+ )
3357
+
3358
+ elif layer_name == "catchment_area" :
3359
+ ili_label = self .model_classes_interlis .einzugsgebiet_text (
3360
+ ** self ._textpos_common (label , "einzugsgebiet_text" , geojson_crs_def , "CX" , self .oid_prefix ),
3361
+ einzugsgebietref = t_id ,
3362
+ )
3363
+
3364
+ elif layer_name == "building_group" :
3365
+ ili_label = self .model_classes_interlis .bautenausserhalbbaugebiet_text (
3366
+ ** self ._textpos_common (label , "bautenausserhalbbaugebiet_text" , geojson_crs_def , "BX" , self .oid_prefix ),
3367
+ bautenausserhalbbaugebietref = t_id ,
3368
+ )
3369
+
3370
+ elif layer_name == "measure_line" :
3371
+ ili_label = self .model_classes_interlis .gepmassnahme_text (
3372
+ ** self ._textpos_common (label , "gepmassnahme_text" , geojson_crs_def , "MX" , self .oid_prefix ),
3373
+ gepmassnahmeref = t_id ,
3374
+ )
3375
+
3376
+ elif layer_name == "measure_point" :
3377
+ ili_label = self .model_classes_interlis .gepmassnahme_text (
3378
+ ** self ._textpos_common (label , "gepmassnahme_text" , geojson_crs_def , "MX" , self .oid_prefix ),
3379
+ gepmassnahmeref = t_id ,
3380
+ )
3381
+
3382
+ elif layer_name == "measure_polygon" :
3383
+ ili_label = self .model_classes_interlis .gepmassnahme_text (
3384
+ ** self ._textpos_common (label , "gepmassnahme_text" , geojson_crs_def , "MX" , self .oid_prefix ),
3385
+ gepmassnahmeref = t_id ,
3386
+ )
3387
+
3388
+ else :
3389
+ logger .warning (
3390
+ f"Unknown layer { layer_name } for label with id '{ obj_id } '. Label will be ignored" ,
3391
+ )
3392
+ continue
3324
3393
3325
3394
self .abwasser_session .add (ili_label )
3326
3395
print ("." , end = "" )
0 commit comments