Skip to content

Commit

Permalink
Merge pull request #66 from opengisch/structure_strength
Browse files Browse the repository at this point in the history
COMPOSITION strength relation on STRUCTURE childs
  • Loading branch information
signedav authored Sep 7, 2023
2 parents fa6c84a + e5cff01 commit 69cb62b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modelbaker/generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def relations(self, layers, filter_layer_list=[]):
relation.strength = (
QgsRelation.Composition
if "strength" in record
and record["strength"] == "COMPOSITE"
and record["strength"] == "COMPOSITE" or referencing_layer.is_structure
else QgsRelation.Association
)
relation.cardinality_max = record.get("cardinality_max", None)
Expand Down
9 changes: 9 additions & 0 deletions tests/test_projectgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4204,6 +4204,15 @@ def test_relation_editor_widget_for_no_geometry_layers(self):

assert count == 1

count = 0
# when the referencing layer is a structure, it should be a composition
for relation in relations:
if relation.referencing_layer.name == "maphierref":
assert relation.strength == QgsRelation.Composition
count += 1

assert count == 2

def print_info(self, text):
logging.info(text)

Expand Down

0 comments on commit 69cb62b

Please sign in to comment.