[ui] add SfmLiveView Panel to control live reconstruction

This commit is contained in:
Yann Lanthony 2018-01-15 15:11:07 +01:00
parent c5039357f7
commit 13c22dc884
3 changed files with 147 additions and 11 deletions

View file

@ -0,0 +1,110 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import MaterialIcons 2.2
import Qt.labs.platform 1.0 as Platform // for FileDialog
/**
* LiveSfMView provides controls for setting up and starting a live reconstruction.
*/
Panel {
id: root
property variant reconstruction
readonly property variant liveSfmManager: reconstruction.liveSfmManager
signal requestGraphAutoLayout()
title: "Live Reconstruction"
icon: Label {
text: MaterialIcons.linked_camera;
font.family: MaterialIcons.fontFamily;
font.pixelSize: 13
}
padding: 2
clip: true
Connections {
target: root.liveSfmManager
// Request graph auto-layout when an augmentation step is added for readability
onStepCreated: requestGraphAutoLayout()
}
Platform.FolderDialog {
id: selectFolderDialog
title: "Live Reconstruction - Select Image Folder"
onAccepted: {
folderPath.text = folder.toLocaleString().replace("file://", "")
}
}
// Options
Pane {
width: parent.width
Layout.alignment: Qt.AlignTop
ColumnLayout {
width: parent.width
GroupBox {
Layout.fillWidth: true
enabled: !liveSfmManager.running
GridLayout {
width: parent.width
columnSpacing: 12
columns: 2
Label {
text: "Image Folder"
}
RowLayout {
Layout.fillWidth: true
spacing: 0
TextField {
id: folderPath
Layout.fillWidth: true
selectByMouse: true
text: liveSfmManager.folder
placeholderText: "Select a Folder"
}
ToolButton {
text: MaterialIcons.folder
font.family: MaterialIcons.fontFamily
onClicked: selectFolderDialog.open()
ToolTip.text: "Select Folder in which Images will be progressively added for Live Reconstruction"
ToolTip.visible: hovered
ToolTip.delay: 200
}
}
Label {
text: "Min. Images per Step"
}
SpinBox {
id: minImg_SB
editable: true
from: 2
value: 4
to: 50
implicitWidth: 50
}
}
}
Button {
Layout.alignment: Qt.AlignCenter
text: checked ? "Stop" : "Start"
enabled: liveSfmManager.running || folderPath.text.trim() != ''
checked: liveSfmManager.running
onClicked: {
if(!liveSfmManager.running)
liveSfmManager.start(folderPath.text, minImg_SB.value)
else
liveSfmManager.stop()
}
}
}
}
}

View file

@ -26,6 +26,8 @@ Item {
onMeshFileChanged: viewer3D.clear()
signal requestGraphAutoLayout()
// Load a 3D media file in the 3D viewer
function load3DMedia(filepath)
{
@ -40,19 +42,29 @@ Item {
Controls1.SplitView {
anchors.fill: parent
ImageGallery {
id: imageGallery
Controls1.SplitView {
orientation: Qt.Vertical
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumWidth: defaultCellSize
cameraInits: root.cameraInits
cameraInit: _reconstruction.cameraInit
currentIndex: reconstruction.cameraInitIndex
onCurrentIndexChanged: reconstruction.cameraInitIndex = currentIndex
onRemoveImageRequest: reconstruction.removeAttribute(attribute)
onFilesDropped: reconstruction.handleFilesDrop(drop, cameraInit)
}
Layout.minimumWidth: imageGallery.defaultCellSize
ImageGallery {
id: imageGallery
Layout.fillHeight: true
cameraInits: root.cameraInits
cameraInit: _reconstruction.cameraInit
currentIndex: reconstruction.cameraInitIndex
onCurrentIndexChanged: reconstruction.cameraInitIndex = currentIndex
onRemoveImageRequest: reconstruction.removeAttribute(attribute)
onFilesDropped: reconstruction.handleFilesDrop(drop, cameraInit)
}
LiveSfmView {
visible: settings_UILayout.showLiveReconstruction
reconstruction: root.reconstruction
Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height
onRequestGraphAutoLayout: graphEditor.doAutoLayout()
}
}
Panel {
title: "Image Viewer"
Layout.fillHeight: true

View file

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Window 2.3
import QtQml.Models 2.2
import Qt.labs.platform 1.0 as Platform
import Qt.labs.settings 1.0
import GraphEditor 1.0
import MaterialIcons 2.2
import "filepath.js" as Filepath
@ -33,6 +34,11 @@ ApplicationWindow {
SystemPalette { id: palette }
SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled}
Settings {
id: settings_UILayout
category: 'UILayout'
property alias showLiveReconstruction: liveSfMVisibilityCB.checked
}
Dialog {
id: unsavedDialog
@ -256,6 +262,13 @@ ApplicationWindow {
}
Menu {
title: "View"
MenuItem {
id: liveSfMVisibilityCB
text: "Live Reconstruction"
checkable: true
checked: false
}
MenuSeparator {}
Action {
text: "Fullscreen"
checkable: true
@ -331,6 +344,7 @@ ApplicationWindow {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: 50
onRequestGraphAutoLayout: graphEditor.doAutoLayout()
}
}
Panel {