[ui] update QML properties after changes in qtAV

This commit is contained in:
Loïc Vital 2023-03-08 08:45:19 +01:00
parent 33def1d6a5
commit 31b04092a0
4 changed files with 36 additions and 12 deletions

View file

@ -157,7 +157,7 @@ FloatingPane {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
from: -1 from: -1
to: 50 to: 50
value: root.mfeatures.timeWindow value: root.featuresViewer.timeWindow
stepSize: 1 stepSize: 1
editable: true editable: true
@ -174,7 +174,7 @@ FloatingPane {
} }
onValueChanged: { onValueChanged: {
root.mfeatures.timeWindow = timeWindowSB.value; root.featuresViewer.timeWindow = timeWindowSB.value;
} }
} }
} }
@ -224,7 +224,7 @@ FloatingPane {
ToolTip.text: "Display Tracks" ToolTip.text: "Display Tracks"
onClicked: { onClicked: {
featureType.viewer.displayTracks = tracksVisibilityButton.checked; featureType.viewer.displayTracks = tracksVisibilityButton.checked;
root.mfeatures.enableTimeWindow = tracksVisibilityButton.checked; root.featuresViewer.enableTimeWindow = tracksVisibilityButton.checked;
} }
font.pointSize: 10 font.pointSize: 10
} }
@ -232,7 +232,7 @@ FloatingPane {
MaterialToolButton { MaterialToolButton {
id: matchesVisibilityButton id: matchesVisibilityButton
checkable: true checkable: true
checked: true checked: false
text: MaterialIcons.sync text: MaterialIcons.sync
ToolTip.text: "Display Matches" ToolTip.text: "Display Matches"
onClicked: { onClicked: {
@ -244,7 +244,7 @@ FloatingPane {
MaterialToolButton { MaterialToolButton {
id: landmarksVisibilityButton id: landmarksVisibilityButton
checkable: true checkable: true
checked: true checked: false
text: MaterialIcons.fiber_manual_record text: MaterialIcons.fiber_manual_record
ToolTip.text: "Display Landmarks" ToolTip.text: "Display Landmarks"
onClicked: { onClicked: {
@ -267,9 +267,7 @@ FloatingPane {
if(featureType.viewer.loadingFeatures) if(featureType.viewer.loadingFeatures)
return featureType.viewer.describerType; return featureType.viewer.describerType;
return featureType.viewer.describerType + ": " + return featureType.viewer.describerType + ": " +
((featureExtractionNode && featureExtractionNode.isComputed) ? root.mfeatures.featuresInfo[featureType.viewer.describerType][root.mfeatures.currentViewId]['nbFeatures'] : " - ") + " / " + ((featureExtractionNode && featureExtractionNode.isComputed) ? root.mfeatures.featuresInfo[featureType.viewer.describerType][root.featuresViewer.currentViewId]['nbFeatures'] : " - ");
(root.mfeatures.haveValidTracks ? root.mfeatures.featuresInfo[featureType.viewer.describerType][root.mfeatures.currentViewId]['nbTracks'] : " - ") + " / " +
(root.mfeatures.haveValidLandmarks ? root.mfeatures.featuresInfo[featureType.viewer.describerType][root.mfeatures.currentViewId]['nbLandmarks'] : " - ");
} }
} }
// Feature loading status // Feature loading status

View file

@ -10,34 +10,53 @@ import Utils 1.0
Repeater { Repeater {
id: root id: root
/// Features to display /// Features
property var features property var features
/// Tracks
property var tracks
/// SfMData
property var sfmData
/// The list of describer types to load /// The list of describer types to load
property alias describerTypes: root.model property alias describerTypes: root.model
/// List of available feature display modes /// List of available feature display modes
readonly property var featureDisplayModes: ['Points', 'Squares', 'Oriented Squares'] readonly property var featureDisplayModes: ['Points', 'Squares', 'Oriented Squares']
/// Current feature display mode index /// Current feature display mode index
property int featureDisplayMode: 2 property int featureDisplayMode: 2
/// List of available track display modes /// List of available track display modes
readonly property var trackDisplayModes: ['Lines Only', 'Current Matches', 'All Matches'] readonly property var trackDisplayModes: ['Lines Only', 'Current Matches', 'All Matches']
/// Current track display mode index /// Current track display mode index
property int trackDisplayMode: 1 property int trackDisplayMode: 1
// Minimum feature scale score to display // Minimum feature scale score to display
property real featureMinScaleFilter: 0 property real featureMinScaleFilter: 0
// Maximum feature scale score to display // Maximum feature scale score to display
property real featureMaxScaleFilter: 1 property real featureMaxScaleFilter: 1
/// Display 3d tracks /// Display 3d tracks
property bool display3dTracks: false property bool display3dTracks: false
/// Display only contiguous tracks /// Display only contiguous tracks
property bool trackContiguousFilter: true property bool trackContiguousFilter: true
/// Display only tracks with at least one inlier /// Display only tracks with at least one inlier
property bool trackInliersFilter: false property bool trackInliersFilter: false
/// Display track endpoints /// Display track endpoints
property bool displayTrackEndpoints: true property bool displayTrackEndpoints: true
/// The list of colors used for displaying several describers /// The list of colors used for displaying several describers
property var colors: [Colors.blue, Colors.green, Colors.yellow, Colors.cyan, Colors.pink, Colors.lime] //, Colors.orange, Colors.red property var colors: [Colors.blue, Colors.green, Colors.yellow, Colors.cyan, Colors.pink, Colors.lime] //, Colors.orange, Colors.red
/// Current view ID
property var currentViewId
/// Time window
property bool enableTimeWindow: false
property int timeWindow: 1
model: root.describerTypes model: root.describerTypes
// instantiate one FeaturesViewer by describer type // instantiate one FeaturesViewer by describer type
@ -56,6 +75,11 @@ Repeater {
matchColor: Colors.orange matchColor: Colors.orange
landmarkColor: Colors.red landmarkColor: Colors.red
describerType: modelData describerType: modelData
currentViewId: root.currentViewId
enableTimeWindow: root.enableTimeWindow
timeWindow: root.timeWindow
mfeatures: root.features mfeatures: root.features
mtracks: root.tracks
msfmData: root.sfmData
} }
} }

View file

@ -548,7 +548,10 @@ FocusScope {
// instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource // instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
setSource("FeaturesViewer.qml", { setSource("FeaturesViewer.qml", {
'model': Qt.binding(function() { return activeNode ? activeNode.attribute("describerTypes").value : ""; }), 'model': Qt.binding(function() { return activeNode ? activeNode.attribute("describerTypes").value : ""; }),
'currentViewId': Qt.binding(function() { return _reconstruction.selectedViewId; }),
'features': Qt.binding(function() { return mfeaturesLoader.status === Loader.Ready ? mfeaturesLoader.item : null; }), 'features': Qt.binding(function() { return mfeaturesLoader.status === Loader.Ready ? mfeaturesLoader.item : null; }),
'tracks': Qt.binding(function() { return mtracksLoader.status === Loader.Ready ? mtracksLoader.item : null; }),
'sfmData': Qt.binding(function() { return msfmDataLoader.status === Loader.Ready ? msfmDataLoader.item : null; }),
}) })
} else { } else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
@ -725,11 +728,9 @@ FocusScope {
// instantiate and initialize a MFeatures component dynamically using Loader.setSource // instantiate and initialize a MFeatures component dynamically using Loader.setSource
// so it can fail safely if the c++ plugin is not available // so it can fail safely if the c++ plugin is not available
setSource("MFeatures.qml", { setSource("MFeatures.qml", {
'currentViewId': Qt.binding(function() { return _reconstruction.selectedViewId; }),
'describerTypes': Qt.binding(function() { return activeNode ? activeNode.attribute("describerTypes").value : {}; }), 'describerTypes': Qt.binding(function() { return activeNode ? activeNode.attribute("describerTypes").value : {}; }),
'featureFolder': Qt.binding(function() { return activeNode ? Filepath.stringToUrl(activeNode.attribute("output").value) : ""; }), 'featureFolder': Qt.binding(function() { return activeNode ? Filepath.stringToUrl(activeNode.attribute("output").value) : ""; }),
'mtracks': Qt.binding(function() { return mtracksLoader.status === Loader.Ready ? mtracksLoader.item : null; }), 'viewIds': Qt.binding(function() { return _reconstruction ? _reconstruction.allViewIds() : {}; }),
'msfmData': Qt.binding(function() { return msfmDataLoader.status === Loader.Ready ? msfmDataLoader.item : null; }),
}) })
} else { } else {

View file

@ -692,6 +692,7 @@ class Reconstruction(UIGraph):
""" Get all image paths in the reconstruction. """ """ Get all image paths in the reconstruction. """
return [vp.path.value for node in self._cameraInits for vp in node.viewpoints.value] return [vp.path.value for node in self._cameraInits for vp in node.viewpoints.value]
@Slot(result="QVariantList")
def allViewIds(self): def allViewIds(self):
""" Get all view Ids involved in the reconstruction. """ """ Get all view Ids involved in the reconstruction. """
return [vp.viewId.value for node in self._cameraInits for vp in node.viewpoints.value] return [vp.viewId.value for node in self._cameraInits for vp in node.viewpoints.value]