[ui] ImageGallery: display metadata and lens status flag

This commit is contained in:
Fabien Castan 2018-07-23 17:43:47 +02:00 committed by Yann Lanthony
parent 86fa806f65
commit 51995f47e4
2 changed files with 67 additions and 13 deletions

View file

@ -107,22 +107,65 @@ Panel {
onRemoveRequest: sendRemoveRequest()
Keys.onDeletePressed: sendRemoveRequest()
// Reconstruction status indicator
Label {
id: statusIndicator
// object can be evaluated to null at some point during creation/deletion
property bool inViews: Qt.isQtObject(object) && _reconstruction.sfmReport && _reconstruction.isInViews(object)
property bool reconstructed: inViews && _reconstruction.isReconstructed(model.object)
font.family: MaterialIcons.fontFamily
text: reconstructed ? MaterialIcons.check_circle : MaterialIcons.remove_circle
color: reconstructed ? "#4CAF50" : "#F44336"
Row {
anchors.top: parent.top
anchors.right: parent.right
anchors.margins: 10
font.pointSize: 10
visible: inViews
// Lens recognized
ToolButton {
id: metadataIndicator
// object can be evaluated to null at some point during creation/deletion
property bool valid: Qt.isQtObject(object)
property bool hasMetadata: _reconstruction.hasMetadata(model.object)
contentItem: Label {
font.family: MaterialIcons.fontFamily
text: MaterialIcons.info_outline
color: parent.hasMetadata ? "#4CAF50" : "#F44336"
font.pointSize: 10
}
ToolTip.text: hasMetadata ? "Has Metadata" : "Missing Metadata"
ToolTip.visible: pressed
visible: valid && !hasMetadata
}
// Lens recognized
ToolButton {
id: lensIndicator
// object can be evaluated to null at some point during creation/deletion
property bool valid: Qt.isQtObject(object)
property bool hasValidIntrinsic: _reconstruction.hasValidIntrinsic(model.object)
contentItem: Label {
font.family: MaterialIcons.fontFamily
text: MaterialIcons.warning
color: "#F44336"
font.pointSize: 10
}
visible: valid && !hasValidIntrinsic
ToolTip.text: "Unable to find camera intrinsic parameters.\nCheck image metadata."
ToolTip.visible: pressed
}
// Reconstruction status indicator
ToolButton {
id: statusIndicator
// object can be evaluated to null at some point during creation/deletion
property bool inViews: Qt.isQtObject(object) && _reconstruction.sfmReport && _reconstruction.isInViews(object)
property bool reconstructed: inViews && _reconstruction.isReconstructed(model.object)
contentItem: Label {
font.family: MaterialIcons.fontFamily
text: parent.reconstructed ? MaterialIcons.check_circle : MaterialIcons.remove_circle
color: parent.reconstructed ? "#4CAF50" : "#F44336"
font.pointSize: 10
}
ToolTip.text: reconstructed ? "Reconstructed" : "Not Reconstructed"
ToolTip.visible: pressed
visible: inViews
}
}
}
}

View file

@ -495,6 +495,17 @@ class Reconstruction(UIGraph):
# keys are strings (faster lookup)
return str(viewpoint.poseId.value) in self._poses
@Slot(QObject, result=bool)
def hasValidIntrinsic(self, viewpoint):
# keys are strings (faster lookup)
allIntrinsicIds = [i.intrinsicId.value for i in self._cameraInit.intrinsics.value]
return viewpoint.intrinsicId.value in allIntrinsicIds
@Slot(QObject, result=bool)
def hasMetadata(self, viewpoint):
# Should be greater than 2 to avoid the particular case of ""
return len(viewpoint.metadata.value) > 2
def setSelectedViewId(self, viewId):
if viewId == self._selectedViewId:
return