[PanoramaViewer] add Panorama Viewer button and loader

This commit is contained in:
Landrodie 2021-01-20 14:53:57 +01:00 committed by Fabien Castan
parent 77f6cdee3e
commit 3ee49d11d2
2 changed files with 41 additions and 32 deletions

View file

@ -25,25 +25,11 @@ AliceVision.PanoramaViewer {
(root.sourceSize.height <= 0) ||
(root.sourceSize.width <= 0))
return Image.Null;
root.defaultControlPoints();
console.warn("Panorama is ready")
return Image.Ready;
}
channelMode: {
switch(channelModeString)
{
case "rgb": return AliceVision.FloatImageViewer.EChannelMode.RGB
case "r": return AliceVision.FloatImageViewer.EChannelMode.R
case "g": return AliceVision.FloatImageViewer.EChannelMode.G
case "b": return AliceVision.FloatImageViewer.EChannelMode.B
case "a": return AliceVision.FloatImageViewer.EChannelMode.A
default: return AliceVision.FloatImageViewer.EChannelMode.RGBA
}
}
clearBeforeLoad: true
property alias containsMouse: mouseArea.containsMouse
@ -57,21 +43,4 @@ AliceVision.PanoramaViewer {
acceptedButtons: Qt.NoButton
}
Item {
id: points
width: root.width
height: root.height
Connections {
target: root
onVerticesChanged : {
if (reinit){
grid.recalculateCP();
grid.generateControlPoints();
}
}
}
}
}

View file

@ -17,6 +17,7 @@ FocusScope {
property Component panoramaViewerComp: Qt.createComponent("PanoramaViewer.qml")
property alias useFloatImageViewer: displayHDR.checked
property alias useLensDistortionViewer: displayLensDistortionViewer.checked
property alias usePanoramaViewer: displayPanoramaViewer.checked
Loader {
id: aliceVisionPluginLoader
@ -244,6 +245,25 @@ FocusScope {
}
// qtAliceVision Panorama Viewer
Loader {
id: panoramaViewerLoader
active: root.aliceVisionPluginAvailable && root.usePanoramaViewer && !floatImageViewerLoader.active
visible: (panoramaViewerLoader.status === Loader.Ready)
anchors.centerIn: parent
onActiveChanged: {
if(active) {
setSource("PanoramaViewer.qml", {
'source': Qt.binding(function() { return getImageFile(imageType.type); }),
'channelModeString': Qt.binding(function() { return lensDistortionImageToolbar.channelModeValue; }), })
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
}
}
}
// Simple QML Image Viewer (using Qt or qtOIIO to load images)
Loader {
id: qtImageViewerLoader
@ -279,6 +299,7 @@ FocusScope {
}
}
property var image: {
//qtImageViewerLoader.active ? qtImageViewerLoader.item : floatImageViewerLoader.item
if (floatImageViewerLoader.active)
@ -742,6 +763,25 @@ FocusScope {
}
}
}
MaterialToolButton {
id: displayPanoramaViewer
// property var activeNode: root.aliceVisionPluginAvailable ? _reconstruction.activeNodes.get('sfm').node : null
// property bool isComputed: activeNode && activeNode.isComputed
ToolTip.text: "Panorama Viewer"
text: MaterialIcons.panorama_wide_angle
font.pointSize: 16
padding: 0
Layout.minimumWidth: 0
checkable: true
checked: false
enabled: root.aliceVisionPluginAvailable
onCheckedChanged : {
// if(displayHDR.checked && checked){
// displayHDR.checked = false;
// }
}
}
MaterialToolButton {
id: displayFeatures
ToolTip.text: "Display Features"