[Viewer] Clean-up: Harmonize syntax across all the files

This commit is contained in:
Candice Bentéjac 2023-10-17 12:46:57 +02:00
parent 9d2974d282
commit 13b8266d14
15 changed files with 488 additions and 562 deletions

View file

@ -38,17 +38,14 @@ FloatingPane {
// note: We need to use csvData.getNbColumns() slot instead of the csvData.nbColumns property to avoid a crash on linux.
property bool crfReady: csvData && csvData.ready && (csvData.getNbColumns() >= 4)
onCrfReadyChanged: {
if(crfReady)
{
if (crfReady) {
redCurve.clear()
greenCurve.clear()
blueCurve.clear()
csvData.getColumn(1).fillChartSerie(redCurve)
csvData.getColumn(2).fillChartSerie(greenCurve)
csvData.getColumn(3).fillChartSerie(blueCurve)
}
else
{
} else {
redCurve.clear()
greenCurve.clear()
blueCurve.clear()

View file

@ -51,7 +51,7 @@ Item {
property bool controlModifierEnabled: false
onPositionChanged: {
mArea.controlModifierEnabled = (mouse.modifiers & Qt.ControlModifier)
mouse.accepted = false;
mouse.accepted = false
}
acceptedButtons: Qt.LeftButton
hoverEnabled: true
@ -59,19 +59,19 @@ Item {
drag.onActiveChanged: {
if (!drag.active) {
root.moved(circle.x - (root.width - circle.width) / 2, circle.y - (root.height - circle.height) / 2);
root.moved(circle.x - (root.width - circle.width) / 2, circle.y - (root.height - circle.height) / 2)
}
}
onPressed: {
forceActiveFocus();
forceActiveFocus()
}
onWheel: {
mArea.controlModifierEnabled = (wheel.modifiers & Qt.ControlModifier)
if (wheel.modifiers & Qt.ControlModifier) {
root.incrementRadius(wheel.angleDelta.y / 120.0);
wheel.accepted = true;
root.incrementRadius(wheel.angleDelta.y / 120.0)
wheel.accepted = true
} else {
wheel.accepted = false;
wheel.accepted = false
}
}
}

View file

@ -17,60 +17,60 @@ Item {
property var ccheckers: []
property int selectedCChecker: -1
Component.onCompleted: { readSourceFile(); }
onSourceChanged: { readSourceFile(); }
onViewpointChanged: { loadCCheckers(); }
Component.onCompleted: { readSourceFile() }
onSourceChanged: { readSourceFile() }
onViewpointChanged: { loadCCheckers() }
property var updatePane: null
function getColors() {
if (ccheckers[selectedCChecker] === undefined)
return null;
return null
if (ccheckers[selectedCChecker].colors === undefined)
return null;
return null
return ccheckers[selectedCChecker].colors;
return ccheckers[selectedCChecker].colors
}
function readSourceFile() {
var xhr = new XMLHttpRequest;
var xhr = new XMLHttpRequest
// console.warn("readSourceFile: " + root.source)
xhr.open("GET", root.source);
xhr.open("GET", root.source)
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status == 200) {
try {
root.json = null;
root.json = null
// console.warn("readSourceFile: update json from " + root.source)
root.json = JSON.parse(xhr.responseText);
root.json = JSON.parse(xhr.responseText)
// console.warn("readSourceFile: root.json.checkers.length=" + root.json.checkers.length)
}
catch(exc)
{
console.warn("Failed to parse ColorCheckerDetection JSON file: " + source);
return;
} catch(exc) {
console.warn("Failed to parse ColorCheckerDetection JSON file: " + source)
return
}
}
loadCCheckers();
};
xhr.send();
loadCCheckers()
}
xhr.send()
}
function loadCCheckers() {
emptyCCheckers();
if (root.json === null)
{
return;
emptyCCheckers()
if (root.json === null) {
return
}
var currentImagePath = (root.viewpoint && root.viewpoint.attribute && root.viewpoint.attribute.childAttribute("path")) ? root.viewpoint.attribute.childAttribute("path").value : null
var viewId = (root.viewpoint && root.viewpoint.attribute && root.viewpoint.attribute.childAttribute("viewId")) ? root.viewpoint.attribute.childAttribute("viewId").value : null
var currentImagePath = (root.viewpoint && root.viewpoint.attribute && root.viewpoint.attribute.childAttribute("path"))
? root.viewpoint.attribute.childAttribute("path").value : null
var viewId = (root.viewpoint && root.viewpoint.attribute && root.viewpoint.attribute.childAttribute("viewId"))
? root.viewpoint.attribute.childAttribute("viewId").value : null
for (var i = 0; i < root.json.checkers.length; i++) {
// Only load ccheckers for the current view
var checker = root.json.checkers[i]
if (checker.viewId === viewId ||
checker.imagePath === currentImagePath) {
var cpt = Qt.createComponent("ColorCheckerEntity.qml");
var cpt = Qt.createComponent("ColorCheckerEntity.qml")
var obj = cpt.createObject(root, {
x: ccheckerSizeX / 2,
@ -78,20 +78,20 @@ Item {
sizeX: root.ccheckerSizeX,
sizeY: root.ccheckerSizeY,
colors: root.json.checkers[i].colors
});
obj.applyTransform(root.json.checkers[i].transform);
ccheckers.push(obj);
selectedCChecker = ccheckers.length-1;
break;
})
obj.applyTransform(root.json.checkers[i].transform)
ccheckers.push(obj)
selectedCChecker = ccheckers.length - 1
break
}
}
updatePane();
updatePane()
}
function emptyCCheckers() {
for (var i = 0; i < ccheckers.length; i++)
ccheckers[i].destroy();
ccheckers = [];
selectedCChecker = -1;
ccheckers[i].destroy()
ccheckers = []
selectedCChecker = -1
}
}

View file

@ -52,9 +52,9 @@ FloatingPane {
from: 0
to: 1
first.value: 0
first.onMoved: { root.featuresViewer.featureMinScaleFilter = Math.pow(first.value,4); }
first.onMoved: { root.featuresViewer.featureMinScaleFilter = Math.pow(first.value,4) }
second.value: 1
second.onMoved: { root.featuresViewer.featureMaxScaleFilter = Math.pow(second.value,4); }
second.onMoved: { root.featuresViewer.featureMaxScaleFilter = Math.pow(second.value,4) }
stepSize: 0.01
}
}
@ -120,7 +120,7 @@ FloatingPane {
}
RowLayout {
Label {
text: "Display 3d Tracks:"
text: "Display 3D Tracks:"
}
CheckBox {
id: display3dTracksCB
@ -163,20 +163,20 @@ FloatingPane {
editable: true
textFromValue: function(value, locale) {
if (value === -1) return "No Limit";
if (value === 0) return "Disable";
return value;
if (value === -1) return "No Limit"
if (value === 0) return "Disable"
return value
}
valueFromText: function(text, locale) {
if (text === "No Limit") return -1;
if (text === "Disable") return 0;
return Number.fromLocaleString(locale, text);
if (text === "No Limit") return -1
if (text === "Disable") return 0
return Number.fromLocaleString(locale, text)
}
onValueChanged: {
if (root.featuresViewer)
root.featuresViewer.timeWindow = timeWindowSB.value;
root.featuresViewer.timeWindow = timeWindowSB.value
}
}
}
@ -212,7 +212,7 @@ FloatingPane {
text: MaterialIcons.center_focus_strong
ToolTip.text: "Display Extracted Features"
onClicked: {
featureType.viewer.displayFeatures = featuresVisibilityButton.checked;
featureType.viewer.displayFeatures = featuresVisibilityButton.checked
}
font.pointSize: 10
opacity: featureType.viewer.visible ? 1.0 : 0.6
@ -225,8 +225,8 @@ FloatingPane {
text: MaterialIcons.timeline
ToolTip.text: "Display Tracks"
onClicked: {
featureType.viewer.displayTracks = tracksVisibilityButton.checked;
root.featuresViewer.enableTimeWindow = tracksVisibilityButton.checked;
featureType.viewer.displayTracks = tracksVisibilityButton.checked
root.featuresViewer.enableTimeWindow = tracksVisibilityButton.checked
}
font.pointSize: 10
}
@ -238,7 +238,7 @@ FloatingPane {
text: MaterialIcons.sync
ToolTip.text: "Display Matches"
onClicked: {
featureType.viewer.displayMatches = matchesVisibilityButton.checked;
featureType.viewer.displayMatches = matchesVisibilityButton.checked
}
font.pointSize: 10
}
@ -250,7 +250,7 @@ FloatingPane {
text: MaterialIcons.fiber_manual_record
ToolTip.text: "Display Landmarks"
onClicked: {
featureType.viewer.displayLandmarks = landmarksVisibilityButton.checked;
featureType.viewer.displayLandmarks = landmarksVisibilityButton.checked
}
font.pointSize: 10
}

View file

@ -24,22 +24,21 @@ AliceVision.FloatImageViewer {
else if ((root.source === "") ||
(root.sourceSize.height <= 0) ||
(root.sourceSize.width <= 0))
return Image.Null;
return Image.Null
return Image.Ready;
return Image.Ready
}
onStatusChanged: {
if (viewerTypeString === "panorama") {
var activeNode = _reconstruction.activeNodes.get('SfMTransform').node;
var activeNode = _reconstruction.activeNodes.get('SfMTransform').node
}
root.surface.setIdView(idView);
}
property string channelModeString : "rgba"
channelMode: {
switch(channelModeString)
{
switch (channelModeString) {
case "rgb": return AliceVision.FloatImageViewer.EChannelMode.RGB
case "r": return AliceVision.FloatImageViewer.EChannelMode.R
case "g": return AliceVision.FloatImageViewer.EChannelMode.G
@ -51,8 +50,7 @@ AliceVision.FloatImageViewer {
property string viewerTypeString : "hdr"
surface.viewerType: {
switch(viewerTypeString)
{
switch (viewerTypeString) {
case "hdr": return AliceVision.Surface.EViewerType.HDR;
case "distortion": return AliceVision.Surface.EViewerType.DISTORTION;
case "panorama": return AliceVision.Surface.EViewerType.PANORAMA;
@ -60,7 +58,7 @@ AliceVision.FloatImageViewer {
}
}
property int pointsNumber: (surface.subdivisions + 1) * (surface.subdivisions + 1);
property int pointsNumber: (surface.subdivisions + 1) * (surface.subdivisions + 1)
property int idView: 0;
@ -78,16 +76,16 @@ AliceVision.FloatImageViewer {
}
function isMouseOver(mx, my) {
return root.surface.isMouseInside(mx, my);
return root.surface.isMouseInside(mx, my)
}
function getMouseCoordinates(mx, my) {
if (isMouseOver(mx, my)) {
root.surface.mouseOver = true
return true;
return true
} else {
root.surface.mouseOver = false
return false;
return false
}
}
@ -101,12 +99,12 @@ AliceVision.FloatImageViewer {
*/
function updatePrincipalPoint() {
var pp = root.surface.getPrincipalPoint();
ppRect.x = pp.x;
ppRect.y = pp.y;
var pp = root.surface.getPrincipalPoint()
ppRect.x = pp.x
ppRect.y = pp.y
}
property bool isPrincipalPointsDisplayed : false;
property bool isPrincipalPointsDisplayed : false
Item {
id: principalPoint

View file

@ -14,8 +14,8 @@ FloatingPane {
property real gammaDefaultValue: 1.0
function resetDefaultValues() {
gainCtrl.value = root.gainDefaultValue;
gammaCtrl.value = root.gammaDefaultValue;
gainCtrl.value = root.gainDefaultValue
gammaCtrl.value = root.gammaDefaultValue
}
property real slidersPowerValue: 4.0
@ -65,7 +65,7 @@ FloatingPane {
ToolTip.text: "Reset Gain"
onClicked: {
gainCtrl.value = gainDefaultValue;
gainCtrl.value = gainDefaultValue
}
}
TextField {

View file

@ -9,7 +9,7 @@ import Controls 1.0
import Utils 1.0
/**
* ImageMetadataView displays a JSON model representing an image"s metadata as a ListView.
* ImageMetadataView displays a JSON model representing an image's metadata as a ListView.
*/
FloatingPane {
id: root
@ -27,12 +27,10 @@ FloatingPane {
* GPS coordinates in metadata can be store in 3 forms:
* (degrees), (degrees, minutes), (degrees, minutes, seconds)
*/
function gpsMetadataToCoordinates(value, ref)
{
function gpsMetadataToCoordinates(value, ref) {
var values = value.split(",")
var result = 0
for(var i=0; i < values.length; ++i)
{
for (var i = 0; i < values.length; ++i) {
// divide each component by the corresponding power of 60
// 1 for degree, 60 for minutes, 3600 for seconds
result += Number(values[i]) / Math.pow(60, i)
@ -42,19 +40,14 @@ FloatingPane {
}
/// Try to get GPS coordinates from metadata
function getGPSCoordinates(metadata)
{
function getGPSCoordinates(metadata) {
// GPS data available
if(metadata && metadata["GPS:Longitude"] !== undefined && metadata["GPS:Latitude"] !== undefined)
{
if (metadata && metadata["GPS:Longitude"] !== undefined && metadata["GPS:Latitude"] !== undefined) {
var latitude = gpsMetadataToCoordinates(metadata["GPS:Latitude"], metadata["GPS:LatitudeRef"])
var longitude = gpsMetadataToCoordinates(metadata["GPS:Longitude"], metadata["GPS:LongitudeRef"])
var altitude = metadata["GPS:Altitude"] || 0
return QtPositioning.coordinate(latitude, longitude, altitude)
}
// GPS data unavailable: reset coordinates to default value
else
{
} else { // GPS data unavailable: reset coordinates to default value
return QtPositioning.coordinate()
}
}
@ -74,22 +67,18 @@ FloatingPane {
metadataModel.clear()
var entries = []
// prepare data to populate the model from the input metadata object
for(var key in metadata)
{
for (var key in metadata) {
var entry = {}
// split on ":" to get group and key
var i = key.lastIndexOf(":")
if(i === -1)
{
if (i === -1) {
i = key.lastIndexOf("/")
}
if(i !== -1)
{
if (i !== -1) {
entry["group"] = key.substr(0, i)
entry["key"] = key.substr(i+1)
}
else
{
} else {
// set default group to something convenient for sorting
entry["group"] = "-"
entry["key"] = key
@ -110,15 +99,6 @@ FloatingPane {
}
}
// Button {
// onClicked: {
// if(sortedMetadataModel.sortOrder == Qt.DescendingOrder)
// sortedMetadataModel.sortOrder = Qt.AscendingOrder
// else
// sortedMetadataModel.sortOrder = Qt.DescendingOrder
// }
// }
// Background WheelEvent grabber
MouseArea {
anchors.fill: parent
@ -126,7 +106,6 @@ FloatingPane {
onWheel: wheel.accepted = true
}
// Main Layout
ColumnLayout {
anchors.fill: parent
@ -145,15 +124,14 @@ FloatingPane {
id: exposureLabel
text: {
if (metadata["ExposureTime"] === undefined)
return "";
var expStr = metadata["ExposureTime"];
var exp = parseFloat(expStr);
if(exp < 1.0)
{
var invExp = 1.0 / exp;
return "1/" + invExp.toFixed(0);
return ""
var expStr = metadata["ExposureTime"]
var exp = parseFloat(expStr)
if (exp < 1.0) {
var invExp = 1.0 / exp
return "1/" + invExp.toFixed(0)
}
return expStr;
return expStr
}
elide: Text.ElideRight
horizontalAlignment: Text.AlignHLeft

View file

@ -77,7 +77,7 @@ FloatingPane {
ToolTip.text: "Reset Opacity"
onClicked: {
opacityCtrl.value = opacityDefaultValue;
opacityCtrl.value = opacityDefaultValue
}
}
TextField {
@ -118,7 +118,7 @@ FloatingPane {
ToolTip.text: "Reset Subdivisions"
onClicked: {
subdivisionsCtrl.value = subdivisionsDefaultValue;
subdivisionsCtrl.value = subdivisionsDefaultValue
}
}
TextField {

View file

@ -26,7 +26,7 @@ FloatingPane {
background: Rectangle { color: root.palette.window }
function updateDownscaleValue(level) {
downscaleSpinBox.value = level;
downscaleSpinBox.value = level
}
DoubleValidator {
@ -79,7 +79,7 @@ FloatingPane {
ToolTip.text: "Reset Subdivisions"
onClicked: {
subdivisionsCtrl.value = subdivisionsDefaultValue;
subdivisionsCtrl.value = subdivisionsDefaultValue
}
}
TextField {
@ -119,7 +119,7 @@ FloatingPane {
ToolTip.text: "Reset the mouse multiplier"
onClicked: {
speedSpinBox.value = 1;
speedSpinBox.value = 1
}
}
SpinBox {
@ -152,7 +152,7 @@ FloatingPane {
ToolTip.text: "Reset the downscale"
onClicked: {
downscaleSpinBox.value = downscaleDefaultValue;
downscaleSpinBox.value = downscaleDefaultValue
}
}
SpinBox {
@ -173,11 +173,9 @@ FloatingPane {
textFromValue: function(value, locale) {
if (value === 0){
return 1
}
else{
} else {
return "1/" + Math.pow(2, value).toString()
}
}
}
}
@ -188,5 +186,4 @@ FloatingPane {
font: subdivisionsLabel.font
text: "100.00"
}
}

View file

@ -21,10 +21,9 @@ AliceVision.PanoramaViewer {
property int paintedHeight: sourceSize.height
property var status: {
if (readyToLoad === Image.Ready) {
return Image.Ready;
}
else {
return Image.Null;
return Image.Ready
} else {
return Image.Null
}
}
@ -46,7 +45,7 @@ AliceVision.PanoramaViewer {
onIsHighlightableChanged: {
for (var i = 0; i < repeater.model; ++i) {
repeater.itemAt(i).item.onChangedHighlightState(isHighlightable);
repeater.itemAt(i).item.onChangedHighlightState(isHighlightable)
}
}
@ -67,12 +66,12 @@ AliceVision.PanoramaViewer {
property double pitch: 0;
property double roll: 0;
property var activeNode: _reconstruction.activeNodes.get('SfMTransform').node;
property var activeNode: _reconstruction.activeNodes.get('SfMTransform').node
// Yaw and Pitch in Degrees from SfMTransform node sliders
property double yawNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.y").value : 0;
property double pitchNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.x").value : 0;
property double rollNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.z").value : 0;
property double yawNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.y").value : 0
property double pitchNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.x").value : 0
property double rollNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.z").value : 0
//Convert angle functions
function toDegrees(radians) {
@ -83,28 +82,27 @@ AliceVision.PanoramaViewer {
return degrees * (Math.PI / 180)
}
function fmod(a,b) { return Number((a - (Math.floor(a / b) * b)).toPrecision(8)); }
function fmod(a,b) { return Number((a - (Math.floor(a / b) * b)).toPrecision(8)) }
// Limit angle between -180 and 180
function limitAngle(angle) {
if (angle > 180) angle = -180.0 + (angle - 180.0);
if (angle < -180) angle = 180.0 - (Math.abs(angle) - 180);
return angle;
if (angle > 180) angle = -180.0 + (angle - 180.0)
if (angle < -180) angle = 180.0 - (Math.abs(angle) - 180)
return angle
}
function limitPitch(angle)
{
return (angle > 180 || angle < -180) ? root.pitch : angle;
function limitPitch(angle) {
return (angle > 180 || angle < -180) ? root.pitch : angle
}
onYawNodeChanged: {
root.yaw = yawNode;
root.yaw = yawNode
}
onPitchNodeChanged: {
root.pitch = pitchNode;
root.pitch = pitchNode
}
onRollNodeChanged: {
root.roll = rollNode;
root.roll = rollNode
}
Item {
@ -125,9 +123,9 @@ AliceVision.PanoramaViewer {
}
onPositionChanged: {
// Send Mouse Coordinates to Float Images Viewers
idSelected = -1;
idSelected = -1
for (var i = 0; i < repeater.model && isHighlightable; ++i) {
var highlight = repeater.itemAt(i).item.getMouseCoordinates(mouse.x, mouse.y);
var highlight = repeater.itemAt(i).item.getMouseCoordinates(mouse.x, mouse.y)
repeater.itemAt(i).z = highlight ? 2 : 0
if (highlight) {
idSelected = root.msfmData.viewsIds[i]
@ -136,15 +134,13 @@ AliceVision.PanoramaViewer {
// Rotate Panorama
if (isRotating && isEditable) {
var nx = Math.min(width - 1, mouse.x)
var ny = Math.min(height - 1, mouse.y)
var xoffset = nx - lastX;
var yoffset = ny - lastY;
if (xoffset != 0 || yoffset !=0)
{
if (xoffset != 0 || yoffset !=0) {
var latitude_start = (yStart / height) * Math.PI - (Math.PI / 2);
var longitude_start = ((xStart / width) * 2 * Math.PI) - Math.PI;
var latitude_end = (ny / height) * Math.PI - ( Math.PI / 2);
@ -156,47 +152,42 @@ AliceVision.PanoramaViewer {
var previous_euler = Qt.vector3d(previous_yaw, previous_pitch, previous_roll)
var result
if (mouse.modifiers & Qt.ControlModifier)
{
if (mouse.modifiers & Qt.ControlModifier) {
result = Transformations3DHelper.updatePanoramaInPlane(previous_euler, start_pt, end_pt)
root.pitch = result.x
root.yaw = result.y
root.roll = result.z
}
else
{
} else {
result = Transformations3DHelper.updatePanorama(previous_euler, start_pt, end_pt)
root.pitch = result.x
root.yaw = result.y
root.roll = result.z
}
}
_reconstruction.setAttribute(activeNode.attribute("manualTransform.manualRotation.x"), Math.round(root.pitch));
_reconstruction.setAttribute(activeNode.attribute("manualTransform.manualRotation.y"), Math.round(root.yaw));
_reconstruction.setAttribute(activeNode.attribute("manualTransform.manualRotation.z"), Math.round(root.roll));
_reconstruction.setAttribute(activeNode.attribute("manualTransform.manualRotation.x"), Math.round(root.pitch))
_reconstruction.setAttribute(activeNode.attribute("manualTransform.manualRotation.y"), Math.round(root.yaw))
_reconstruction.setAttribute(activeNode.attribute("manualTransform.manualRotation.z"), Math.round(root.roll))
}
}
onPressed:{
_reconstruction.beginModification("Panorama Manual Rotation");
isRotating = true;
lastX = mouse.x;
lastY = mouse.y;
_reconstruction.beginModification("Panorama Manual Rotation")
isRotating = true
lastX = mouse.x
lastY = mouse.y
xStart = mouse.x;
yStart = mouse.y;
xStart = mouse.x
yStart = mouse.y
previous_yaw = yaw;
previous_pitch = pitch;
previous_roll = roll;
previous_yaw = yaw
previous_pitch = pitch
previous_roll = roll
}
onReleased: {
_reconstruction.endModification();
isRotating = false;
_reconstruction.endModification()
isRotating = false
lastX = 0
lastY = 0
@ -204,8 +195,6 @@ AliceVision.PanoramaViewer {
if (xStart == mouse.x && yStart == mouse.y && idSelected != -1) {
_reconstruction.selectedViewId = idSelected
}
}
}
@ -220,16 +209,16 @@ AliceVision.PanoramaViewer {
ctx.lineWidth = 1.0
ctx.shadowBlur = 0
ctx.strokeStyle = "grey"
var nrows = height/wgrid;
var nrows = height / wgrid
for (var i = 0; i < nrows + 1; ++i) {
ctx.moveTo(0, wgrid*i);
ctx.lineTo(width, wgrid*i);
ctx.moveTo(0, wgrid * i)
ctx.lineTo(width, wgrid * i)
}
var ncols = width / wgrid
for (var j = 0; j < ncols + 1; ++j) {
ctx.moveTo(wgrid*j, 0);
ctx.lineTo(wgrid*j, height);
ctx.moveTo(wgrid * j, 0)
ctx.lineTo(wgrid * j, height)
}
ctx.closePath()
@ -242,15 +231,13 @@ AliceVision.PanoramaViewer {
property int imagesLoaded: 0
property bool allImagesLoaded: false
function loadRepeaterImages(index)
{
function loadRepeaterImages(index) {
if (index < repeater.model)
repeater.itemAt(index).loadItem();
repeater.itemAt(index).loadItem()
else
allImagesLoaded = true;
allImagesLoaded = true
}
Item {
id: panoImages
width: root.width
@ -267,20 +254,20 @@ AliceVision.PanoramaViewer {
property bool loading: false
onImageLoadedChanged: {
imagesLoaded++;
loadRepeaterImages(imagesLoaded);
imagesLoaded++
loadRepeaterImages(imagesLoaded)
}
function loadItem() {
if (!active)
return;
return
if (loading) {
loadRepeaterImages(index + 1)
return;
return
}
loading = true;
loading = true
var idViewItem = msfmData.viewsIds[index]
var sourceItem = Filepath.stringToUrl(msfmData.getUrlFromViewId(idViewItem))
@ -288,22 +275,22 @@ AliceVision.PanoramaViewer {
setSource("FloatImage.qml", {
'surface.viewerType': AliceVision.Surface.EViewerType.PANORAMA,
'viewerTypeString': 'panorama',
'surface.subdivisions': Qt.binding(function() { return subdivisionsPano; }),
'cropFisheye' : Qt.binding(function(){ return cropFisheyePano; }),
'surface.pitch': Qt.binding(function() { return root.pitch; }),
'surface.yaw': Qt.binding(function() { return root.yaw; }),
'surface.roll': Qt.binding(function() { return root.roll; }),
'idView': Qt.binding(function() { return idViewItem; }),
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue; }),
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue; }),
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue; }),
'downscaleLevel' : Qt.binding(function() { return downscale; }),
'source': Qt.binding(function() { return sourceItem; }),
'surface.subdivisions': Qt.binding(function() { return subdivisionsPano }),
'cropFisheye' : Qt.binding(function(){ return cropFisheyePano }),
'surface.pitch': Qt.binding(function() { return root.pitch }),
'surface.yaw': Qt.binding(function() { return root.yaw }),
'surface.roll': Qt.binding(function() { return root.roll }),
'idView': Qt.binding(function() { return idViewItem }),
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue }),
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue }),
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue }),
'downscaleLevel' : Qt.binding(function() { return downscale }),
'source': Qt.binding(function() { return sourceItem }),
'surface.msfmData': Qt.binding(function() { return root.msfmData }),
'canBeHovered': true,
'useSequence': false
})
imageLoaded = Qt.binding(function() { return repeater.itemAt(index).item.status === Image.Ready ? true : false; })
imageLoaded = Qt.binding(function() { return repeater.itemAt(index).item.status === Image.Ready ? true : false })
}
}
@ -317,7 +304,7 @@ AliceVision.PanoramaViewer {
Connections {
target: root
function onDownscaleReady() {
root.imagesLoaded = 0;
root.imagesLoaded = 0
// Retrieve downscale value from C++
panoramaViewerToolbar.updateDownscaleValue(root.downscale)
@ -325,22 +312,19 @@ AliceVision.PanoramaViewer {
//Changing the repeater model (number of elements)
panoImages.updateRepeater()
root.readyToLoad = Image.Ready;
root.readyToLoad = Image.Ready
// Load images two by two
loadRepeaterImages(0);
loadRepeaterImages(1);
loadRepeaterImages(0)
loadRepeaterImages(1)
}
}
function updateRepeater() {
if (repeater.model !== root.msfmData.viewsIds.length) {
repeater.model = 0;
repeater.model = 0
}
repeater.model = root.msfmData.viewsIds.length;
repeater.model = root.msfmData.viewsIds.length
}
}
}

View file

@ -115,9 +115,8 @@ FloatingPane {
checkState: residualsPerViewLegend.buttonGroup.checkState
onClicked: {
var _checked = checked;
for(var i = 0; i < residualsPerViewChart.count; ++i)
{
residualsPerViewChart.series(i).visible = _checked;
for (var i = 0; i < residualsPerViewChart.count; ++i) {
residualsPerViewChart.series(i).visible = _checked
}
}
}
@ -214,9 +213,8 @@ FloatingPane {
checkState: observationsLengthsPerViewLegend.buttonGroup.checkState
onClicked: {
var _checked = checked;
for(var i = 0; i < observationsLengthsPerViewChart.count; ++i)
{
observationsLengthsPerViewChart.series(i).visible = _checked;
for (var i = 0; i < observationsLengthsPerViewChart.count; ++i) {
observationsLengthsPerViewChart.series(i).visible = _checked
}
}
}
@ -225,7 +223,6 @@ FloatingPane {
id: observationsLengthsPerViewLegend
chartView: observationsLengthsPerViewChart
}
}
}
@ -278,7 +275,6 @@ FloatingPane {
anchors.leftMargin: landmarksPerViewChart.width * 0.25
RowLayout {
ChartViewCheckBox {
id: allFeatures
text: "ALL"
@ -286,9 +282,8 @@ FloatingPane {
checkState: landmarksFeatTracksPerViewLegend.buttonGroup.checkState
onClicked: {
var _checked = checked;
for(var i = 0; i < landmarksPerViewChart.count; ++i)
{
landmarksPerViewChart.series(i).visible = _checked;
for (var i = 0; i < landmarksPerViewChart.count; ++i) {
landmarksPerViewChart.series(i).visible = _checked
}
}
}
@ -297,7 +292,6 @@ FloatingPane {
id: landmarksFeatTracksPerViewLegend
chartView: landmarksPerViewChart
}
}
}
@ -308,20 +302,20 @@ FloatingPane {
mTracks: root.mTracks
onAxisChanged: {
fillLandmarksPerViewSerie(landmarksPerViewLineSerie);
fillTracksPerViewSerie(tracksPerViewLineSerie);
fillResidualsMinPerViewSerie(residualsMinPerViewLineSerie);
fillResidualsMaxPerViewSerie(residualsMaxPerViewLineSerie);
fillResidualsMeanPerViewSerie(residualsMeanPerViewLineSerie);
fillResidualsMedianPerViewSerie(residualsMedianPerViewLineSerie);
fillResidualsFirstQuartilePerViewSerie(residualsFirstQuartilePerViewLineSerie);
fillResidualsThirdQuartilePerViewSerie(residualsThirdQuartilePerViewLineSerie);
fillObservationsLengthsMinPerViewSerie(observationsLengthsMinPerViewLineSerie);
fillObservationsLengthsMaxPerViewSerie(observationsLengthsMaxPerViewLineSerie);
fillObservationsLengthsMeanPerViewSerie(observationsLengthsMeanPerViewLineSerie);
fillObservationsLengthsMedianPerViewSerie(observationsLengthsMedianPerViewLineSerie);
fillObservationsLengthsFirstQuartilePerViewSerie(observationsLengthsFirstQuartilePerViewLineSerie);
fillObservationsLengthsThirdQuartilePerViewSerie(observationsLengthsThirdQuartilePerViewLineSerie);
fillLandmarksPerViewSerie(landmarksPerViewLineSerie)
fillTracksPerViewSerie(tracksPerViewLineSerie)
fillResidualsMinPerViewSerie(residualsMinPerViewLineSerie)
fillResidualsMaxPerViewSerie(residualsMaxPerViewLineSerie)
fillResidualsMeanPerViewSerie(residualsMeanPerViewLineSerie)
fillResidualsMedianPerViewSerie(residualsMedianPerViewLineSerie)
fillResidualsFirstQuartilePerViewSerie(residualsFirstQuartilePerViewLineSerie)
fillResidualsThirdQuartilePerViewSerie(residualsThirdQuartilePerViewLineSerie)
fillObservationsLengthsMinPerViewSerie(observationsLengthsMinPerViewLineSerie)
fillObservationsLengthsMaxPerViewSerie(observationsLengthsMaxPerViewLineSerie)
fillObservationsLengthsMeanPerViewSerie(observationsLengthsMeanPerViewLineSerie)
fillObservationsLengthsMedianPerViewSerie(observationsLengthsMedianPerViewLineSerie)
fillObservationsLengthsFirstQuartilePerViewSerie(observationsLengthsFirstQuartilePerViewLineSerie)
fillObservationsLengthsThirdQuartilePerViewSerie(observationsLengthsThirdQuartilePerViewLineSerie)
}
}
}

View file

@ -88,9 +88,8 @@ FloatingPane {
checkState: residualLegend.buttonGroup.checkState
onClicked: {
var _checked = checked;
for(var i = 0; i < residualChart.count; ++i)
{
residualChart.series(i).visible = _checked;
for (var i = 0; i < residualChart.count; ++i) {
residualChart.series(i).visible = _checked
}
}
}
@ -141,7 +140,6 @@ FloatingPane {
axisY: observationsLengthsvalueAxisY
name: "Current"
}
}
Item {
@ -162,9 +160,8 @@ FloatingPane {
checkState: observationsLengthsLegend.buttonGroup.checkState
onClicked: {
var _checked = checked;
for(var i = 0; i < observationsLengthsChart.count; ++i)
{
observationsLengthsChart.series(i).visible = _checked;
for (var i = 0; i < observationsLengthsChart.count; ++i) {
observationsLengthsChart.series(i).visible = _checked
}
}
}
@ -173,7 +170,6 @@ FloatingPane {
id: observationsLengthsLegend
chartView: observationsLengthsChart
}
}
}
@ -232,9 +228,8 @@ FloatingPane {
checkState: observationsScaleLegend.buttonGroup.checkState
onClicked: {
var _checked = checked;
for(var i = 0; i < observationsScaleChart.count; ++i)
{
observationsScaleChart.series(i).visible = _checked;
for (var i = 0; i < observationsScaleChart.count; ++i) {
observationsScaleChart.series(i).visible = _checked
}
}
}
@ -252,12 +247,12 @@ FloatingPane {
msfmData: (root.visible && root.msfmData && root.msfmData.status === AliceVision.MSfMData.Ready) ? root.msfmData : null
viewId: root.viewId
onViewStatsChanged: {
fillResidualFullSerie(residualFullLineSerie);
fillResidualViewSerie(residualViewLineSerie);
fillObservationsLengthsFullSerie(observationsLengthsFullLineSerie);
fillObservationsLengthsViewSerie(observationsLengthsViewLineSerie);
fillObservationsScaleFullSerie(observationsScaleFullLineSerie);
fillObservationsScaleViewSerie(observationsScaleViewLineSerie);
fillResidualFullSerie(residualFullLineSerie)
fillResidualViewSerie(residualViewLineSerie)
fillObservationsLengthsFullSerie(observationsLengthsFullLineSerie)
fillObservationsLengthsViewSerie(observationsLengthsViewLineSerie)
fillObservationsScaleFullSerie(observationsScaleFullLineSerie)
fillObservationsScaleViewSerie(observationsScaleViewLineSerie)
}
}
}

View file

@ -34,24 +34,24 @@ FocusScope {
// Metadata from viewpoint attribute
// Read from the reconstruction object
if (_reconstruction) {
let vp = getViewpoint(_reconstruction.selectedViewId);
let vp = getViewpoint(_reconstruction.selectedViewId)
if (vp) {
return JSON.parse(vp.childAttribute("metadata").value);
return JSON.parse(vp.childAttribute("metadata").value)
}
}
return {};
return {}
}
property variant imgMetadata: {
// Metadata from FloatImage viewer
// Directly read from the image file on disk
if (floatImageViewerLoader.active) {
return floatImageViewerLoader.item.metadata;
return floatImageViewerLoader.item.metadata
}
// Use viewpoint metadata for the special case of the 8-bit viewer
if (qtImageViewerLoader.active) {
return viewpointMetadata;
return viewpointMetadata
}
return {};
return {}
}
}
@ -72,40 +72,35 @@ FocusScope {
property string loadingModules: {
if (!imgContainer.image)
return "";
var res = "";
if(imgContainer.image.status === Image.Loading)
{
res += " Image";
return ""
var res = ""
if (imgContainer.image.status === Image.Loading) {
res += " Image"
}
if(mfeaturesLoader.status === Loader.Ready)
{
if (mfeaturesLoader.status === Loader.Ready) {
if (mfeaturesLoader.item && mfeaturesLoader.item.status === MFeatures.Loading)
res += " Features";
res += " Features"
}
if(mtracksLoader.status === Loader.Ready)
{
if (mtracksLoader.status === Loader.Ready) {
if (mtracksLoader.item && mtracksLoader.item.status === MTracks.Loading)
res += " Tracks";
res += " Tracks"
}
if(msfmDataLoader.status === Loader.Ready)
{
if (msfmDataLoader.status === Loader.Ready) {
if (msfmDataLoader.item && msfmDataLoader.item.status === MSfMData.Loading)
res += " SfMData";
res += " SfMData"
}
return res;
return res
}
function clear()
{
function clear() {
source = ''
}
// slots
Keys.onPressed: {
if (event.key === Qt.Key_F) {
root.fit();
event.accepted = true;
root.fit()
event.accepted = true
}
}
@ -122,27 +117,27 @@ FocusScope {
onReleased: {
drag.target = undefined // stop drag
if (mouse.button & Qt.RightButton) {
var menu = contextMenu.createObject(root);
menu.x = mouse.x;
menu.y = mouse.y;
var menu = contextMenu.createObject(root)
menu.x = mouse.x
menu.y = mouse.y
menu.open()
}
}
onWheel: {
var zoomFactor = wheel.angleDelta.y > 0 ? factor : 1/factor;
var zoomFactor = wheel.angleDelta.y > 0 ? factor : 1 / factor
if (Math.min(imgContainer.width, imgContainer.image.height) * imgContainer.scale * zoomFactor < 10)
return;
var point = mapToItem(imgContainer, wheel.x, wheel.y);
imgContainer.x += (1-zoomFactor) * point.x * imgContainer.scale;
imgContainer.y += (1-zoomFactor) * point.y * imgContainer.scale;
imgContainer.scale *= zoomFactor;
return
var point = mapToItem(imgContainer, wheel.x, wheel.y)
imgContainer.x += (1-zoomFactor) * point.x * imgContainer.scale
imgContainer.y += (1-zoomFactor) * point.y * imgContainer.scale
imgContainer.scale *= zoomFactor
}
}
onEnable8bitViewerChanged: {
if (!enable8bitViewer) {
displayHDR.checked = true;
displayHDR.checked = true
}
}
@ -150,51 +145,51 @@ FocusScope {
function fit() {
// make sure the image is ready for use
if (!imgContainer.image)
return;
return
// for Exif orientation tags 5 to 8, a 90 degrees rotation is applied
// therefore image dimensions must be inverted
let dimensionsInverted = ["5", "6", "7", "8"].includes(imgContainer.orientationTag);
let orientedWidth = dimensionsInverted ? imgContainer.image.height : imgContainer.image.width;
let orientedHeight = dimensionsInverted ? imgContainer.image.width : imgContainer.image.height;
let dimensionsInverted = ["5", "6", "7", "8"].includes(imgContainer.orientationTag)
let orientedWidth = dimensionsInverted ? imgContainer.image.height : imgContainer.image.width
let orientedHeight = dimensionsInverted ? imgContainer.image.width : imgContainer.image.height
// fit oriented image
imgContainer.scale = Math.min(imgLayout.width / orientedWidth, root.height / orientedHeight);
imgContainer.x = Math.max((imgLayout.width - orientedWidth * imgContainer.scale)*0.5, 0);
imgContainer.y = Math.max((imgLayout.height - orientedHeight * imgContainer.scale)*0.5, 0);
imgContainer.scale = Math.min(imgLayout.width / orientedWidth, root.height / orientedHeight)
imgContainer.x = Math.max((imgLayout.width - orientedWidth * imgContainer.scale) * 0.5, 0)
imgContainer.y = Math.max((imgLayout.height - orientedHeight * imgContainer.scale) * 0.5, 0)
// correct position when image dimensions are inverted
// so that container center corresponds to image center
imgContainer.x += (orientedWidth - imgContainer.image.width) * 0.5 * imgContainer.scale;
imgContainer.y += (orientedHeight - imgContainer.image.height) * 0.5 * imgContainer.scale;
imgContainer.x += (orientedWidth - imgContainer.image.width) * 0.5 * imgContainer.scale
imgContainer.y += (orientedHeight - imgContainer.image.height) * 0.5 * imgContainer.scale
}
function tryLoadNode(node) {
useExternal = false;
useExternal = false
// safety check
if (!node) {
return false;
return false
}
// node must be computed or at least running
if (!node.isPartiallyFinished()) {
return false;
return false
}
// node must have at least one output attribute with the image semantic
if (!node.hasImageOutput) {
return false;
return false
}
displayedNode = node;
return true;
displayedNode = node
return true
}
function loadExternal(path) {
useExternal = true;
sourceExternal = path;
displayedNode = null;
useExternal = true
sourceExternal = path
displayedNode = null
}
function getViewpoint(viewId) {
@ -202,13 +197,13 @@ FocusScope {
// This requires to loop over all viewpoints
for (var i = 0; i < _reconstruction.viewpoints.count; i++) {
var vp = _reconstruction.viewpoints.at(i);
var vp = _reconstruction.viewpoints.at(i)
if (vp.childAttribute("viewId").value == viewId) {
return vp;
return vp
}
}
return undefined;
return undefined
}
function getAttributeByName(node, attrName) {
@ -216,13 +211,13 @@ FocusScope {
// This requires to loop over all atributes
for (var i = 0; i < node.attributes.count; i++) {
var attr = node.attributes.at(i);
var attr = node.attributes.at(i)
if (attr.name == attrName) {
return attr;
return attr
}
}
return undefined;
return undefined
}
function resolve(path, vp) {
@ -234,11 +229,11 @@ FocusScope {
"<POSE_ID>": vp.childAttribute("poseId").value,
"<PATH>": vp.childAttribute("path").value,
"<FILENAME>": Filepath.removeExtension(Filepath.basename(vp.childAttribute("path").value)),
};
}
let resolved = path;
for (let key in replacements) {
resolved = resolved.replace(key, replacements[key]);
resolved = resolved.replace(key, replacements[key])
}
return resolved;
@ -248,24 +243,24 @@ FocusScope {
// Entry point for getting the image file URL
if (useExternal) {
return sourceExternal;
return sourceExternal
}
if (_reconstruction && (!displayedNode || outputAttribute.name == "gallery")) {
let vp = getViewpoint(_reconstruction.pickedViewId);
let path = vp ? vp.childAttribute("path").value : "";
return Filepath.stringToUrl(path);
let vp = getViewpoint(_reconstruction.pickedViewId)
let path = vp ? vp.childAttribute("path").value : ""
return Filepath.stringToUrl(path)
}
if (_reconstruction) {
let vp = getViewpoint(_reconstruction.pickedViewId);
let attr = getAttributeByName(displayedNode, outputAttribute.name);
let path = attr ? attr.value : "";
let resolved = vp ? resolve(path, vp) : "";
return Filepath.stringToUrl(resolved);
let vp = getViewpoint(_reconstruction.pickedViewId)
let attr = getAttributeByName(displayedNode, outputAttribute.name)
let path = attr ? attr.value : ""
let resolved = vp ? resolve(path, vp) : ""
return Filepath.stringToUrl(resolved)
}
return undefined;
return undefined
}
function buildOrderedSequence(path_template) {
@ -274,66 +269,66 @@ FocusScope {
let objs = []
for (let i = 0; i < _reconstruction.viewpoints.count; i++) {
objs.push(_reconstruction.viewpoints.at(i));
objs.push(_reconstruction.viewpoints.at(i))
}
objs.sort((a, b) => { return a.childAttribute("path").value < b.childAttribute("path").value ? -1 : 1; });
objs.sort((a, b) => { return a.childAttribute("path").value < b.childAttribute("path").value ? -1 : 1; })
let seq = [];
for (let i = 0; i < objs.length; i++) {
seq.push(resolve(path_template, objs[i]));
seq.push(resolve(path_template, objs[i]))
}
return seq;
return seq
}
function getSequence() {
// Entry point for getting the current image sequence
if (useExternal) {
return [];
return []
}
if (_reconstruction && (!displayedNode || outputAttribute.name == "gallery")) {
return buildOrderedSequence("<PATH>");
return buildOrderedSequence("<PATH>")
}
if (_reconstruction) {
let attr = getAttributeByName(displayedNode, outputAttribute.name);
let path_template = attr ? attr.value : "";
return buildOrderedSequence(path_template);
let attr = getAttributeByName(displayedNode, outputAttribute.name)
let path_template = attr ? attr.value : ""
return buildOrderedSequence(path_template)
}
return [];
return []
}
onDisplayedNodeChanged: {
if (!displayedNode) {
root.source = "";
root.source = ""
}
// update output attribute names
var names = [];
var names = []
if (displayedNode) {
// store attr name for output attributes that represent images
for (var i = 0; i < displayedNode.attributes.count; i++) {
var attr = displayedNode.attributes.at(i);
var attr = displayedNode.attributes.at(i)
if (attr.isOutput && attr.desc.semantic === "image" && attr.enabled) {
names.push(attr.name);
names.push(attr.name)
}
}
}
names.push("gallery");
outputAttribute.names = names;
names.push("gallery")
outputAttribute.names = names
root.source = getImageFile();
root.source = getImageFile()
}
Connections {
target: _reconstruction
function onSelectedViewIdChanged() {
root.source = getImageFile();
root.source = getImageFile()
if (useExternal)
useExternal = false;
useExternal = false
}
}
@ -343,6 +338,7 @@ FocusScope {
tryLoadNode(displayedNode)
}
}
// context menu
property Component contextMenu: Menu {
MenuItem {
@ -368,7 +364,7 @@ FocusScope {
visible: displayImageToolBarAction.checked && displayImageToolBarAction.enabled
Layout.fillWidth: true
onVisibleChanged: {
resetDefaultValues();
resetDefaultValues()
}
colorPickerVisible: {
return !displayPanoramaViewer.checked
@ -376,18 +372,15 @@ FocusScope {
colorRGBA: {
if (!floatImageViewerLoader.item ||
floatImageViewerLoader.item.status !== Image.Ready)
{
return null;
floatImageViewerLoader.item.status !== Image.Ready) {
return null
}
if(floatImageViewerLoader.item.containsMouse === false)
{
return null;
if (floatImageViewerLoader.item.containsMouse === false) {
return null
}
var pix = floatImageViewerLoader.item.pixelValueAt(Math.floor(floatImageViewerLoader.item.mouseX), Math.floor(floatImageViewerLoader.item.mouseY));
return pix;
var pix = floatImageViewerLoader.item.pixelValueAt(Math.floor(floatImageViewerLoader.item.mouseX), Math.floor(floatImageViewerLoader.item.mouseY))
return pix
}
}
LensDistortionToolbar {
@ -439,7 +432,7 @@ FocusScope {
property bool fittedOnce: false
property int previousWidth: 0
property int previousHeight: 0
property real targetSize: Math.max(width, height) * imgContainer.scale;
property real targetSize: Math.max(width, height) * imgContainer.scale
onHeightChanged: {
/* Image size is not updated through a single signal with the floatImage viewer, unlike
* the simple QML image viewer: instead of updating straight away the width and height to x and
@ -454,39 +447,39 @@ FocusScope {
* performed */
if ((!fittedOnce && imgContainer.image && imgContainer.image.height > 0) ||
(fittedOnce && ((width > 1 && previousWidth != width) || (height > 1 && previousHeight != height)))) {
fit();
fittedOnce = true;
previousWidth = width;
previousHeight = height;
fit()
fittedOnce = true
previousWidth = width
previousHeight = height
}
}
onActiveChanged: {
if (active) {
// instantiate and initialize a FLoatImage component dynamically using Loader.setSource
// Instantiate and initialize a FLoatImage component dynamically using Loader.setSource
// Note: It does not work to use previously created component, so we re-create it with setSource.
setSource("FloatImage.qml", {
'source': Qt.binding(function() { return getImageFile(); }),
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue; }),
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue; }),
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue; }),
'isPrincipalPointsDisplayed' : Qt.binding(function(){ return lensDistortionImageToolbar.displayPrincipalPoint;}),
'surface.displayGrid' : Qt.binding(function(){ return lensDistortionImageToolbar.visible && lensDistortionImageToolbar.displayGrid;}),
'surface.gridOpacity' : Qt.binding(function(){ return lensDistortionImageToolbar.opacityValue;}),
'surface.gridColor' : Qt.binding(function(){ return lensDistortionImageToolbar.color;}),
'surface.subdivisions' : Qt.binding(function(){ return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue;}),
'viewerTypeString': Qt.binding(function(){ return displayLensDistortionViewer.checked ? "distortion" : "hdr";}),
'sfmRequired': Qt.binding(function(){ return displayLensDistortionViewer.checked ? true : false;}),
'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null; }),
'source': Qt.binding(function() { return getImageFile() }),
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue }),
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue }),
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue }),
'isPrincipalPointsDisplayed' : Qt.binding(function() { return lensDistortionImageToolbar.displayPrincipalPoint }),
'surface.displayGrid' : Qt.binding(function() { return lensDistortionImageToolbar.visible && lensDistortionImageToolbar.displayGrid }),
'surface.gridOpacity' : Qt.binding(function() { return lensDistortionImageToolbar.opacityValue }),
'surface.gridColor' : Qt.binding(function() { return lensDistortionImageToolbar.color }),
'surface.subdivisions' : Qt.binding(function() { return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue }),
'viewerTypeString': Qt.binding(function() { return displayLensDistortionViewer.checked ? "distortion" : "hdr" }),
'sfmRequired': Qt.binding(function() { return displayLensDistortionViewer.checked ? true : false }),
'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null }),
'canBeHovered': false,
'idView': Qt.binding(function() { return (_reconstruction ? _reconstruction.selectedViewId : -1); }),
'idView': Qt.binding(function() { return (_reconstruction ? _reconstruction.selectedViewId : -1) }),
'cropFisheye': false,
'sequence': Qt.binding(function() { return ((root.enableSequencePlayer && _reconstruction && _reconstruction.viewpoints.count > 0) ? getSequence() : []); }),
'targetSize': Qt.binding(function() { return floatImageViewerLoader.targetSize; }),
'useSequence': Qt.binding(function() { return root.enableSequencePlayer && !useExternal && _reconstruction; }),
'sequence': Qt.binding(function() { return ((root.enableSequencePlayer && _reconstruction && _reconstruction.viewpoints.count > 0) ? getSequence() : []) }),
'targetSize': Qt.binding(function() { return floatImageViewerLoader.targetSize }),
'useSequence': Qt.binding(function() { return root.enableSequencePlayer && !useExternal && _reconstruction }),
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
// Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
fittedOnce = false
}
@ -503,20 +496,20 @@ FocusScope {
onActiveChanged: {
if (active) {
setSource("PanoramaViewer.qml", {
'subdivisionsPano': Qt.binding(function(){ return panoramaViewerToolbar.subdivisionsValue;}),
'cropFisheyePano': Qt.binding(function(){ return root.cropFisheye;}),
'downscale': Qt.binding(function(){ return panoramaViewerToolbar.downscaleValue;}),
'isEditable': Qt.binding(function(){ return panoramaViewerToolbar.enableEdit;}),
'isHighlightable': Qt.binding(function(){ return panoramaViewerToolbar.enableHover;}),
'displayGridPano': Qt.binding(function(){ return panoramaViewerToolbar.displayGrid;}),
'mouseMultiplier': Qt.binding(function(){ return panoramaViewerToolbar.mouseSpeed;}),
'subdivisionsPano': Qt.binding(function() { return panoramaViewerToolbar.subdivisionsValue }),
'cropFisheyePano': Qt.binding(function() { return root.cropFisheye }),
'downscale': Qt.binding(function() { return panoramaViewerToolbar.downscaleValue }),
'isEditable': Qt.binding(function() { return panoramaViewerToolbar.enableEdit }),
'isHighlightable': Qt.binding(function() { return panoramaViewerToolbar.enableHover }),
'displayGridPano': Qt.binding(function() { return panoramaViewerToolbar.displayGrid }),
'mouseMultiplier': Qt.binding(function() { return panoramaViewerToolbar.mouseSpeed }),
'msfmData': Qt.binding(function() { return (msfmDataLoader && msfmDataLoader.item && msfmDataLoader.status === Loader.Ready
&& msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null; }),
&& msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null }),
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
// Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
displayPanoramaViewer.checked = false;
displayPanoramaViewer.checked = false
}
}
}
@ -584,31 +577,30 @@ FocusScope {
onActiveChanged: {
if (active) {
// instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
// Instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
setSource("FeaturesViewer.qml", {
'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; }),
'tracks': Qt.binding(function() { return mtracksLoader.status === Loader.Ready ? mtracksLoader.item : null; }),
'sfmData': Qt.binding(function() { return msfmDataLoader.status === Loader.Ready ? msfmDataLoader.item : null; }),
'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 }),
'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 {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
// Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
}
}
}
// FisheyeCircleViewer: display fisheye circle
// note: use a Loader to evaluate if a PanoramaInit node exist and displayFisheyeCircle checked at runtime
// Note: use a Loader to evaluate if a PanoramaInit node exist and displayFisheyeCircle checked at runtime
ExifOrientedViewer {
anchors.centerIn: parent
orientationTag: imgContainer.orientationTag
xOrigin: imgContainer.width / 2
yOrigin: imgContainer.height / 2
property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("PanoramaInit").node : null
active: (displayFisheyeCircleLoader.checked && activeNode)
active: displayFisheyeCircleLoader.checked && activeNode
sourceComponent: CircleGizmo {
width: imgContainer.width
@ -627,17 +619,15 @@ FocusScope {
circleBorder.width: Math.max(1, (3.0 / imgContainer.scale))
onMoved: {
if(!useAuto)
{
if (!useAuto) {
_reconstruction.setAttribute(
activeNode.attribute("fisheyeCenterOffset"),
JSON.stringify([xoffset, yoffset])
);
)
}
}
onIncrementRadius: {
if(!useAuto)
{
if (!useAuto) {
_reconstruction.setAttribute(activeNode.attribute("fisheyeRadius"), activeNode.attribute("fisheyeRadius").value + radiusOffset)
}
}
@ -651,7 +641,7 @@ FocusScope {
xOrigin: imgContainer.width / 2
yOrigin: imgContainer.height / 2
property var activeNode: _reconstruction.activeNodes.get("SphereDetection").node
active: (displayLightingCircleLoader.checked && activeNode)
active: displayLightingCircleLoader.checked && activeNode
sourceComponent: CircleGizmo {
width: imgContainer.width
@ -668,7 +658,7 @@ FocusScope {
_reconstruction.setAttribute(
activeNode.attribute("sphereCenter"),
JSON.stringify([xoffset, yoffset])
);
)
}
onIncrementRadius: {
_reconstruction.setAttribute(activeNode.attribute("sphereRadius"), activeNode.attribute("sphereRadius").value + radiusOffset)
@ -774,13 +764,12 @@ FocusScope {
metadata: {
if (visible) {
if (root.useExternal || outputAttribute.name != "gallery") {
return m.imgMetadata;
}
else {
return m.viewpointMetadata;
return m.imgMetadata
} else {
return m.viewpointMetadata
}
}
return {};
return {}
}
}
@ -801,9 +790,9 @@ FocusScope {
property bool isUsed: displayFeatures.checked
property var activeNode: {
if (!root.aliceVisionPluginAvailable) {
return null;
return null
}
return _reconstruction ? _reconstruction.activeNodes.get("featureProvider").node : null;
return _reconstruction ? _reconstruction.activeNodes.get("featureProvider").node : null
}
property bool isComputed: activeNode && activeNode.isComputed
active: isUsed && isComputed
@ -814,37 +803,36 @@ FocusScope {
// so it can fail safely if the c++ plugin is not available
setSource("MFeatures.qml", {
'describerTypes': Qt.binding(function() {
return activeNode ? activeNode.attribute("describerTypes").value : {};
return activeNode ? activeNode.attribute("describerTypes").value : {}
}),
'featureFolders': Qt.binding(function() {
let result = [];
let result = []
if (activeNode) {
if (activeNode.nodeType == "FeatureExtraction" && isComputed) {
result.push(activeNode.attribute("output").value);
result.push(activeNode.attribute("output").value)
} else if (activeNode.hasAttribute("featuresFolders")) {
for (let i = 0; i < activeNode.attribute("featuresFolders").value.count; i++) {
let attr = activeNode.attribute("featuresFolders").value.at(i);
result.push(attr.value);
let attr = activeNode.attribute("featuresFolders").value.at(i)
result.push(attr.value)
}
}
}
return result;
return result
}),
'viewIds': Qt.binding(function() {
if (_reconstruction) {
let result = [];
for (let i = 0; i < _reconstruction.viewpoints.count; i++) {
let vp = _reconstruction.viewpoints.at(i);
result.push(vp.childAttribute("viewId").value);
let vp = _reconstruction.viewpoints.at(i)
result.push(vp.childAttribute("viewId").value)
}
return result;
return result
}
return {};
return {}
}),
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
// Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
}
}
@ -852,33 +840,34 @@ FocusScope {
Loader {
id: msfmDataLoader
property bool isUsed: displayFeatures.checked || displaySfmStatsView.checked || displaySfmDataGlobalStats.checked || displayPanoramaViewer.checked || displayLensDistortionViewer.checked
property bool isUsed: displayFeatures.checked || displaySfmStatsView.checked || displaySfmDataGlobalStats.checked
|| displayPanoramaViewer.checked || displayLensDistortionViewer.checked
property var activeNode: {
if (!root.aliceVisionPluginAvailable) {
return null;
return null
}
var nodeType = "sfm";
var nodeType = "sfm"
if (displayLensDistortionViewer.checked) {
nodeType = "sfmData";
nodeType = "sfmData"
}
var sfmNode = _reconstruction ? _reconstruction.activeNodes.get(nodeType).node : null;
var sfmNode = _reconstruction ? _reconstruction.activeNodes.get(nodeType).node : null
if (sfmNode === null) {
return null;
return null
}
if (displayPanoramaViewer.checked) {
sfmNode = _reconstruction.activeNodes.get('SfMTransform').node;
var previousNode = sfmNode.attribute("input").rootLinkParam.node;
return previousNode;
sfmNode = _reconstruction.activeNodes.get('SfMTransform').node
var previousNode = sfmNode.attribute("input").rootLinkParam.node
return previousNode
}
return sfmNode;
return sfmNode
}
property bool isComputed: activeNode && activeNode.isComputed
property string filepath: {
var sfmValue = "";
var sfmValue = ""
if (isComputed && activeNode.hasAttribute("output")) {
sfmValue = activeNode.attribute("output").value;
sfmValue = activeNode.attribute("output").value
}
return Filepath.stringToUrl(sfmValue);
return Filepath.stringToUrl(sfmValue)
}
active: isUsed && isComputed
@ -888,7 +877,7 @@ FocusScope {
// instantiate and initialize a SfmStatsView component dynamically using Loader.setSource
// so it can fail safely if the c++ plugin is not available
setSource("MSfMData.qml", {
'sfmDataPath': Qt.binding(function() { return filepath; }),
'sfmDataPath': Qt.binding(function() { return filepath }),
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
@ -902,9 +891,9 @@ FocusScope {
property bool isUsed: displayFeatures.checked || displaySfmStatsView.checked || displaySfmDataGlobalStats.checked || displayPanoramaViewer.checked
property var activeNode: {
if (!root.aliceVisionPluginAvailable) {
return null;
return null
}
return _reconstruction ? _reconstruction.activeNodes.get("matchProvider").node : null;
return _reconstruction ? _reconstruction.activeNodes.get("matchProvider").node : null
}
property bool isComputed: activeNode && activeNode.isComputed
@ -916,22 +905,22 @@ FocusScope {
// so it can fail safely if the c++ plugin is not available
setSource("MTracks.qml", {
'matchingFolders': Qt.binding(function() {
let result = [];
let result = []
if (activeNode) {
if (activeNode.nodeType == "FeatureMatching" && isComputed) {
result.push(activeNode.attribute("output").value);
result.push(activeNode.attribute("output").value)
} else if (activeNode.hasAttribute("matchesFolders")) {
for (let i = 0; i < activeNode.attribute("matchesFolders").value.count; i++) {
let attr = activeNode.attribute("matchesFolders").value.at(i);
result.push(attr.value);
let attr = activeNode.attribute("matchesFolders").value.at(i)
result.push(attr.value)
}
}
}
return result;
return result
}),
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
// Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
}
}
@ -946,8 +935,8 @@ FocusScope {
// (necessary since Qt 5.14, Component.onCompleted cannot be used anymore to load the data once and for all)
if (active) {
setSource("SfmStatsView.qml", {
"msfmData": Qt.binding(function() { return msfmDataLoader.item; }),
"viewId": Qt.binding(function() { return _reconstruction.selectedViewId; }),
"msfmData": Qt.binding(function() { return msfmDataLoader.item }),
"viewId": Qt.binding(function() { return _reconstruction.selectedViewId }),
})
} else {
setSource("", {})
@ -964,8 +953,8 @@ FocusScope {
// (necessary since Qt 5.14, Component.onCompleted cannot be used anymore to load the data once and for all)
if (active) {
setSource("SfmGlobalStats.qml", {
'msfmData': Qt.binding(function() { return msfmDataLoader.item; }),
'mTracks': Qt.binding(function() { return mtracksLoader.item; }),
'msfmData': Qt.binding(function() { return msfmDataLoader.item }),
'mTracks': Qt.binding(function() { return mtracksLoader.item }),
})
} else {
@ -1026,12 +1015,11 @@ FocusScope {
onClicked: {
if (mouse.button & Qt.LeftButton) {
fit()
}
else if(mouse.button & Qt.RightButton) {
var menu = contextMenu.createObject(root);
} else if (mouse.button & Qt.RightButton) {
var menu = contextMenu.createObject(root)
var point = mapToItem(root, mouse.x, mouse.y)
menu.x = point.x;
menu.y = point.y;
menu.x = point.x
menu.y = point.y
menu.open()
}
}
@ -1062,7 +1050,7 @@ FocusScope {
visible: root.enable8bitViewer
onCheckedChanged : {
if (displayLensDistortionViewer.checked && checked) {
displayLensDistortionViewer.checked = false;
displayLensDistortionViewer.checked = false
}
root.useFloatImageViewer = !root.useFloatImageViewer
}
@ -1072,18 +1060,16 @@ FocusScope {
property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('sfmData').node : null
property bool isComputed: {
if (!activeNode)
return false;
return false
if (activeNode.isComputed)
{
return true;
}
return true
if (!activeNode.hasAttribute("input"))
return false;
var inputAttr = activeNode.attribute("input");
var inputAttrLink = inputAttr.rootLinkParam;
return false
var inputAttr = activeNode.attribute("input")
var inputAttrLink = inputAttr.rootLinkParam
if (!inputAttrLink)
return false;
return inputAttrLink.node.isComputed;
return false
return inputAttrLink.node.isComputed
}
ToolTip.text: "Lens Distortion Viewer" + (isComputed ? (": " + activeNode.label) : "")
@ -1096,10 +1082,10 @@ FocusScope {
enabled: activeNode && isComputed
onCheckedChanged : {
if ((displayHDR.checked || displayPanoramaViewer.checked) && checked) {
displayHDR.checked = false;
displayPanoramaViewer.checked = false;
displayHDR.checked = false
displayPanoramaViewer.checked = false
} else if (!checked) {
displayHDR.checked = true;
displayHDR.checked = true
}
}
}
@ -1108,16 +1094,16 @@ FocusScope {
property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('SfMTransform').node : null
property bool isComputed: {
if (!activeNode)
return false;
return false
if (activeNode.attribute("method").value !== "manual")
return false;
var inputAttr = activeNode.attribute("input");
return false
var inputAttr = activeNode.attribute("input")
if (!inputAttr)
return false;
var inputAttrLink = inputAttr.rootLinkParam;
return false
var inputAttrLink = inputAttr.rootLinkParam
if (!inputAttrLink)
return false;
return inputAttrLink.node.isComputed;
return false
return inputAttrLink.node.isComputed
}
ToolTip.text: activeNode ? "Panorama Viewer " + activeNode.label : "Panorama Viewer"
@ -1130,15 +1116,15 @@ FocusScope {
enabled: activeNode && isComputed
onCheckedChanged : {
if (displayLensDistortionViewer.checked && checked) {
displayLensDistortionViewer.checked = false;
displayLensDistortionViewer.checked = false
}
if (displayFisheyeCircleLoader.checked && checked) {
displayFisheyeCircleLoader.checked = false;
displayFisheyeCircleLoader.checked = false
}
}
onEnabledChanged : {
if (!enabled) {
checked = false;
checked = false
}
}
}
@ -1152,7 +1138,7 @@ FocusScope {
checked: false
enabled: root.aliceVisionPluginAvailable && !displayPanoramaViewer.checked
onEnabledChanged : {
if(enabled == false) checked = false;
if (enabled == false) checked = false
}
}
MaterialToolButton {
@ -1197,8 +1183,7 @@ FocusScope {
checked = false
}
onCheckedChanged: {
if(checked == true)
{
if (checked == true) {
displaySfmDataGlobalStats.checked = false
displaySfmStatsView.checked = false
metadataCB.checked = false
@ -1252,7 +1237,7 @@ FocusScope {
Layout.preferredWidth: model.reduce((acc, label) => Math.max(acc, fontMetrics.boundingRect(label).width), 0) + 3.0 * Qt.application.font.pixelSize
onNameChanged: {
root.source = getImageFile();
root.source = getImageFile()
}
}
@ -1268,7 +1253,7 @@ FocusScope {
root.viewIn3D(
root.source,
displayedNode.name + ":" + outputAttribute.name + " " + String(_reconstruction.selectedViewId)
);
)
}
}
@ -1338,15 +1323,13 @@ FocusScope {
flat: true
checkable: enabled
onCheckedChanged: {
if(checked == true)
{
if (checked == true) {
displaySfmDataGlobalStats.checked = false
displaySfmStatsView.checked = false
displayColorCheckerViewerLoader.checked = false
}
}
}
}
}
@ -1378,7 +1361,7 @@ FocusScope {
onVisibleChanged: {
if (panoramaViewerLoader.active)
fit();
fit()
}
}
}