Skip to content

Commit ca2b1cf

Browse files
bugfix for representation context
1 parent b9e4f35 commit ca2b1cf

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

energyml-utils/src/energyml/utils/data/representation_context.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def collect_graphical_info(obj: Any, workspace: EnergymlStorageInterface) -> dic
2121
return collect_graphical_info_from_rels(rels, obj_uuid, workspace)
2222

2323
def collect_graphical_info_from_rels(rels: List[Relationship], obj_uuid: str, workspace: EnergymlStorageInterface) -> dict:
24-
graphical_info = {}
24+
graphical_info_result = {}
2525
# Collect graphical information entries whose target matches this representation
2626
for r in rels:
2727
if "GraphicalInformationSet" in r.target:
@@ -39,11 +39,11 @@ def collect_graphical_info_from_rels(rels: List[Relationship], obj_uuid: str, wo
3939
for target_dor in target_dors:
4040
target_dor_uuid = get_obj_uuid(target_dor)
4141
if target_dor_uuid == obj_uuid:
42-
if graphical_info_set_uri not in graphical_info:
43-
graphical_info[graphical_info_set_uri] = []
44-
graphical_info[graphical_info_set_uri].append(graphical_info)
42+
if graphical_info_set_uri not in graphical_info_result:
43+
graphical_info_result[graphical_info_set_uri] = []
44+
graphical_info_result[graphical_info_set_uri].append(graphical_info)
4545
break
46-
return graphical_info
46+
return graphical_info_result
4747

4848

4949
class RepresentationContext(BaseModel):
@@ -128,7 +128,7 @@ def get_default_color(self) -> ScalarRenderingInfo:
128128
except Exception as exc:
129129
logging.debug(f"Error reading graphical rendering info for entry {entry}: {exc}")
130130
# No color information found, generate a random color from uuid
131-
return ScalarRenderingInfo(constant_color=RgbaColor.random_from_uuid(self.uri.uuid))
131+
return ScalarRenderingInfo(target_obj_uuid=self.uri.uuid, constant_color=RgbaColor.random_from_uuid(self.uri.uuid))
132132

133133
def get_property(self, property_uuid: str) -> Optional[Any]:
134134
"""Return the property object with the given uuid, or None."""

0 commit comments

Comments
 (0)