[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()
@ -125,7 +122,7 @@ FloatingPane {
checkState: legend.buttonGroup.checkState
onClicked: {
const _checked = checked
for(let i = 0; i < responseChart.count; ++i) {
for (let i = 0; i < responseChart.count; ++i) {
responseChart.series(i).visible = _checked
}
}

View file

@ -51,27 +51,27 @@ Item {
property bool controlModifierEnabled: false
onPositionChanged: {
mArea.controlModifierEnabled = (mouse.modifiers & Qt.ControlModifier)
mouse.accepted = false;
mouse.accepted = false
}
acceptedButtons: Qt.LeftButton
hoverEnabled: true
drag.target: circle
drag.onActiveChanged: {
if(!drag.active) {
root.moved(circle.x - (root.width - circle.width) / 2, circle.y - (root.height - circle.height) / 2);
if (!drag.active) {
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

@ -36,7 +36,7 @@ Item {
m[0][0], m[0][1], 0, m[0][2],
m[1][0], m[1][1], 0, m[1][2],
0, 0, 1, 0,
m[2][0], m[2][1], 0, m[2][2] )
m[2][0], m[2][1], 0, m[2][2])
}
}

View file

@ -30,8 +30,8 @@ FloatingPane {
Rectangle {
id: cell
width: root.width / grid.columns - grid.spacing * (grid.columns+1) / grid.columns
height: root.height / grid.rows - grid.spacing * (grid.rows+1) / grid.rows
width: root.width / grid.columns - grid.spacing * (grid.columns + 1) / grid.columns
height: root.height / grid.rows - grid.spacing * (grid.rows + 1) / grid.rows
color: Qt.rgba(modelData.r, modelData.g, modelData.b, 1.0)
}

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

@ -19,27 +19,26 @@ AliceVision.FloatImageViewer {
property int paintedWidth: sourceSize.width
property int paintedHeight: sourceSize.height
property var status: {
if(root.loading)
if (root.loading)
return Image.Loading;
else if((root.source === "") ||
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,20 +76,20 @@ 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
}
}
function onChangedHighlightState(isHighlightable){
function onChangedHighlightState(isHighlightable) {
if (!isHighlightable) root.surface.mouseOver = 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

@ -13,9 +13,9 @@ FloatingPane {
property real gainDefaultValue: 1.0
property real gammaDefaultValue: 1.0
function resetDefaultValues(){
gainCtrl.value = root.gainDefaultValue;
gammaCtrl.value = root.gammaDefaultValue;
function resetDefaultValues() {
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 {
@ -80,7 +80,7 @@ FloatingPane {
selectByMouse: true
validator: doubleValidator
onAccepted: {
gainCtrl.value = Math.pow(Number(gainLabel.text), 1.0/slidersPowerValue)
gainCtrl.value = Math.pow(Number(gainLabel.text), 1.0 / slidersPowerValue)
}
}
Slider {
@ -120,7 +120,7 @@ FloatingPane {
selectByMouse: true
validator: doubleValidator
onAccepted: {
gammaCtrl.value = Math.pow(Number(gammaLabel.text), 1.0/slidersPowerValue)
gammaCtrl.value = Math.pow(Number(gammaLabel.text), 1.0 / slidersPowerValue)
}
}
Slider {
@ -148,7 +148,7 @@ FloatingPane {
TextField {
id: red
property real value: root.colorRGBA ? root.colorRGBA.x : 0.0
property real value_gamma: Math.pow(value, 1.0/2.2)
property real value_gamma: Math.pow(value, 1.0 / 2.2)
text: root.colorRGBA ? value.toFixed(6) : "--"
Layout.preferredWidth: textMetrics_colorValue.width
@ -192,7 +192,7 @@ FloatingPane {
TextField {
id: blue
property real value: root.colorRGBA ? root.colorRGBA.z : 0.0
property real value_gamma: Math.pow(value, 1.0/2.2)
property real value_gamma: Math.pow(value, 1.0 / 2.2)
text: root.colorRGBA ? value.toFixed(6) : "--"
Layout.preferredWidth: textMetrics_colorValue.width
@ -214,7 +214,7 @@ FloatingPane {
TextField {
id: alpha
property real value: root.colorRGBA ? root.colorRGBA.w : 0.0
property real value_gamma: Math.pow(value, 1.0/2.2)
property real value_gamma: Math.pow(value, 1.0 / 2.2)
text: root.colorRGBA ? value.toFixed(6) : "--"
Layout.preferredWidth: textMetrics_colorValue.width

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
@ -144,16 +123,15 @@ FloatingPane {
Label {
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);
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 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 {
@ -171,13 +171,11 @@ FloatingPane {
}
textFromValue: function(value, locale) {
if(value === 0){
if (value === 0){
return 1
} else {
return "1/" + Math.pow(2, value).toString()
}
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
}
}
@ -44,9 +43,9 @@ AliceVision.PanoramaViewer {
property int idSelected : -1
onIsHighlightableChanged:{
onIsHighlightableChanged: {
for (var i = 0; i < repeater.model; ++i) {
repeater.itemAt(i).item.onChangedHighlightState(isHighlightable);
repeater.itemAt(i).item.onChangedHighlightState(isHighlightable)
}
}
@ -67,44 +66,43 @@ 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){
return radians * (180/Math.PI)
function toDegrees(radians) {
return radians * (180 / Math.PI)
}
function toRadians(degrees){
return degrees * (Math.PI/180)
function toRadians(degrees) {
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;
function limitAngle(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,26 +123,24 @@ 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){
if (highlight) {
idSelected = root.msfmData.viewsIds[i]
}
}
// 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,56 +152,49 @@ 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
//Select the image in the image gallery if clicked
if(xStart == mouse.x && yStart == mouse.y && idSelected != -1){
// Select the image in the image gallery if clicked
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;
for(var i=0; i < nrows+1; ++i){
ctx.moveTo(0, wgrid*i);
ctx.lineTo(width, wgrid*i);
var nrows = height / wgrid
for (var i = 0; i < nrows + 1; ++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);
var ncols = width / wgrid
for (var j = 0; j < ncols + 1; ++j) {
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
@ -262,25 +249,25 @@ AliceVision.PanoramaViewer {
id: floatOneLoader
active: root.readyToLoad
visible: (floatOneLoader.status === Loader.Ready)
z:0
z: 0
property bool imageLoaded: false
property bool loading: false
onImageLoadedChanged: {
imagesLoaded++;
loadRepeaterImages(imagesLoaded);
imagesLoaded++
loadRepeaterImages(imagesLoaded)
}
function loadItem() {
if(!active)
return;
if (!active)
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;
if (repeater.model !== root.msfmData.viewsIds.length) {
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)
}
}
}

File diff suppressed because it is too large Load diff