[Float Image Viewer] Change viewer type with switch case on EViewerType

This commit is contained in:
Thomas Zorroche 2021-06-11 10:09:08 +02:00 committed by Fabien Castan
parent 266aee8d40
commit b81e68523f
3 changed files with 23 additions and 26 deletions

View file

@ -40,11 +40,28 @@ AliceVision.FloatImageViewer {
}
property string channelModeString : "rgba"
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
}
}
property string viewerTypeString : "default"
property bool isDistoViewer: false;
property bool isPanoViewer: false;
property string viewerTypeString : "hdr"
surface.viewerType: {
switch(viewerTypeString)
{
case "hdr": return AliceVision.Surface.EViewerType.HDR;
case "distortion": return AliceVision.Surface.EViewerType.DISTORTION;
case "panorama": return AliceVision.Surface.EViewerType.PANORAMA;
default: return AliceVision.Surface.EViewerType.HDR;
}
}
property bool isPrincipalPointsDisplayed : false;
property int pointsNumber: (surface.subdivisions + 1) * (surface.subdivisions + 1);
@ -63,26 +80,6 @@ AliceVision.FloatImageViewer {
ppRect.y = pp.y;
}
onIsDistoViewerChanged: {
surface.viewerType = AliceVision.Surface.EViewerType.DISTORTION;
}
onIsPanoViewerChanged: {
surface.viewerType = AliceVision.Surface.EViewerType.PANORAMA;
}
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

View file

@ -222,7 +222,7 @@ AliceVision.PanoramaViewer {
onActiveChanged: {
if(active) {
setSource("FloatImage.qml", {
'isPanoViewer' : true,
'viewerTypeString' : 'panorama',
'surface.subdivisions': Qt.binding(function() { return subdivisionsPano; }),
'source': Qt.binding(function() { return cSource; }),
'index' : index,

View file

@ -278,7 +278,7 @@ FocusScope {
'surface.gridOpacity' : Qt.binding(function(){ return lensDistortionImageToolbar.opacityValue;}),
'surface.gridColor' : Qt.binding(function(){ return lensDistortionImageToolbar.color;}),
'surface.subdivisions' : Qt.binding(function(){ return lensDistortionImageToolbar.subdivisionsValue;}),
'isDistoViewer' : Qt.binding(function(){ return displayLensDistortionViewer.checked;}),
'viewerTypeString': Qt.binding(function(){ return displayLensDistortionViewer.checked ? "distortion" : "hdr";}),
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14