add iamge panel
This commit is contained in:
parent
06a91d4cf1
commit
6040a3f698
@ -296,5 +296,16 @@ void FileManagerMenu::AddPolarFile()
|
||||
|
||||
void FileManagerMenu::AddImageFile()
|
||||
{
|
||||
|
||||
auto current = WorkSpaceManager::Get().GetCurrent();
|
||||
if (nullptr == current) {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Show light file addition dialog
|
||||
auto dialog = AddFileDialogFactory::createDialog(FileEntryType::Image, &MainFrame::Get());
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
|
||||
SaveWorkSpace();
|
||||
}
|
||||
}
|
||||
@ -44,11 +44,9 @@ void ImagePanel::RefreshPanel()
|
||||
|
||||
void ImagePanel::InitUI()
|
||||
{
|
||||
|
||||
QHBoxLayout* mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
//mainLayout->addWidget(m_pTableWidget);
|
||||
setLayout(mainLayout);
|
||||
QGridLayout* pMainLyt = new QGridLayout(this);
|
||||
pMainLyt->setContentsMargins(5, 0, 5, 0);
|
||||
setLayout(pMainLyt);
|
||||
}
|
||||
|
||||
QString ImagePanel::GetTypeDisplayName() const
|
||||
|
||||
@ -612,7 +612,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include "AddTableFileDlg.h"
|
||||
#include "AddLightFileDlg.h"
|
||||
#include "AddPolarFileDlg.h"
|
||||
#include "AddImageFileDlg.h"
|
||||
|
||||
BaseAddFileDlg* AddFileDialogFactory::createDialog(FileEntryType type, QWidget* parent) {
|
||||
switch (type) {
|
||||
@ -19,6 +20,8 @@ BaseAddFileDlg* AddFileDialogFactory::createDialog(FileEntryType type, QWidget*
|
||||
return new AddLightFileDlg(parent);
|
||||
case FileEntryType::Polar:
|
||||
return new AddPolarFileDlg(parent);
|
||||
case FileEntryType::Image:
|
||||
return new AddImageFileDlg(parent);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
848
src/ui/WorkSpace/AddImageDlg.ui
Normal file
848
src/ui/WorkSpace/AddImageDlg.ui
Normal file
@ -0,0 +1,848 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddImageDlg</class>
|
||||
<widget class="QWidget" name="AddImageDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>580</width>
|
||||
<height>756</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Image</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="fileGroupBox">
|
||||
<property name="title">
|
||||
<string>File Selection</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="fileGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="filePathLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="filePathEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Select curve data file...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectFileBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fileNameLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileNameValue">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="fileSizeLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileSizeValue">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="axisRangeGroupBox">
|
||||
<property name="title">
|
||||
<string>Angular Axis</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="xTitleLabel_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="TitleEdit_Angular">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="xMinLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Min:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="SpinBox_Min_Angular">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="yMinLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="SpinBox_Max_Angular">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="xCountLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="SpinBox_Count_Angular">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>13</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="xTitleLabel_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="TitleEdit_Unit_Angular">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter axis Unit...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QGroupBox" name="axisRangeGroupBox_2">
|
||||
<property name="title">
|
||||
<string>Radial Axis</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="xTitleLabel_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="TitleEdit_Radial">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="xMinLabel_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Min:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="SpinBox_Min_Radial">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="yMinLabel_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="SpinBox_Max_Radial">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="xCountLabel_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="SpinBox_Count_Radial">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="xTitleLabel_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="TitleEdit_Unit_Radial">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter axis Unit...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="curveGroupBox">
|
||||
<property name="title">
|
||||
<string>Curve Management</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="curveVerticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="curveButtonLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="curveListLabel">
|
||||
<property name="text">
|
||||
<string>Curves:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="curveButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addCurveBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeCurveBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="curveListWidget">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="curvePropertiesGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Selected Curve Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="curvePropertiesGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="curveNameLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="curveNameEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter curve name...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="curveColorLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="colorLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="colorButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="colorPreview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string>background-color: rgb(255, 0, 0); border: 1px solid black;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="colorSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="dataStartLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angular:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="SpinBox_Angular">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="dataStopLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Radial:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="SpinBox_Radial">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="xValueLabel">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X Value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="xValueSpinBox">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="yValueLabel">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Y Value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="yValueSpinBox">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add File</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="chartGroupBox">
|
||||
<property name="title">
|
||||
<string>Chart Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="chartGridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="SpinBox_time">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="timeParamLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="chartNameLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chart Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="chartNameEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chart 1</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter chart name...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
593
src/ui/WorkSpace/AddImageFileDlg.cpp
Normal file
593
src/ui/WorkSpace/AddImageFileDlg.cpp
Normal file
@ -0,0 +1,593 @@
|
||||
#include "AddImageFileDlg.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QColorDialog>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "workspace/WorkSpace.h"
|
||||
#include "workspace/WorkSpaceManager.h"
|
||||
|
||||
#include "ui_AddImageDlg.h"
|
||||
|
||||
AddImageFileDlg::AddImageFileDlg(QWidget* parent)
|
||||
: BaseAddFileDlg(FileEntryType::Polar, parent)
|
||||
, ui(new Ui::AddImageDlg)
|
||||
, currentCurveIndex_(-1)
|
||||
, selectedColor_(255, 0, 0)
|
||||
{
|
||||
|
||||
SetupUI(ui);
|
||||
SetTitle(getDialogTitle());
|
||||
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
AddImageFileDlg::~AddImageFileDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
QString AddImageFileDlg::getFileFilter() const
|
||||
{
|
||||
return tr("Data Files (*.txt *.csv *.dat);;All Files (*.*)");
|
||||
}
|
||||
|
||||
QString AddImageFileDlg::getDialogTitle() const
|
||||
{
|
||||
return tr("Add Image");
|
||||
}
|
||||
|
||||
bool AddImageFileDlg::validateSpecificParams()
|
||||
{
|
||||
// File path validation
|
||||
const QString& selectFilePath = getSelectedFilePath();
|
||||
if (selectFilePath.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Please select a data file."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// File existence validation
|
||||
QFileInfo fileInfo(selectFilePath);
|
||||
if (!fileInfo.exists())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Selected file does not exist."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// File readability validation
|
||||
if (!fileInfo.isReadable())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Selected file is not readable. Please check file permissions."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// File size validation (avoid memory issues with large files)
|
||||
if (fileInfo.size() > 100 * 1024 * 1024)
|
||||
{ // 100MB limit
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("File is too large (over 100MB). Please select a smaller file."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Curve count validation
|
||||
if (curves_.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("At least one curve must be defined."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save current curve properties
|
||||
if (currentCurveIndex_ >= 0)
|
||||
{
|
||||
saveCurveProperties();
|
||||
}
|
||||
|
||||
// Curve name uniqueness validation
|
||||
QStringList curveNames;
|
||||
for (int i = 0; i < curves_.size(); ++i)
|
||||
{
|
||||
const FileEntryPolar::LineProperty& curve = curves_[i];
|
||||
|
||||
if (curve.name.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve %1 name cannot be empty.").arg(i + 1));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (curveNames.contains(curve.name))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve name '%1' is duplicated. Please use different names.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
curveNames.append(curve.name);
|
||||
|
||||
// Curve name length validation
|
||||
if (curve.name.length() > 50)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve name '%1' is too long. Please limit to 50 characters.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Report type validation - ensure x and y values are reasonable
|
||||
if (curve.Angular < -1000000 || curve.Angular > 1000000)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve '%1' X value is out of range. Please ensure it is between -1000000 and 1000000.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (curve.Radial < -1000000 || curve.Radial > 1000000)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve '%1' Y value is out of range. Please ensure it is between -1000000 and 1000000.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Chart properties validation
|
||||
if (ui->chartNameEdit->text().isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Chart name cannot be empty."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui->chartNameEdit->text().length() > 100)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Chart name is too long. Please limit to 100 characters."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Axis range validation
|
||||
double AngularMin = ui->SpinBox_Min_Angular->value();
|
||||
double AngularMax = ui->SpinBox_Max_Angular->value();
|
||||
double RadialMin = ui->SpinBox_Min_Radial->value();
|
||||
double RadialMax = ui->SpinBox_Max_Radial->value();
|
||||
|
||||
if (AngularMin > AngularMax)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Angular axis minimum value must be less than maximum value."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (RadialMin > RadialMax)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Radial axis minimum value must be less than maximum value."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Time parameter validation
|
||||
double timeParam = ui->SpinBox_time->value();
|
||||
if (timeParam < 0)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Time parameter cannot be negative."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddImageFileDlg::updateFileInfo(const QString& filePath)
|
||||
{
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (fileInfo.exists()) {
|
||||
ui->fileNameValue->setText(fileInfo.fileName());
|
||||
qint64 size = fileInfo.size();
|
||||
QString sizeText;
|
||||
if (size < 1024) {
|
||||
sizeText = QString("%1 B").arg(size);
|
||||
}
|
||||
else if (size < 1024 * 1024) {
|
||||
sizeText = QString("%1 KB").arg(size / 1024.0, 0, 'f', 1);
|
||||
}
|
||||
else {
|
||||
sizeText = QString("%1 MB").arg(size / (1024.0 * 1024.0), 0, 'f', 1);
|
||||
}
|
||||
ui->fileSizeValue->setText(sizeText);
|
||||
}
|
||||
else {
|
||||
ui->fileNameValue->setText("-");
|
||||
ui->fileSizeValue->setText("-");
|
||||
}
|
||||
|
||||
ui->filePathEdit->setText(filePath);
|
||||
}
|
||||
|
||||
void AddImageFileDlg::setupConnections()
|
||||
{
|
||||
// File selection connections
|
||||
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddImageFileDlg::OnSelectFile);
|
||||
|
||||
// Curve management connections
|
||||
connect(ui->addCurveBtn, &QPushButton::clicked, this, &AddImageFileDlg::onAddCurveClicked);
|
||||
connect(ui->removeCurveBtn, &QPushButton::clicked, this, &AddImageFileDlg::onRemoveCurveClicked);
|
||||
connect(ui->curveListWidget, &QListWidget::currentRowChanged, this, &AddImageFileDlg::onCurveSelectionChanged);
|
||||
connect(ui->curveListWidget, &QListWidget::itemClicked, this, &AddImageFileDlg::onCurveListWidgetItemClicked);
|
||||
|
||||
// Curve properties connections
|
||||
connect(ui->colorButton, &QPushButton::clicked, this, &AddImageFileDlg::onColorButtonClicked);
|
||||
connect(ui->curveNameEdit, &QLineEdit::textChanged, this, &AddImageFileDlg::onCurveNameChanged);
|
||||
connect(ui->SpinBox_Angular, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddImageFileDlg::onCurveDataChanged);
|
||||
connect(ui->SpinBox_Radial, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddImageFileDlg::onCurveDataChanged);
|
||||
|
||||
// Dialog buttons
|
||||
connect(ui->addBtn, &QPushButton::clicked, this, &AddImageFileDlg::onSure);
|
||||
connect(ui->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onColorButtonClicked()
|
||||
{
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size())
|
||||
{
|
||||
QColor color = QColorDialog::getColor(curves_[currentCurveIndex_].color, this, "Select Curve Color");
|
||||
if (color.isValid())
|
||||
{
|
||||
curves_[currentCurveIndex_].color = color;
|
||||
selectedColor_ = color;
|
||||
updateColorPreview(color);
|
||||
|
||||
// Update list item text
|
||||
QListWidgetItem* item = ui->curveListWidget->item(currentCurveIndex_);
|
||||
if (item)
|
||||
{
|
||||
QString itemText = QString("%1 (%2,%3) (%4,%5,%6)")
|
||||
.arg(curves_[currentCurveIndex_].name)
|
||||
.arg(curves_[currentCurveIndex_].Angular)
|
||||
.arg(curves_[currentCurveIndex_].Radial)
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue());
|
||||
|
||||
item->setText(itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::updateColorPreview(const QColor& color)
|
||||
{
|
||||
QString styleSheet = QString("background-color: rgb(%1, %2, %3); border: 1px solid black;")
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue());
|
||||
ui->colorPreview->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onAddCurveClicked()
|
||||
{
|
||||
// Save current curve properties if any curve is selected
|
||||
if (currentCurveIndex_ >= 0)
|
||||
{
|
||||
saveCurveProperties();
|
||||
}
|
||||
|
||||
// Create new curve with default properties based on chart type
|
||||
FileEntryPolar::LineProperty newCurve;
|
||||
newCurve.name = generateCurveName();
|
||||
newCurve.color = generateCurveColor();
|
||||
newCurve.Angular = 0.0;
|
||||
newCurve.Radial = 0.0;
|
||||
|
||||
// Add to curves list and UI
|
||||
curves_.append(newCurve);
|
||||
|
||||
// Add to UI list widget with appropriate display format
|
||||
QString displayText = QString("%1 (%2,%3) (%4,%5,%6)")
|
||||
.arg(newCurve.name)
|
||||
.arg(newCurve.Angular)
|
||||
.arg(newCurve.Radial)
|
||||
.arg(newCurve.color.red())
|
||||
.arg(newCurve.color.green())
|
||||
.arg(newCurve.color.blue());
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(displayText);
|
||||
ui->curveListWidget->addItem(item);
|
||||
++currentCurveIndex_;
|
||||
|
||||
ui->curveNameEdit->setText(newCurve.name);
|
||||
|
||||
// Select the new curve
|
||||
ui->curveListWidget->setCurrentRow(curves_.size() - 1);
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onRemoveCurveClicked()
|
||||
{
|
||||
int currentRow = ui->curveListWidget->currentRow();
|
||||
if (currentRow < 0 || currentRow >= curves_.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow removing the last curve
|
||||
if (curves_.size() <= 0)
|
||||
{
|
||||
QMessageBox::information(this, "Information", "At least one curve must remain.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove from curves list and UI
|
||||
curves_.removeAt(currentRow);
|
||||
delete ui->curveListWidget->takeItem(currentRow);
|
||||
|
||||
// Update current index
|
||||
if (currentRow >= curves_.size())
|
||||
{
|
||||
currentRow = curves_.size() - 1;
|
||||
}
|
||||
|
||||
if (currentRow >= 0)
|
||||
{
|
||||
ui->curveListWidget->setCurrentRow(currentRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentCurveIndex_ = -1;
|
||||
clearCurveProperties();
|
||||
enableCurveProperties(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onCurveListWidgetItemClicked(QListWidgetItem* item)
|
||||
{
|
||||
if (!item)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int clickedIndex = ui->curveListWidget->row(item);
|
||||
|
||||
if (clickedIndex == currentCurveIndex_)
|
||||
{
|
||||
ui->curveNameEdit->setText(curves_[currentCurveIndex_].name);
|
||||
|
||||
ui->SpinBox_Angular->blockSignals(true);
|
||||
ui->SpinBox_Angular->setValue(curves_[currentCurveIndex_].Angular);
|
||||
ui->SpinBox_Angular->blockSignals(false);
|
||||
|
||||
ui->SpinBox_Radial->blockSignals(true);
|
||||
ui->SpinBox_Radial->setValue(curves_[currentCurveIndex_].Radial);
|
||||
ui->SpinBox_Radial->blockSignals(false);
|
||||
|
||||
updateColorPreview(curves_[currentCurveIndex_].color);
|
||||
enableCurveProperties(true);
|
||||
|
||||
ui->curveNameEdit->setFocus();
|
||||
ui->curveNameEdit->selectAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
onCurveSelectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onCurveSelectionChanged()
|
||||
{
|
||||
int currentRow = ui->curveListWidget->currentRow();
|
||||
|
||||
// Save previous curve properties
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size())
|
||||
{
|
||||
saveCurveProperties();
|
||||
}
|
||||
|
||||
currentCurveIndex_ = currentRow;
|
||||
|
||||
if (currentRow >= 0 && currentRow < curves_.size())
|
||||
{
|
||||
// Load selected curve properties
|
||||
updateCurveProperties();
|
||||
enableCurveProperties(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
clearCurveProperties();
|
||||
enableCurveProperties(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onCurveNameChanged()
|
||||
{
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size())
|
||||
{
|
||||
QString newName = ui->curveNameEdit->text();
|
||||
curves_[currentCurveIndex_].name = newName;
|
||||
|
||||
// Update list item text with appropriate format
|
||||
QListWidgetItem* item = ui->curveListWidget->item(currentCurveIndex_);
|
||||
if (item)
|
||||
{
|
||||
QString displayText = QString("%1 (%2,%3) (%4,%5,%6)")
|
||||
.arg(newName)
|
||||
.arg(curves_[currentCurveIndex_].Angular)
|
||||
.arg(curves_[currentCurveIndex_].Radial)
|
||||
.arg(curves_[currentCurveIndex_].color.red())
|
||||
.arg(curves_[currentCurveIndex_].color.green())
|
||||
.arg(curves_[currentCurveIndex_].color.blue());
|
||||
|
||||
item->setText(displayText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::saveCurveProperties()
|
||||
{
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size())
|
||||
{
|
||||
curves_[currentCurveIndex_].name = ui->curveNameEdit->text();
|
||||
|
||||
// Save properties based on chart type
|
||||
curves_[currentCurveIndex_].Angular = ui->SpinBox_Angular->value();
|
||||
curves_[currentCurveIndex_].Radial = ui->SpinBox_Radial->value();
|
||||
|
||||
curves_[currentCurveIndex_].color = selectedColor_;
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::clearCurveProperties()
|
||||
{
|
||||
ui->curveNameEdit->clear();
|
||||
|
||||
// Clear properties based on chart type
|
||||
ui->SpinBox_Angular->setValue(0.0);
|
||||
ui->SpinBox_Radial->setValue(0.0);
|
||||
|
||||
selectedColor_ = QColor(255, 0, 0);
|
||||
updateColorPreview(selectedColor_);
|
||||
}
|
||||
|
||||
void AddImageFileDlg::enableCurveProperties(bool enabled)
|
||||
{
|
||||
ui->curvePropertiesGroupBox->setEnabled(enabled);
|
||||
}
|
||||
|
||||
QString AddImageFileDlg::generateCurveName()
|
||||
{
|
||||
return tr("Curve %1").arg(curves_.size() + 1);
|
||||
}
|
||||
|
||||
QColor AddImageFileDlg::generateCurveColor() const
|
||||
{
|
||||
// Generate different colors for each curve
|
||||
static const QColor colors[] = {
|
||||
QColor(255, 0, 0), // Red
|
||||
QColor(0, 255, 0), // Green
|
||||
QColor(0, 0, 255), // Blue
|
||||
QColor(255, 255, 0), // Yellow
|
||||
QColor(255, 0, 255), // Magenta
|
||||
QColor(0, 255, 255), // Cyan
|
||||
QColor(255, 128, 0), // Orange
|
||||
QColor(128, 0, 255), // Purple
|
||||
};
|
||||
|
||||
int colorIndex = curves_.size() % (sizeof(colors) / sizeof(colors[0]));
|
||||
return colors[colorIndex];
|
||||
}
|
||||
|
||||
void AddImageFileDlg::updateCurveProperties()
|
||||
{
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size())
|
||||
{
|
||||
const FileEntryPolar::LineProperty& curve = curves_[currentCurveIndex_];
|
||||
|
||||
ui->curveNameEdit->setText(curve.name);
|
||||
|
||||
ui->SpinBox_Angular->blockSignals(true);
|
||||
ui->SpinBox_Angular->setValue(curve.Angular);
|
||||
ui->SpinBox_Angular->blockSignals(false);
|
||||
|
||||
ui->SpinBox_Radial->blockSignals(true);
|
||||
ui->SpinBox_Radial->setValue(curve.Radial);
|
||||
ui->SpinBox_Radial->blockSignals(false);
|
||||
|
||||
selectedColor_ = curve.color;
|
||||
updateColorPreview(curve.color);
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onSure()
|
||||
{
|
||||
if (validateSpecificParams())
|
||||
{
|
||||
// Create FileEntryCurve object using factory function
|
||||
auto fileEntryPolar = CreateFileEntryPolar(getSelectedFilePath());
|
||||
if (!fileEntryPolar)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to create file entry"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Set curve properties
|
||||
fileEntryPolar->SetName(ui->chartNameEdit->text());
|
||||
|
||||
// Set chart properties
|
||||
FileEntryPolar::ChartProperties chartProps;
|
||||
chartProps.AngularCount = ui->SpinBox_Count_Angular->value();
|
||||
chartProps.RadialCount = ui->SpinBox_Count_Radial->value();
|
||||
chartProps.AngularTitle = ui->TitleEdit_Angular->text();
|
||||
chartProps.RadialTitle = ui->TitleEdit_Radial->text();
|
||||
chartProps.AngularUnit = ui->TitleEdit_Unit_Angular->text();
|
||||
chartProps.RadialUnit = ui->TitleEdit_Unit_Radial->text();
|
||||
chartProps.AngularMin = ui->SpinBox_Min_Angular->value();
|
||||
chartProps.AngularMax = ui->SpinBox_Max_Angular->value();
|
||||
chartProps.RadialMin = ui->SpinBox_Min_Radial->value();
|
||||
chartProps.RadialMax = ui->SpinBox_Max_Radial->value();
|
||||
chartProps.timeParam = ui->SpinBox_time->value();
|
||||
fileEntryPolar->SetChartProperties(chartProps);
|
||||
|
||||
// Add curve properties
|
||||
for (const auto& curve : curves_)
|
||||
{
|
||||
fileEntryPolar->AddLineProperty(curve);
|
||||
}
|
||||
|
||||
// Get current workspace
|
||||
WorkSpace* workspace = WorkSpaceManager::Get().GetCurrent();
|
||||
if (!workspace)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error"), tr("Unable to get current workspace"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add FileEntryCurve to workspace using new SetFileEntry method
|
||||
auto result = workspace->SetFileEntry(fileEntryPolar);
|
||||
if (result != WorkSpace::FileEntryResult::Ok)
|
||||
{
|
||||
QString errorMsg;
|
||||
switch (result) {
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
errorMsg = tr("Polar file count has reached the limit (9 files)");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
errorMsg = tr("File already exists");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
errorMsg = tr("File copy failed");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
errorMsg = tr("Invalid file");
|
||||
break;
|
||||
default:
|
||||
errorMsg = tr("Failed to add file");
|
||||
break;
|
||||
}
|
||||
QMessageBox::warning(this, tr("Error"), errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to create Polar file entry."));
|
||||
}
|
||||
}
|
||||
|
||||
void AddImageFileDlg::onCurveDataChanged()
|
||||
{
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size())
|
||||
{
|
||||
curves_[currentCurveIndex_].Angular = ui->SpinBox_Angular->value();
|
||||
curves_[currentCurveIndex_].Radial = ui->SpinBox_Radial->value();
|
||||
|
||||
// Update display text in list widget
|
||||
QListWidgetItem* item = ui->curveListWidget->item(currentCurveIndex_);
|
||||
if (item)
|
||||
{
|
||||
QString itemText = QString("%1 (%2,%3) (%4,%5,%6)")
|
||||
.arg(curves_[currentCurveIndex_].name)
|
||||
.arg(curves_[currentCurveIndex_].Angular)
|
||||
.arg(curves_[currentCurveIndex_].Radial)
|
||||
.arg(curves_[currentCurveIndex_].color.red())
|
||||
.arg(curves_[currentCurveIndex_].color.green())
|
||||
.arg(curves_[currentCurveIndex_].color.blue());
|
||||
|
||||
item->setText(itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
61
src/ui/WorkSpace/AddImageFileDlg.h
Normal file
61
src/ui/WorkSpace/AddImageFileDlg.h
Normal file
@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
class QListWidget;
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class AddImageDlg;
|
||||
}
|
||||
|
||||
class AddImageFileDlg : public BaseAddFileDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddImageFileDlg(QWidget* parent = nullptr);
|
||||
~AddImageFileDlg() override;
|
||||
|
||||
protected:
|
||||
QString getFileFilter() const override;
|
||||
QString getDialogTitle() const override;
|
||||
bool validateSpecificParams() override;
|
||||
void updateFileInfo(const QString& filePath) override;
|
||||
|
||||
private slots:
|
||||
void onColorButtonClicked();
|
||||
void onAddCurveClicked();
|
||||
void onRemoveCurveClicked();
|
||||
void onCurveListWidgetItemClicked(class QListWidgetItem* item);
|
||||
void onCurveSelectionChanged();
|
||||
void onCurveNameChanged();
|
||||
void onCurveDataChanged();
|
||||
void onSure();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void updateColorPreview(const QColor& color);
|
||||
void updateCurveProperties();
|
||||
void saveCurveProperties();
|
||||
void clearCurveProperties();
|
||||
void enableCurveProperties(bool enabled);
|
||||
QString generateCurveName();
|
||||
QColor generateCurveColor() const;
|
||||
|
||||
private:
|
||||
Ui::AddImageDlg* ui;
|
||||
int currentCurveIndex_;
|
||||
QColor selectedColor_;
|
||||
|
||||
FileEntryPolar::ChartProperties chartProperties_;
|
||||
FileEntryPolar::LineProperties curves_;
|
||||
};
|
||||
@ -104,7 +104,7 @@ void DYTChart::InitChartData(QVariant var)
|
||||
InitXTable(strFilePathX);
|
||||
InitYTable(strFilePathY);
|
||||
|
||||
// <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 三维曲线
|
||||
if (m_iCurveType == 3)
|
||||
{
|
||||
QString strFilePathZ = varCurParamMap.value("zFile").toString();
|
||||
@ -130,7 +130,7 @@ void DYTChart::InitChart(int iType)
|
||||
ui.comboBox->hide();
|
||||
|
||||
|
||||
if (1 == iType) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (1 == iType) // 二维曲线
|
||||
{
|
||||
/*m_p2DCurve = new FitCurveDialog(1);
|
||||
m_p2DCurve->show();
|
||||
@ -150,7 +150,7 @@ void DYTChart::InitChart(int iType)
|
||||
ui.label_7->hide();
|
||||
ui.toolButton_10->hide();
|
||||
}
|
||||
else if (2 == iType) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (2 == iType) // 二维曲线(y轴对数)
|
||||
{
|
||||
//m_p2DLgCurve = new FitCurveDialog(2);
|
||||
////ui.stackedWidget->insertWidget(0, m_p2DLgCurve);
|
||||
@ -171,7 +171,7 @@ void DYTChart::InitChart(int iType)
|
||||
ui.label_7->hide();
|
||||
ui.toolButton_10->hide();
|
||||
}
|
||||
else // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else // 三维曲线
|
||||
{
|
||||
ui.label_13->hide();
|
||||
ui.comboBox_3->hide();
|
||||
@ -267,11 +267,11 @@ void DYTChart::ParseAntennaPatternFile(const QString& strFile, std::vector<std::
|
||||
{
|
||||
if (strFile.isEmpty())
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<22><>ʾ"), QString::fromLocal8Bit("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>AntennaPattern<72>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据AntennaPattern文件路径!"));
|
||||
return;
|
||||
|
||||
}
|
||||
// <EFBFBD><EFBFBD>ȡz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 读取z轴数据
|
||||
QFile file(strFile);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -296,7 +296,7 @@ void DYTChart::ParseBeamPointFile(const QString& strFile, std::vector<std::vecto
|
||||
{
|
||||
if (strFile.isEmpty())
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<22><>ʾ"), QString::fromLocal8Bit("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BeamPoint<6E>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据BeamPoint文件路径!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ void DYTChart::ParseRD(const QString& strFile, std::vector<std::vector<float>>&
|
||||
{
|
||||
if (strFile.isEmpty())
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<22><>ʾ"), QString::fromLocal8Bit("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RD<52>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据RD文件路径!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ void DYTChart::ParseRD(const QString& strFile, std::vector<std::vector<float>>&
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
int iRow = 0;
|
||||
int iStartReadRow = iRowCount * m_iCurTime; // <EFBFBD><EFBFBD>ʼ <20><>
|
||||
int iStartReadRow = iRowCount * m_iCurTime; // 起始 行
|
||||
while (!file.atEnd())
|
||||
{
|
||||
if (iRow >= iStartReadRow && (iRow - iStartReadRow) <= iRowCount)
|
||||
@ -366,7 +366,7 @@ void DYTChart::ParseWave(const QString& strFile, std::vector<std::vector<float>>
|
||||
{
|
||||
if (strFile.isEmpty())
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<22><>ʾ"), QString::fromLocal8Bit("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Wave<76>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据Wave文件路径!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ void DYTChart::ParseWave(const QString& strFile, std::vector<std::vector<float>>
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
int iRow = 0;
|
||||
int iStartReadRow = iRowCount * m_iCurTime; // <EFBFBD><EFBFBD>ʼ <20><>
|
||||
int iStartReadRow = iRowCount * m_iCurTime; // 起始 行
|
||||
while (!file.atEnd())
|
||||
{
|
||||
if (iRow >= iStartReadRow && (iRow - iStartReadRow) <= iRowCount)
|
||||
@ -769,33 +769,33 @@ void DYTChart::UpdateRDCurve(int iTime, int iSelRowCount)
|
||||
varCurDataList.push_back(varX);
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
||||
// 曲线颜色
|
||||
QColor curColor;
|
||||
curColor.setNamedColor(ui.label_4->text());
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 曲线名称
|
||||
QString strName = ui.lineEdit_2->text();
|
||||
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0һ<30><D2BB>1<EFBFBD><31><EFBFBD><EFBFBD>
|
||||
// y轴类型 0一般1对数
|
||||
int iYType = 0;
|
||||
if (2 == m_iCurveType)
|
||||
{
|
||||
iYType = 1;
|
||||
}
|
||||
|
||||
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// x轴数据
|
||||
QString strFilePathX = ui.lineEdit->text();
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// y轴数据
|
||||
QString strFilePathY = ui.lineEdit_3->text();
|
||||
// Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Z轴数据
|
||||
QString strFilePathZ = ui.lineEdit_9->text();
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 曲线类型
|
||||
//int iCurveType = ui.comboBox_2->currentIndex();
|
||||
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// x标题
|
||||
QString strXTitle = ui.lineEdit_10->text();
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// y标题
|
||||
QString strYTitle = ui.lineEdit_11->text();
|
||||
// z<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// z标题
|
||||
QString strZTitle = ui.lineEdit_12->text();
|
||||
|
||||
int iXCol = 0, iYCol = 0, iZCol = 0;
|
||||
@ -866,10 +866,10 @@ void DYTChart::Clear()
|
||||
|
||||
void DYTChart::slotSelXFile()
|
||||
{
|
||||
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"), "home", "*.txt");
|
||||
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("选择数据文件"), "home", "*.txt");
|
||||
if (strFilePath.isEmpty())
|
||||
{
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请选择有效的文件路径!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -880,10 +880,10 @@ void DYTChart::slotSelXFile()
|
||||
|
||||
void DYTChart::slotSelYFile()
|
||||
{
|
||||
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"), "home", "*.txt");
|
||||
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("选择数据文件"), "home", "*.txt");
|
||||
if (strFilePath.isEmpty())
|
||||
{
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请选择有效的文件路径!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -894,10 +894,10 @@ void DYTChart::slotSelYFile()
|
||||
|
||||
void DYTChart::slotSelZFile()
|
||||
{
|
||||
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"), "home", "*.txt");
|
||||
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("选择数据文件"), "home", "*.txt");
|
||||
if (strFilePath.isEmpty())
|
||||
{
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请选择有效的文件路径!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -997,19 +997,19 @@ void DYTChart::slotAdd()
|
||||
}
|
||||
|
||||
|
||||
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// x轴数据
|
||||
QString strFilePathX = ui.lineEdit->text();
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// y轴数据
|
||||
QString strFilePathY = ui.lineEdit_3->text();
|
||||
// Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Z轴数据
|
||||
QString strFilePathZ = ui.lineEdit_9->text();
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 曲线类型
|
||||
//int iCurveType = ui.comboBox_2->currentIndex();
|
||||
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// x标题
|
||||
QString strXTitle = ui.lineEdit_10->text();
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// y标题
|
||||
QString strYTitle = ui.lineEdit_11->text();
|
||||
// z<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// z标题
|
||||
QString strZTitle = ui.lineEdit_12->text();
|
||||
|
||||
std::vector<float> vecX;
|
||||
@ -1017,7 +1017,7 @@ void DYTChart::slotAdd()
|
||||
std::vector<std::vector<float>> vecZ;
|
||||
|
||||
int iXCol = 0, iYCol = 0, iZCol = 0;
|
||||
// <EFBFBD><EFBFBD>ȡx<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 读取x轴数据
|
||||
{
|
||||
iXCol = ui.comboBox_2->currentIndex();
|
||||
int iRowCount = ui.tableWidget->rowCount();
|
||||
@ -1037,12 +1037,12 @@ void DYTChart::slotAdd()
|
||||
}
|
||||
else
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("X<><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("X轴数据文件加载失败,请检测文件是否正常!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD>ȡy<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 读取y轴数据
|
||||
{
|
||||
iYCol = ui.comboBox_4->currentIndex();
|
||||
int iRowCount = ui.tableWidget_2->rowCount();
|
||||
@ -1059,12 +1059,12 @@ void DYTChart::slotAdd()
|
||||
}
|
||||
else
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("Y<><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("Y轴数据文件加载失败,请检测文件是否正常!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 三维曲线
|
||||
if (m_iCurveType == 3)
|
||||
{
|
||||
//iZCol = ui.comboBox_5->currentIndex();
|
||||
@ -1089,23 +1089,23 @@ void DYTChart::slotAdd()
|
||||
}
|
||||
else
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("Z<><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("Z轴数据文件加载失败,请检测文件是否正常!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD>ȶ<EFBFBD><EFBFBD><EFBFBD>
|
||||
// 对齐两组数据的长度,按最小长度对齐
|
||||
size_t min_size = std::min({ vecX.size(), vecY.size() });
|
||||
if (vecZ.size() > 0)
|
||||
{
|
||||
min_size = std::min({ min_size, vecZ.size() });
|
||||
}
|
||||
|
||||
// <EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 合并数据
|
||||
QVariantList varCurDataList;
|
||||
for (size_t i = 0; i < min_size; i++)
|
||||
{
|
||||
if (m_iCurveType == 3) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (m_iCurveType == 3) // 三维曲线数据
|
||||
{
|
||||
std::vector<float> vecZRow = vecZ[i];
|
||||
|
||||
@ -1128,21 +1128,21 @@ void DYTChart::slotAdd()
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
||||
// 曲线颜色
|
||||
QColor curColor;
|
||||
curColor.setNamedColor(ui.label_4->text());
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 曲线名称
|
||||
QString strName = ui.lineEdit_2->text();
|
||||
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0һ<30><D2BB>1<EFBFBD><31><EFBFBD><EFBFBD>
|
||||
// y轴类型 0一般1对数
|
||||
int iYType = 0;
|
||||
if (2 == m_iCurveType)
|
||||
{
|
||||
iYType = 1;
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
||||
// 曲线ID
|
||||
m_iCurveID++;
|
||||
m_iCurSelID = m_iCurveID;
|
||||
|
||||
@ -1200,19 +1200,19 @@ void DYTChart::slotUpdate()
|
||||
return;
|
||||
}
|
||||
|
||||
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// x轴数据
|
||||
QString strFilePathX = ui.lineEdit->text();
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// y轴数据
|
||||
QString strFilePathY = ui.lineEdit_3->text();
|
||||
// Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Z轴数据
|
||||
QString strFilePathZ = ui.lineEdit_9->text();
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 曲线类型
|
||||
//int iCurveType = ui.comboBox_2->currentIndex();
|
||||
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// x标题
|
||||
QString strXTitle = ui.lineEdit_10->text();
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// y标题
|
||||
QString strYTitle = ui.lineEdit_11->text();
|
||||
// z<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// z标题
|
||||
QString strZTitle = ui.lineEdit_12->text();
|
||||
|
||||
std::vector<float> vecX;
|
||||
@ -1220,7 +1220,7 @@ void DYTChart::slotUpdate()
|
||||
std::vector<std::vector<float>> vecZ;
|
||||
|
||||
int iXCol = 0, iYCol = 0, iZCol = 0;
|
||||
// <EFBFBD><EFBFBD>ȡx<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 读取x轴数据
|
||||
{
|
||||
iXCol = ui.comboBox_2->currentIndex();
|
||||
int iRowCount = ui.tableWidget->rowCount();
|
||||
@ -1240,12 +1240,12 @@ void DYTChart::slotUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
//QMessageBox::information(nullptr, QString::fromLocal8Bit("<22><>ʾ"), QString::fromLocal8Bit("X<><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("X轴数据文件加载失败,请检测文件是否正常!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD>ȡy<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 读取y轴数据
|
||||
{
|
||||
iYCol = ui.comboBox_4->currentIndex();
|
||||
int iRowCount = ui.tableWidget_2->rowCount();
|
||||
@ -1262,12 +1262,12 @@ void DYTChart::slotUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("Y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("Y轴数据文件加载失败,请检测文件是否正常!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 三维曲线
|
||||
if (m_iCurveType == 3)
|
||||
{
|
||||
//iZCol = ui.comboBox_5->currentIndex();
|
||||
@ -1292,23 +1292,23 @@ void DYTChart::slotUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("Z轴数据文件加载失败,请检测文件是否正常!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD>ȶ<EFBFBD><EFBFBD><EFBFBD>
|
||||
// 对齐两组数据的长度,按最小长度对齐
|
||||
size_t min_size = std::min({ vecX.size(), vecY.size() });
|
||||
if (vecZ.size() > 0)
|
||||
{
|
||||
min_size = std::min({ min_size, vecZ.size() });
|
||||
}
|
||||
|
||||
// <EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 合并数据
|
||||
QVariantList varCurDataList;
|
||||
for (size_t i = 0; i < min_size; i++)
|
||||
{
|
||||
if (m_iCurveType == 3) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (m_iCurveType == 3) // 三维曲线数据
|
||||
{
|
||||
std::vector<float> vecZRow = vecZ[i];
|
||||
|
||||
@ -1331,14 +1331,14 @@ void DYTChart::slotUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
||||
// 曲线颜色
|
||||
QColor curColor;
|
||||
curColor.setNamedColor(ui.label_4->text());
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 曲线名称
|
||||
QString strName = ui.lineEdit_2->text();
|
||||
|
||||
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0һ<30><D2BB>1<EFBFBD><31><EFBFBD><EFBFBD>
|
||||
// y轴类型 0一般1对数
|
||||
int iYType = 0;
|
||||
if (2 == m_iCurveType)
|
||||
{
|
||||
@ -1458,7 +1458,7 @@ void DYTChart::slotUpdateTime(double iTime)
|
||||
std::vector<float> vecY;
|
||||
std::vector<std::vector<float>> vecZ;
|
||||
|
||||
// <EFBFBD><EFBFBD>ȡx<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 读取x轴数据
|
||||
{
|
||||
int iRowCount = ui.tableWidget->rowCount();
|
||||
if (iRowCount > 0)
|
||||
@ -1477,7 +1477,7 @@ void DYTChart::slotUpdateTime(double iTime)
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD>ȡy<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 读取y轴数据
|
||||
{
|
||||
int iRowCount = ui.tableWidget_2->rowCount();
|
||||
if (iRowCount > 0)
|
||||
@ -1493,14 +1493,14 @@ void DYTChart::slotUpdateTime(double iTime)
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD>ȶ<EFBFBD><EFBFBD><EFBFBD>
|
||||
// 对齐两组数据的长度,按最小长度对齐
|
||||
size_t min_size = std::min({ vecX.size(), vecY.size() });
|
||||
if (vecZ.size() > 0)
|
||||
{
|
||||
min_size = std::min({ min_size, vecZ.size() });
|
||||
}
|
||||
|
||||
// <EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 合并数据
|
||||
QVariantList varCurDataList;
|
||||
for (size_t i = 0; i < min_size; i++)
|
||||
{
|
||||
|
||||
@ -161,7 +161,7 @@ osgQt::GraphicsWindowQt* OsgWidget::createGraphicsWindow(int x, int y, int w, in
|
||||
traits->alpha = ds->getMinimumNumAlphaBits();
|
||||
traits->stencil = ds->getMinimumNumStencilBits();
|
||||
traits->sampleBuffers = ds->getMultiSamples();
|
||||
traits->samples = ds->getNumMultiSamples();
|
||||
traits->samples = 16/*ds->getNumMultiSamples()*/;
|
||||
|
||||
return new osgQt::GraphicsWindowQt(traits.get());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user