@@ -247,7 +247,13 @@ def save_feature_for_node_lookup(self, feature: Feature):
247
247
def features_for_anatomical_node (self , anatomical_node : AnatomicalNode , warn : bool = True ) -> Optional [tuple [AnatomicalNode , set [Feature ]]]:
248
248
#=========================================================================================================================================
249
249
if self .__feature_node_map is not None :
250
- return self .__feature_node_map .features_for_anatomical_node (anatomical_node , warn = warn )
250
+ if len ((features := self .__feature_node_map .features_for_anatomical_node (anatomical_node , warn = warn ))[1 ]) > 0 :
251
+ return features
252
+ if len (fts := set (feature for feature in self .__features_with_id .values ()
253
+ if feature .models in [features [0 ][0 ]]+ list (features [0 ][1 ])
254
+ and feature .get_property ('kind' )== 'proxy' )) > 0 :
255
+ return (anatomical_node , fts )
256
+ return features
251
257
252
258
def duplicate_feature_id (self , feature_ids : str ) -> bool :
253
259
#========================================================
@@ -299,6 +305,7 @@ def __add_proxied_features(self):
299
305
if self .__bottom_exported_layer is None :
300
306
log .warning ('No exported layer on which to add proxy features' , type = 'proxy' )
301
307
return
308
+ proxy_seqs = {}
302
309
for proxy_definition in self .__properties_store .proxies :
303
310
feature_model = proxy_definition ['feature' ]
304
311
if self .__feature_node_map .has_model (feature_model ):
@@ -308,16 +315,17 @@ def __add_proxied_features(self):
308
315
if not self .__feature_node_map .has_model (proxy_model ):
309
316
log .warning ('Proxy missing from map' , type = 'proxy' , models = feature_model , proxy = proxy_model )
310
317
for feature in self .__feature_node_map .get_features (proxy_model ):
311
- self .__add_proxy_feature (feature , feature_model )
318
+ proxy_seqs [feature .id ] = proxy_seqs .get (feature .id , - 1 ) + 1
319
+ self .__add_proxy_feature (feature , feature_model , proxy_seqs [feature .id ])
312
320
313
- def __add_proxy_feature (self , feature : Feature , feature_model : str ):
314
- #===================================================================
321
+ def __add_proxy_feature (self , feature : Feature , feature_model : str , proxy_seq : int ):
322
+ #================================================================================
315
323
if 'Polygon' not in feature .geometry .geom_type :
316
324
log .warning ('Proxy feature must have a polygon shape' , type = 'proxy' , models = feature_model , feature = feature )
317
325
elif self .__bottom_exported_layer is not None :
318
326
self .__bottom_exported_layer .add_feature (
319
- self .new_feature (self .__bottom_exported_layer .id , proxy_dot (feature .geometry ), { # type: ignore
320
- 'id' : f'proxy_on_ { feature .id } ' ,
327
+ self .new_feature (self .__bottom_exported_layer .id , proxy_dot (feature .geometry , proxy_seq ), { # type: ignore
328
+ 'id' : f'proxy_ { proxy_seq } _on_ { feature .id } ' ,
321
329
'tile-layer' : FEATURES_TILE_LAYER ,
322
330
'models' : feature_model ,
323
331
'kind' : 'proxy'
0 commit comments