mirror of https://github.com/qt/qtgraphs.git
Print out a warning if surface series has incorrectly ordered data
If data has been inserted with flipped order (filling Z axis
before X axis), detect it and print out a warning.
Pick-to: 6.9 6.8
Fixes: QTBUG-124738
Change-Id: I17bad88cdc8f0b8e336dc5fa18990cfd6afa46e0
Reviewed-by: Sami Varanka <sami.varanka@qt.io>
Reviewed-by: Kwanghyo Park <kwanghyo.park@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 0a647dded3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
88295d2e37
commit
191214ccc6
|
|
@ -1300,6 +1300,33 @@ QRect QQuickGraphsSurface::calculateSampleSpace(SurfaceModel *model)
|
|||
const bool ascendingX = array.at(0).at(0).x() < array.at(0).at(maxColumn).x();
|
||||
const bool ascendingZ = array.at(0).at(0).z() < array.at(maxRow).at(0).z();
|
||||
|
||||
// Check if Z is filled before X. If it is, or there's something else that is fishy,
|
||||
// print out a warning about incorrectly formed data.
|
||||
bool incorrectDataFormat = false;
|
||||
qreal val = array.at(0).at(0).z();
|
||||
qreal step = array.at(1).at(0).z() - array.at(0).at(0).z();
|
||||
if (maxRow > 1) {
|
||||
if ((val + step * maxRow == array.at(maxRow).at(0).z() && !ascendingZ)
|
||||
|| (val - step * maxRow == array.at(maxRow).at(0).z() && ascendingZ)) {
|
||||
incorrectDataFormat = true;
|
||||
}
|
||||
}
|
||||
val = array.at(0).at(0).x();
|
||||
step = array.at(0).at(1).x() - array.at(0).at(0).x();
|
||||
if (maxColumn > 1) {
|
||||
if ((val + step * maxColumn == array.at(0).at(maxColumn).x() && !ascendingX)
|
||||
|| (val - step * maxColumn == array.at(0).at(maxColumn).x() && ascendingX)) {
|
||||
incorrectDataFormat = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (incorrectDataFormat) {
|
||||
qCWarning(lcProperties3D,
|
||||
"Data might be in an incorrect format. If the graph looks wrong or "
|
||||
"is displayed only partially, verify that rows are filled first, "
|
||||
"and columns after.");
|
||||
}
|
||||
|
||||
if (model->ascendingX != ascendingX) {
|
||||
setIndexDirty(true);
|
||||
model->ascendingX = ascendingX;
|
||||
|
|
|
|||
Loading…
Reference in New Issue