[ui] ImageGallery: introduce IntrinsicsIndicator

New IntrinsicsIndicator component that displays the initialization mode of each Viewpoint's intrinsic with explanatory tooltip.
This commit is contained in:
Yann Lanthony 2019-01-21 10:35:29 +01:00
parent 7db38abdf0
commit 663a5d679d
5 changed files with 144 additions and 24 deletions

View file

@ -514,6 +514,38 @@ class Reconstruction(UIGraph):
allIntrinsicIds = [i.intrinsicId.value for i in self._cameraInit.intrinsics.value]
return viewpoint.intrinsicId.value in allIntrinsicIds
@Slot(QObject, result=QObject)
def getIntrinsic(self, viewpoint):
"""
Get the intrinsic attribute associated to 'viewpoint' based on its intrinsicId.
Args:
viewpoint (Attribute): the Viewpoint to consider.
Returns:
Attribute: the Viewpoint's corresponding intrinsic or None if not found.
"""
return next((i for i in self._cameraInit.intrinsics.value if i.intrinsicId.value == viewpoint.intrinsicId.value)
, None)
@Slot(QObject, result=str)
def getIntrinsicInitMode(self, viewpoint):
"""
Get the initialization mode for the intrinsic associated to 'viewpoint'.
Args:
viewpoint (Attribute): the Viewpoint to consider.
Returns:
str: the initialization mode of the Viewpoint's intrinsic or an empty string if none.
"""
intrinsic = self.getIntrinsic(viewpoint)
if not intrinsic:
return ""
try:
return intrinsic.initializationMode.value
except AttributeError:
# handle older versions that did not have this attribute
return ""
@Slot(QObject, result=bool)
def hasMetadata(self, viewpoint):
# Should be greater than 2 to avoid the particular case of ""