moidy fileentity

This commit is contained in:
brige 2025-10-21 02:17:40 +08:00
parent dc83646fab
commit 963fe4fa76
35 changed files with 1774 additions and 450 deletions

View File

@ -70,7 +70,6 @@ bool LabelComponent::SaveAttribute(tinyxml2::XMLElement* element) {
element->SetAttribute("fontSize", fontSize_);
element->SetAttribute("visible", visible_ ? "true" : "false");
// 保存颜色
char colorStr[64];
sprintf(colorStr, "%.2f,%.2f,%.2f,%.2f", color_.r(), color_.g(), color_.b(), color_.a());
element->SetAttribute("color", colorStr);
@ -148,24 +147,20 @@ void LabelComponent::CreateTextNode() {
return;
}
// 使用布告板来显示文本,确保文本始终面向相机
if (!billboard_.valid()) {
billboard_ = new osg::Billboard();
billboard_->setMode(osg::Billboard::POINT_ROT_EYE);
textNode_ = new osgText::Text();
// 设置文本对齐方式为底部居中,这样文本会显示在指定位置的上方
textNode_->setAlignment(osgText::Text::CENTER_BOTTOM);
textNode_->setAxisAlignment(osgText::Text::SCREEN);
textNode_->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
textNode_->setText(text_);
textNode_->setPosition(osg::Vec3(0.0f, 0.0f, 0.0f)); // 文本相对于布告板的位置
textNode_->setPosition(osg::Vec3(0.0f, 0.0f, 0.0f));
// 直接将文本对象添加到布告板,并设置位置偏移
billboard_->addDrawable(textNode_.get(), osg::Vec3(0.0f, 0.0f, 5.0f));
// 设置渲染状态
osg::StateSet* stateSet = billboard_->getOrCreateStateSet();
stateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);

View File

@ -27,7 +27,6 @@ public:
void End() override;
void AddToRender() override;
// 标签相关方法
void SetText(const std::string& text);
const std::string& GetText() const { return text_; }
@ -55,4 +54,4 @@ protected:
//osg::ref_ptr<class osgScutcheon> scutcheon_;
osg::ref_ptr<osg::Billboard> billboard_;
osg::ref_ptr<osgText::Text> textNode_;
};
};

View File

@ -49,5 +49,5 @@ private:
osg::ref_ptr<osgEarth::Util::SkyNode> skyDome_;
osg::ref_ptr<OESceneUI> sceneUI_;
osgViewer::View* curentView_ {nullptr};
bool homeViewpointSet_ {false}; // 跟踪home viewpoint是否已经设置
bool homeViewpointSet_ {false};
};

View File

@ -1,4 +1,4 @@
#include "scene/ui/QueryElevationWidget.h"
#include "scene/ui/QueryElevationWidget.h"
#include <QString>
#include <osgEarth/MapNode>
@ -58,7 +58,7 @@ void QueryElevationWidget::DetachViewUI(OsgViewUI* ui) {
void QueryElevationWidget::OnUpdateGeoPoint(double x, double y, double z) {
// x 保存小数点后6位 c++14
dyt_check(nullptr != label_);
label_->setLabel(GetElevationString(x, y, z));

View File

@ -1,4 +1,4 @@
#include "ZoomManager.h"
#include "ZoomManager.h"
#include <osgEarthUtil/EarthManipulator>
@ -79,7 +79,7 @@ void ZoomManager::AttachViewUI(OsgViewUI* ui) {
void ZoomManager::slotZoom() {
double val = _zoomNum[0];
double dx = val*(-1.0)*(0.0005);// dx不起作用
double dx = val*(-1.0)*(0.0005);
double dy = val*(-1.0)*(0.0005);
return;

View File

@ -1,6 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>AddFileDlg</name>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="14"/>
<source>Add File to Workspace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="22"/>
<source>File Path</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="38"/>
<source>Select file to add...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="45"/>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="62"/>
<source>File Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="76"/>
<source>Curve Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="81"/>
<source>Surface Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="86"/>
<source>Table Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="91"/>
<source>Light Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="114"/>
<source>File Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="122"/>
<source>File Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="129"/>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="160"/>
<source>-</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="153"/>
<source>File Size:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="187"/>
<source>Description (Optional)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="200"/>
<source>Enter file description...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="237"/>
<source>Add File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="250"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AddParamSetting</name>
<message>
@ -401,83 +490,6 @@
<source>new light file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="52"/>
<source>Dyt (*.dyt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="55"/>
<source>open dyt file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="56"/>
<source>Dyt (*.dyt);;All files (*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
<source>warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
<source>workspace is nullptr</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="88"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="96"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="99"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="102"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="110"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="118"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="121"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="124"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="132"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="139"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="142"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="145"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="153"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="161"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="164"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="167"/>
<source>prompt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="88"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="110"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="132"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="153"/>
<source>please create workspace first</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="96"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="118"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="139"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="161"/>
<source>up to 9 files allowed for this type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="99"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="121"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="142"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="164"/>
<source>file already added for this type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="102"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="124"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="145"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="167"/>
<source>copy file failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FitCurveChartView</name>
@ -494,36 +506,6 @@
<source>FitCurveDialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="640"/>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="666"/>
<source>2D Curve -- %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="642"/>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="649"/>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="669"/>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="677"/>
<source>%1 -- %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="647"/>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="674"/>
<source>2D(y(lg)) Curve -- %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="968"/>
<source>2D Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/chartPlot/FitCurveDialog.cpp" line="979"/>
<source>2D(y(lg)) Curve</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FrameTitleBar</name>
@ -592,132 +574,132 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="61"/>
<location filename="../ui/MainWindow.cpp" line="60"/>
<source>model elements</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="69"/>
<location filename="../ui/MainWindow.cpp" line="68"/>
<source>attribte</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="85"/>
<location filename="../ui/MainWindow.cpp" line="83"/>
<source>Main View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="119"/>
<location filename="../ui/MainWindow.cpp" line="117"/>
<source>Wave Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="128"/>
<location filename="../ui/MainWindow.cpp" line="126"/>
<source>Speed Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="141"/>
<location filename="../ui/MainWindow.cpp" line="139"/>
<source>3D Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="157"/>
<location filename="../ui/MainWindow.cpp" line="155"/>
<source>Target number</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="157"/>
<location filename="../ui/MainWindow.cpp" line="155"/>
<source>Signal-to-noise ratio</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="158"/>
<location filename="../ui/MainWindow.cpp" line="156"/>
<source>Azimuth line of sight</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="158"/>
<location filename="../ui/MainWindow.cpp" line="156"/>
<source>Pitch gaze angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="159"/>
<location filename="../ui/MainWindow.cpp" line="157"/>
<source>azimuth</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="159"/>
<location filename="../ui/MainWindow.cpp" line="157"/>
<source>Pitch angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="160"/>
<location filename="../ui/MainWindow.cpp" line="158"/>
<source>attribute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="160"/>
<location filename="../ui/MainWindow.cpp" line="158"/>
<source>Doppler</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="161"/>
<location filename="../ui/MainWindow.cpp" line="159"/>
<source>course</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="161"/>
<location filename="../ui/MainWindow.cpp" line="159"/>
<source>Speed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="162"/>
<location filename="../ui/MainWindow.cpp" line="160"/>
<source>longitude</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="162"/>
<location filename="../ui/MainWindow.cpp" line="160"/>
<source>latitude</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="163"/>
<location filename="../ui/MainWindow.cpp" line="161"/>
<source>distance</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="163"/>
<location filename="../ui/MainWindow.cpp" line="161"/>
<source>velocity</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="164"/>
<location filename="../ui/MainWindow.cpp" line="162"/>
<source>Radial dimensions</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="164"/>
<location filename="../ui/MainWindow.cpp" line="162"/>
<source>Target RCS</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="170"/>
<location filename="../ui/MainWindow.cpp" line="168"/>
<source>Report Table</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="183"/>
<location filename="../ui/MainWindow.cpp" line="181"/>
<source>Signal Indicator Lamp</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="194"/>
<location filename="../ui/MainWindow.cpp" line="192"/>
<source>ParamSetting</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="203"/>
<location filename="../ui/MainWindow.cpp" line="201"/>
<source>bat File</source>
<translation type="unfinished"></translation>
</message>
@ -995,6 +977,94 @@
<source>Light[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="53"/>
<source>Open Workspace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="53"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
<source>Dyt Files (*.dyt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="65"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="87"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="112"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="116"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="120"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="130"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="138"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="141"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="144"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="152"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="160"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="163"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="166"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="174"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="181"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="184"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="187"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="195"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="203"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="206"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="209"/>
<source>prompt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="65"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="87"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="130"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="152"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="174"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="195"/>
<source>please create workspace first</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
<source>Save Workspace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="106"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="107"/>
<source>Failed to set file path</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="113"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="138"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="160"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="181"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="203"/>
<source>up to 9 files allowed for this type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="117"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="141"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="163"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="184"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="206"/>
<source>file already added for this type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="121"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="144"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="166"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="187"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="209"/>
<source>copy file failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QtBoolEdit</name>
@ -1751,21 +1821,6 @@
<source>SignalIndicatorLampUI</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Layout/SignalIndicatorLampUI.cpp" line="51"/>
<source>Signal Indicator Lamp</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Layout/SignalIndicatorLampUI.cpp" line="200"/>
<source>%1 -- %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Layout/SignalIndicatorLampUI.cpp" line="206"/>
<source>light</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SimuRunMenu</name>
@ -1805,16 +1860,6 @@
<source>DSurfaceDialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/chartPlot/SurfaceDialog.cpp" line="45"/>
<source>3D Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/chartPlot/SurfaceDialog.cpp" line="60"/>
<source>3D Curve -- %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SystemManagerMenu</name>
@ -1856,46 +1901,6 @@
<source>TargetListWgt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.ui" line="32"/>
<source></source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.ui" line="69"/>
<source></source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.ui" line="94"/>
<source></source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.ui" line="114"/>
<source>/</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.ui" line="140"/>
<source></source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.ui" line="147"/>
<source></source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.cpp" line="70"/>
<source>Data Table</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Table/targetlistwgt.cpp" line="132"/>
<source>%1 -- %2</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ViewManagerMenu</name>

View File

@ -1,4 +1,4 @@
#include "CodeEdtUI.h"
#include "CodeEdtUI.h"
#include <QPlainTextEdit>
#include <QMenuBar>
@ -25,7 +25,6 @@ CodeEdtUI::CodeEdtUI(QWidget *parent)
{
ui.setupUi(this);
// 创建代码编辑器
editor = new QPlainTextEdit(this);
QFont serifFont("Times", 20, QFont::Bold);
@ -38,7 +37,6 @@ CodeEdtUI::CodeEdtUI(QWidget *parent)
InitBat();
// // 创建菜单
// QMenu* fileMenu = menuBar()->addMenu(tr("&file"));
// QAction* openMainAction = new QAction(tr("&Import the template"), this);
///* QAction* openLDAction = new QAction(tr("&Import the LD template"), this);
@ -55,7 +53,6 @@ CodeEdtUI::CodeEdtUI(QWidget *parent)
// connect(saveAction, &QAction::triggered, this, &CodeEdtUI::saveFile);
// // 状态栏
// statusBar();
}
@ -182,20 +179,15 @@ void CodeEdtUI::runFile()
{
saveFile();
// 创建QProcess对象
QProcess process;
// 启动批处理文件
process.start(m_strCurOpenFile);
// 等待过程完成
process.waitForFinished();
// 获取输出
QString output = process.readAllStandardOutput();
QString errorOutput = process.readAllStandardError();
// 打印输出
qDebug() << "Output:" << output;
qDebug() << "Error Output:" << errorOutput;
}

View File

@ -27,7 +27,6 @@
#include "Matlab/MatlabObject.h"
// 曲线面板管理器
#include "Panel/DataPanelManager.h"
#include "ui_MainWindow.h"
@ -81,7 +80,6 @@ void MainWindow::InitUI() {
qtOsgViewWidget_ = new OsgWidget;
qtOsgViewWidget_->Initialize();
// 主视图改为 DockWidget支持自由停靠
DockWidget* viewDock = new DockWidget(tr("Main View"), 0);
viewDock->SetDockWidgetTitleBar(new DockTitleBar(viewDock));
viewDock->setObjectName("Dock.MainView");
@ -214,10 +212,8 @@ void MainWindow::InitUI() {
// InitDockLayout();
// 初始化数据面板管理器
dataPanelManager_ = new DataPanelManager(this, this);
// 连接工作空间变化信号
connect(&WorkSpaceManager::Get(), &WorkSpaceManager::WorkSpaceChanged,
dataPanelManager_, &DataPanelManager::OnWorkspaceChanged);
@ -241,7 +237,6 @@ void MainWindow::UninitUI() {
// Save layout state before tearing down widgets
UiLayoutManager::Save(this, 1);
// 清理数据面板管理器
if (dataPanelManager_) {
delete dataPanelManager_;
dataPanelManager_ = nullptr;

View File

@ -39,10 +39,6 @@ public:
return surfaceDlg_;
}
/**
* @brief
* @return
*/
DataPanelManager* GetDataPanelManager() const {
return dataPanelManager_;
}
@ -78,7 +74,6 @@ private:
class CodeEdtUI* matlabFileDlg_{ nullptr };
class AddParamSetting* addParamDlg_{ nullptr };
// 数据面板管理器
DataPanelManager* dataPanelManager_{ nullptr };
QMap<QString, QDockWidget*> m_mapDockWidget;

View File

@ -8,6 +8,7 @@
#include "ui/MainFrame.h"
#include "ui/WorkSpace/WorkSpaceDlg.h"
#include "ui/WorkSpace/AddFileDlg.h"
#include "common/SpdLogger.h"
#include "workspace/WorkSpace.h"
@ -48,44 +49,85 @@ void FileManagerMenu::NewWorkSpace() {
}
void FileManagerMenu::OpenWorkSpace() {
LOG_INFO("click newworkspace");
QString selfilter = tr("Dyt (*.dyt)");
const QString workspacePath = Application::GetWorkSpacePath();
QString dytFile = QFileDialog::getOpenFileName(&MainFrame::Get(), tr("open dyt file"), workspacePath,
tr("Dyt (*.dyt);;All files (*.*)"),
&selfilter);
LOG_INFO("user select file: {}", dytFile.toStdString());
if (dytFile.isEmpty()) {
QString fileName = QFileDialog::getOpenFileName(&MainFrame::Get(),
QObject::tr("Open Workspace"), Application::GetWorkSpacePath(), QObject::tr("Dyt Files (*.dyt)"));
if (fileName.isEmpty()) {
return;
}
emit LoadDyt(dytFile);
LOG_INFO("open workspace: {}", fileName.toLocal8Bit().constData());
emit LoadDyt(fileName);
}
void FileManagerMenu::SaveWorkSpace() {
LOG_INFO("click SaveWorkSpace");
WorkSpace* workspace = WorkSpaceManager::Get().GetCurrent();
if (nullptr == workspace) {
LOG_WARN("workspace is nullptr");
QMessageBox::warning(&MainFrame::Get(), tr("warning"), tr("workspace is nullptr"));
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
return;
}
const QString name = workspace->GetName();
QString dytFile = workspace->GetPath();
LOG_INFO("save {} dyt file: {}", name.toLocal8Bit().constData(),
dytFile.toLocal8Bit().constData());
QString fileName = current->GetPath();
if (fileName.isEmpty()) {
fileName = QFileDialog::getSaveFileName(&MainFrame::Get(),
QObject::tr("Save Workspace"), Application::GetWorkSpacePath(), QObject::tr("Dyt Files (*.dyt)"));
if (fileName.isEmpty()) {
return;
}
current->Save(fileName);
} else {
current->Save();
}
bool success = workspace->Save(dytFile);
LOG_INFO("save dyt: {}", success);
LOG_INFO("save workspace: {}", fileName.toLocal8Bit().constData());
}
void FileManagerMenu::AddFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
return;
}
// Show file addition dialog
AddFileDlg dlg(&MainFrame::Get());
if (dlg.exec() == QDialog::Accepted) {
FileEntryType selectedType = dlg.getSelectedFileType();
QString selectedPath = dlg.getSelectedFilePath();
// Create file entry
switch (current->CreateFileEntry(selectedType)) {
case WorkSpace::FileEntryResult::Ok: {
// Get the index of the newly created file entry
auto entries = current->GetFileEntries(selectedType);
int newIndex = static_cast<int>(entries.size()) - 1;
// Set file path
if (!current->SetFileEntryPath(selectedType, newIndex, selectedPath)) {
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
QObject::tr("Failed to set file path"));
}
break;
}
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
QObject::tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
QObject::tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
QObject::tr("copy file failed"));
break;
}
}
}
void FileManagerMenu::AddWaveFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
return;
}
@ -93,13 +135,13 @@ void FileManagerMenu::AddWaveFile() {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
break;
}
}
@ -107,7 +149,7 @@ void FileManagerMenu::AddWaveFile() {
void FileManagerMenu::AddSurfaceFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
return;
}
@ -115,13 +157,13 @@ void FileManagerMenu::AddSurfaceFile() {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
break;
}
}
@ -129,20 +171,20 @@ void FileManagerMenu::AddSurfaceFile() {
void FileManagerMenu::AddTableFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
return;
}
switch (current->CreateFileEntry(FileEntryType::Table)) {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
break;
}
}
@ -150,7 +192,7 @@ void FileManagerMenu::AddTableFile() {
void FileManagerMenu::AddLightFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
return;
}
@ -158,13 +200,13 @@ void FileManagerMenu::AddLightFile() {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
break;
}
}
}

View File

@ -13,22 +13,25 @@ public:
FileManagerMenu(QWidget* parent = 0);
~FileManagerMenu() override;
Q_SIGNALS:
void LoadDyt(const QString& path);
protected:
void InitConnect();
private:
void NewWorkSpace();
void OpenWorkSpace();
void SaveWorkSpace();
// New unified file addition method
void AddFile();
// Keep original methods for backward compatibility
void AddWaveFile();
void AddSurfaceFile();
void AddTableFile();
void AddLightFile();
signals:
void LoadDyt(const QString& path);
private:
Ui::FileManagerMenu* ui;
};

View File

@ -5,13 +5,32 @@
#include <QVBoxLayout>
#include <QLabel>
#include <QFileInfo>
#include <QScrollArea>
#include <QGroupBox>
#include <QCheckBox>
#include <QHBoxLayout>
CurvePanel::CurvePanel(int index, const QString& filePath, QWidget* parent)
: DataPanel(index, FileEntryType::Curve, filePath, parent)
, hasChartData_(false)
{
LOG_INFO("Created CurvePanel {} for file: {}", index, filePath.toStdString());
}
CurvePanel::CurvePanel(int index, std::shared_ptr<BaseChartData> chartData, QWidget* parent)
: DataPanel(index, FileEntryType::Curve, chartData ? chartData->path : QString(), parent)
, chartData_(chartData)
, hasChartData_(chartData != nullptr)
{
if (chartData) {
LOG_INFO("Created CurvePanel {} for chart: {}", index, chartData->name.toStdString());
// Override the title with chart name
title_ = QString("Curve Panel %1 - %2").arg(index).arg(chartData->name);
} else {
LOG_WARN("Created CurvePanel {} with null chart data", index);
}
}
CurvePanel::~CurvePanel()
{
LOG_INFO("Destroyed CurvePanel {}", GetIndex());
@ -20,26 +39,277 @@ CurvePanel::~CurvePanel()
void CurvePanel::RefreshPanel()
{
// Implement curve-specific refresh logic here
// For now, just call the base class implementation
DataPanel::RefreshPanel();
if (hasChartData_) {
UpdateCurveDisplay();
}
LOG_INFO("Refreshed CurvePanel {}", GetIndex());
}
void CurvePanel::SetChartData(std::shared_ptr<BaseChartData> chartData)
{
chartData_ = chartData;
hasChartData_ = (chartData != nullptr);
if (chartData) {
// Update title
title_ = QString("Curve Panel %1 - %2").arg(GetIndex()).arg(chartData->name);
// Refresh the display
UpdateCurveDisplay();
LOG_INFO("Set chart data for CurvePanel {}: {}", GetIndex(), chartData->name.toStdString());
} else {
LOG_WARN("Set null chart data for CurvePanel {}", GetIndex());
}
}
void CurvePanel::UpdateCurveDisplay()
{
if (!hasChartData_ || !chartData_) {
return;
}
// Clear existing layout and recreate
if (layout()) {
QLayoutItem* item;
while ((item = layout()->takeAt(0)) != nullptr) {
delete item->widget();
delete item;
}
delete layout();
}
// Create new layout with chart information
QVBoxLayout* mainLayout = new QVBoxLayout(this);
// Chart info section
QGroupBox* chartInfoGroup = new QGroupBox(QString("Chart: %1").arg(chartData_->name));
QVBoxLayout* chartInfoLayout = new QVBoxLayout(chartInfoGroup);
// Chart details - handle different chart types
QLabel* pathLabel = new QLabel(QString("File: %1").arg(QFileInfo(chartData_->path).fileName()));
chartInfoLayout->addWidget(pathLabel);
// Type-specific information
if (auto curveChart = std::dynamic_pointer_cast<CurveChartData>(chartData_)) {
QLabel* titleLabel = new QLabel(QString("Title: X=%1, Y=%2").arg(curveChart->xTitle, curveChart->yTitle));
QLabel* rangeLabel = new QLabel(QString("Range: X[%1-%2], Y[%3-%4]")
.arg(curveChart->xMin).arg(curveChart->xMax)
.arg(curveChart->yMin).arg(curveChart->yMax));
QLabel* countLabel = new QLabel(QString("Count: X=%1, T=%2").arg(curveChart->xCount).arg(curveChart->t));
chartInfoLayout->addWidget(titleLabel);
chartInfoLayout->addWidget(rangeLabel);
chartInfoLayout->addWidget(countLabel);
// Curves section
if (!curveChart->curves.isEmpty()) {
QGroupBox* curvesGroup = new QGroupBox(QString("Curves (%1)").arg(curveChart->curves.size()));
QVBoxLayout* curvesLayout = new QVBoxLayout(curvesGroup);
// Add scroll area for curves
QScrollArea* scrollArea = new QScrollArea();
QWidget* scrollWidget = new QWidget();
QVBoxLayout* scrollLayout = new QVBoxLayout(scrollWidget);
for (const CurveData& curve : curveChart->curves) {
QHBoxLayout* curveLayout = new QHBoxLayout();
// Curve checkbox for show/hide
QCheckBox* curveCheckBox = new QCheckBox(curve.name);
curveCheckBox->setChecked(true);
// Curve info
QLabel* curveInfo = new QLabel(QString("Range: %1-%2, Color: %3")
.arg(curve.start).arg(curve.stop).arg(curve.color));
curveInfo->setStyleSheet(QString("QLabel { color: rgb(%1); }").arg(curve.color));
curveLayout->addWidget(curveCheckBox);
curveLayout->addWidget(curveInfo);
curveLayout->addStretch();
scrollLayout->addLayout(curveLayout);
}
scrollWidget->setLayout(scrollLayout);
scrollArea->setWidget(scrollWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setMaximumHeight(200);
curvesLayout->addWidget(scrollArea);
mainLayout->addWidget(curvesGroup);
}
} else if (auto surfaceChart = std::dynamic_pointer_cast<SurfaceChartData>(chartData_)) {
QLabel* titleLabel = new QLabel(QString("Title: X=%1, Y=%2, Z=%3")
.arg(surfaceChart->xTitle, surfaceChart->yTitle, surfaceChart->zTitle));
QLabel* rangeLabel = new QLabel(QString("Range: X[%1-%2], Y[%3-%4], Z[%5-%6]")
.arg(surfaceChart->xMin).arg(surfaceChart->xMax)
.arg(surfaceChart->yMin).arg(surfaceChart->yMax)
.arg(surfaceChart->zMin).arg(surfaceChart->zMax));
QLabel* countLabel = new QLabel(QString("Count: X=%1, Y=%2, Z=%3, T=%4")
.arg(surfaceChart->xCount).arg(surfaceChart->yCount)
.arg(surfaceChart->zCount).arg(surfaceChart->t));
chartInfoLayout->addWidget(titleLabel);
chartInfoLayout->addWidget(rangeLabel);
chartInfoLayout->addWidget(countLabel);
// Surface curves section
if (!surfaceChart->curves.isEmpty()) {
QGroupBox* curvesGroup = new QGroupBox(QString("Surface Curves (%1)").arg(surfaceChart->curves.size()));
QVBoxLayout* curvesLayout = new QVBoxLayout(curvesGroup);
QScrollArea* scrollArea = new QScrollArea();
QWidget* scrollWidget = new QWidget();
QVBoxLayout* scrollLayout = new QVBoxLayout(scrollWidget);
for (const SurfaceCurveData& curve : surfaceChart->curves) {
QHBoxLayout* curveLayout = new QHBoxLayout();
QCheckBox* curveCheckBox = new QCheckBox(curve.name);
curveCheckBox->setChecked(true);
QLabel* curveInfo = new QLabel(QString("Range: %1-%2, Color: %3, Pos: (%4,%5,%6)")
.arg(curve.start).arg(curve.stop).arg(curve.color)
.arg(curve.x).arg(curve.y).arg(curve.z));
curveInfo->setStyleSheet(QString("QLabel { color: rgb(%1); }").arg(curve.color));
curveLayout->addWidget(curveCheckBox);
curveLayout->addWidget(curveInfo);
curveLayout->addStretch();
scrollLayout->addLayout(curveLayout);
}
scrollWidget->setLayout(scrollLayout);
scrollArea->setWidget(scrollWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setMaximumHeight(200);
curvesLayout->addWidget(scrollArea);
mainLayout->addWidget(curvesGroup);
}
} else if (auto tableChart = std::dynamic_pointer_cast<TableChartData>(chartData_)) {
QLabel* headLabel = new QLabel(QString("Head: %1").arg(tableChart->head));
QLabel* timeLabel = new QLabel(QString("Time: %1").arg(tableChart->t));
chartInfoLayout->addWidget(headLabel);
chartInfoLayout->addWidget(timeLabel);
// Table curves section
if (!tableChart->curves.isEmpty()) {
QGroupBox* curvesGroup = new QGroupBox(QString("Table Data (%1)").arg(tableChart->curves.size()));
QVBoxLayout* curvesLayout = new QVBoxLayout(curvesGroup);
QScrollArea* scrollArea = new QScrollArea();
QWidget* scrollWidget = new QWidget();
QVBoxLayout* scrollLayout = new QVBoxLayout(scrollWidget);
for (const TableCurveData& curve : tableChart->curves) {
QHBoxLayout* curveLayout = new QHBoxLayout();
QCheckBox* curveCheckBox = new QCheckBox(curve.name);
curveCheckBox->setChecked(true);
QLabel* curveInfo = new QLabel(QString("Color: %1, Data: %2")
.arg(curve.color).arg(curve.data));
curveInfo->setStyleSheet(QString("QLabel { color: rgb(%1); }").arg(curve.color));
curveLayout->addWidget(curveCheckBox);
curveLayout->addWidget(curveInfo);
curveLayout->addStretch();
scrollLayout->addLayout(curveLayout);
}
scrollWidget->setLayout(scrollLayout);
scrollArea->setWidget(scrollWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setMaximumHeight(200);
curvesLayout->addWidget(scrollArea);
mainLayout->addWidget(curvesGroup);
}
} else if (auto lightChart = std::dynamic_pointer_cast<LightChartData>(chartData_)) {
QLabel* colorLabel = new QLabel(QString("Open Color: %1, Close Color: %2")
.arg(lightChart->openColor).arg(lightChart->closeColor));
QLabel* timeLabel = new QLabel(QString("Time: %1").arg(lightChart->t));
chartInfoLayout->addWidget(colorLabel);
chartInfoLayout->addWidget(timeLabel);
// Light curves section
if (!lightChart->curves.isEmpty()) {
QGroupBox* curvesGroup = new QGroupBox(QString("Light Data (%1)").arg(lightChart->curves.size()));
QVBoxLayout* curvesLayout = new QVBoxLayout(curvesGroup);
QScrollArea* scrollArea = new QScrollArea();
QWidget* scrollWidget = new QWidget();
QVBoxLayout* scrollLayout = new QVBoxLayout(scrollWidget);
for (const LightCurveData& curve : lightChart->curves) {
QHBoxLayout* curveLayout = new QHBoxLayout();
QCheckBox* curveCheckBox = new QCheckBox(curve.name);
curveCheckBox->setChecked(true);
QLabel* curveInfo = new QLabel(QString("Data: %1").arg(curve.data));
curveLayout->addWidget(curveCheckBox);
curveLayout->addWidget(curveInfo);
curveLayout->addStretch();
scrollLayout->addLayout(curveLayout);
}
scrollWidget->setLayout(scrollLayout);
scrollArea->setWidget(scrollWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setMaximumHeight(200);
curvesLayout->addWidget(scrollArea);
mainLayout->addWidget(curvesGroup);
}
}
mainLayout->addWidget(chartInfoGroup);
// Placeholder for actual curve rendering
QLabel* renderLabel = new QLabel("Curve Rendering Area\n(To be implemented by rendering team)");
renderLabel->setAlignment(Qt::AlignCenter);
renderLabel->setStyleSheet("QLabel { color: #666; font-size: 12px; padding: 20px; border: 1px dashed #ccc; }");
renderLabel->setMinimumHeight(200);
mainLayout->addWidget(renderLabel);
mainLayout->addStretch();
setLayout(mainLayout);
}
void CurvePanel::InitUI()
{
// Create basic layout
QVBoxLayout* layout = new QVBoxLayout(this);
// Add placeholder label showing panel information
QLabel* infoLabel = new QLabel(QString("Curve Panel %1\nFile: %2\n\nCurve Drawing Area\nPlease inherit this class to implement specific drawing functionality")
.arg(GetIndex())
.arg(QFileInfo(GetFilePath()).fileName()));
infoLabel->setAlignment(Qt::AlignCenter);
infoLabel->setStyleSheet("QLabel { color: #666; font-size: 12px; padding: 20px; }");
layout->addWidget(infoLabel);
setLayout(layout);
if (hasChartData_) {
UpdateCurveDisplay();
} else {
// Create basic layout for file-based panel
QVBoxLayout* layout = new QVBoxLayout(this);
// Add placeholder label showing panel information
QLabel* infoLabel = new QLabel(QString("Curve Panel %1\nFile: %2\n\nCurve Drawing Area\nPlease inherit this class to implement specific drawing functionality")
.arg(GetIndex())
.arg(QFileInfo(GetFilePath()).fileName()));
infoLabel->setAlignment(Qt::AlignCenter);
infoLabel->setStyleSheet("QLabel { color: #666; font-size: 12px; padding: 20px; }");
layout->addWidget(infoLabel);
setLayout(layout);
}
}
QString CurvePanel::GetTypeDisplayName() const

View File

@ -1,6 +1,8 @@
#pragma once
#include "DataPanel.h"
#include "workspace/ChartData.h"
#include <memory>
/**
* @file CurvePanel.h
@ -25,6 +27,14 @@ public:
*/
explicit CurvePanel(int index, const QString& filePath, QWidget* parent = nullptr);
/**
* @brief Constructor with chart data
* @param index Panel index
* @param chartData Chart data containing curve information
* @param parent Parent widget
*/
explicit CurvePanel(int index, std::shared_ptr<BaseChartData> chartData, QWidget* parent = nullptr);
/**
* @brief Destructor
*/
@ -41,6 +51,18 @@ public:
*/
void RefreshPanel() override;
/**
* @brief Set chart data
* @param chartData Chart data to display
*/
void SetChartData(std::shared_ptr<BaseChartData> chartData);
/**
* @brief Get current chart data
* @return Current chart data
*/
std::shared_ptr<BaseChartData> GetChartData() const { return chartData_; }
protected:
/**
* @brief Initialize UI for curve-specific layout
@ -52,4 +74,14 @@ protected:
* @return Display name for curve type
*/
QString GetTypeDisplayName() const override;
private:
/**
* @brief Update curve display based on chart data
*/
void UpdateCurveDisplay();
private:
std::shared_ptr<BaseChartData> chartData_; // Chart data containing curve information
bool hasChartData_; // Flag indicating if chart data is available
};

View File

@ -16,8 +16,7 @@ class DockWidget;
* @brief Data panel base class
* Provides panel framework structure for different data types, specific functionality implemented by derived classes
*/
class DataPanel : public QWidget
{
class DataPanel : public QWidget {
Q_OBJECT
public:
@ -106,7 +105,7 @@ protected:
*/
virtual QString GetTypeDisplayName() const;
private:
// Protected members accessible by derived classes
int index_; // Panel index
FileEntryType fileType_; // File type
QString filePath_; // Associated file path

View File

@ -8,7 +8,7 @@
// #include "TablePanel.h"
// #include "LightPanel.h"
DataPanel* DataPanelFactory::CreatePanel(int index, FileEntryType fileType, const QString& filePath, QWidget* parent)
DataPanel* DataPanelFactory::CreatePanel(FileEntryType fileType, int index, const QString& filePath, QWidget* parent)
{
switch (fileType) {
case FileEntryType::Curve:
@ -37,6 +37,13 @@ DataPanel* DataPanelFactory::CreatePanel(int index, FileEntryType fileType, cons
}
}
DataPanel* DataPanelFactory::CreatePanelWithChartData(FileEntryType type, int index, std::shared_ptr<BaseChartData> chartData, QWidget* parent)
{
// Currently only CurvePanel supports ChartData
// In the future, other panel types may also support chart data
return new CurvePanel(index, chartData, parent);
}
bool DataPanelFactory::IsTypeSupported(FileEntryType fileType)
{
switch (fileType) {

View File

@ -1,49 +1,21 @@
#pragma once
#include "ui/Panel/DataPanel.h"
#include "workspace/ChartData.h"
#include <memory>
#include "workspace/FileEntry.h"
class DataPanel;
class QWidget;
/**
* @file DataPanelFactory.h
* @brief Data Panel Factory
* Creates appropriate panel instances based on file type
*/
/**
* @brief Data panel factory class
* Creates appropriate panel instances based on file type using factory pattern
*/
class DataPanelFactory
{
public:
/**
* @brief Create panel based on file type
* @param index Panel index
* @param fileType File type
* @param filePath File path
* @param parent Parent widget
* @return Created panel pointer (caller takes ownership)
*/
static DataPanel* CreatePanel(int index, FileEntryType fileType, const QString& filePath, QWidget* parent = nullptr);
/**
* @brief Check if file type is supported
* @param fileType File type to check
* @return True if supported, false otherwise
*/
static bool IsTypeSupported(FileEntryType fileType);
/**
* @brief Get display name for file type
* @param fileType File type
* @return Display name
*/
static QString GetTypeDisplayName(FileEntryType fileType);
private:
// Private constructor to prevent instantiation
DataPanelFactory() = default;
// Create panel with file path
static DataPanel* CreatePanel(FileEntryType type, int index, const QString& filePath, QWidget* parent = nullptr);
// Create panel with chart data
static DataPanel* CreatePanelWithChartData(FileEntryType type, int index, std::shared_ptr<BaseChartData> chartData, QWidget* parent = nullptr);
// Check if a panel type is supported
static bool IsTypeSupported(FileEntryType type);
// Get display name for a panel type
static QString GetTypeDisplayName(FileEntryType type);
};

View File

@ -186,7 +186,7 @@ DataPanel* DataPanelManager::CreateDataPanel(FileEntryType fileType, const QStri
mainWindow_->addDockWidget(Qt::RightDockWidgetArea, dockWidget);
// Create panel using factory
DataPanel* panel = DataPanelFactory::CreatePanel(index, fileType, filePath, dockWidget);
DataPanel* panel = DataPanelFactory::CreatePanel(fileType, index, filePath, dockWidget);
if (!panel) {
LOG_ERROR("Failed to create panel for type: {}", FileEntryTypeToString(fileType));
dockWidget->deleteLater();

View File

@ -8719,7 +8719,7 @@ void QtEntityPropertyManager::initializeProperty(QtProperty* property) {
\reimp
*/
void QtEntityPropertyManager::uninitializeProperty(QtProperty* property) {
// 清理 Name 属性
QtProperty* prop = d_ptr->m_properyToName.value(property, nullptr);
if (prop) {
d_ptr->m_nameToPropery.remove(prop);
@ -8727,7 +8727,7 @@ void QtEntityPropertyManager::uninitializeProperty(QtProperty* property) {
}
d_ptr->m_properyToName.remove(property);
// 清理 Visible 属性
prop = d_ptr->m_properyToVisible.value(property, nullptr);
if (prop) {
d_ptr->m_visibleToPropery.remove(prop);
@ -8735,7 +8735,7 @@ void QtEntityPropertyManager::uninitializeProperty(QtProperty* property) {
}
d_ptr->m_properyToVisible.remove(property);
// 清理 Transform 属性
prop = d_ptr->m_properyTotrans.value(property, nullptr);
if (prop) {
d_ptr->m_transToPropery.remove(prop);

View File

@ -188,7 +188,7 @@ const QString QWorkspaceAttribute::GetCommondFilePath() const
return "";
}
// 只返回文件名,不包含完整路径
return workspace_->GetCommondFilePath();
}

View File

@ -1,4 +1,4 @@
#include "targetlistwgt.h"
#include "targetlistwgt.h"
#include <QFile>
#include <QToolButton>
@ -28,7 +28,7 @@ TargetListWgt::TargetListWgt(QWidget * parent) : QWidget(parent) {
setWindowFlags(/*Qt::FramelessWindowHint | */Qt::Window);
QHeaderView* horizontalHeader = ui.tableWidget->horizontalHeader();
QColor headerColor = QColor(100, 100, 100); // 灰色
QColor headerColor = QColor(100, 100, 100);
horizontalHeader->setStyleSheet(QString("QHeaderView::section {background-color: %1;}").arg(headerColor.name()));
horizontalHeader->setStretchLastSection(true);

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QWidget>
#include "ui/Dialog.h"
@ -37,7 +37,7 @@ protected slots:
void slotSortTabCol(int nCol);
void slotUpdateTime(double dTime);
void slotDoubleClickedItem(QTableWidgetItem *pItem); // 双击行
void slotDoubleClickedItem(QTableWidgetItem *pItem);
void slotClickedItem(QTableWidgetItem *pItem);
void OnWorkSpaceChanged(class WorkSpace*);

View File

@ -0,0 +1,125 @@
#include "AddFileDlg.h"
#include "ui_AddFileDlg.h"
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <QDir>
#include "app/Application.h"
#include "common/SpdLogger.h"
AddFileDlg::AddFileDlg(QWidget* parent)
: Dialog(parent)
, ui(new Ui::AddFileDlg)
, selectedFileType_(FileEntryType::Curve) {
ui->setupUi(this);
// 设置对话框标题
SetTitle(QStringLiteral("Add File to Workspace"));
InitConnect();
UpdateUI();
}
AddFileDlg::~AddFileDlg() {
delete ui;
}
void AddFileDlg::InitConnect() {
connect(ui->tbSelectFile, &QToolButton::clicked, this, &AddFileDlg::OnSelectFile);
connect(ui->cbFileType, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &AddFileDlg::OnFileTypeChanged);
connect(ui->pbAdd, &QPushButton::clicked, this, &AddFileDlg::OnSure);
connect(ui->pbCancel, &QPushButton::clicked, this, &AddFileDlg::reject);
}
void AddFileDlg::OnSelectFile() {
const QString workspacePath = Application::GetWorkSpacePath();
QString filePath = QFileDialog::getOpenFileName(
this,
QStringLiteral("Select File"),
workspacePath,
QStringLiteral("Text Files (*.txt);;All Files (*.*)")
);
if (filePath.isEmpty()) {
return;
}
selectedFilePath_ = filePath;
ui->leFilePath->setText(filePath);
QFileInfo fileInfo(filePath);
ui->lblFileName->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->lblFileSize->setText(sizeText);
LOG_INFO("Selected file: {}", filePath.toStdString());
}
void AddFileDlg::OnFileTypeChanged() {
int index = ui->cbFileType->currentIndex();
switch (index) {
case 0: selectedFileType_ = FileEntryType::Curve; break;
case 1: selectedFileType_ = FileEntryType::Surface; break;
case 2: selectedFileType_ = FileEntryType::Table; break;
case 3: selectedFileType_ = FileEntryType::Light; break;
default: selectedFileType_ = FileEntryType::Curve; break;
}
LOG_INFO("File type changed to: {}", static_cast<int>(selectedFileType_));
}
void AddFileDlg::OnSure() {
if (!ValidateInput()) {
return;
}
accept();
}
void AddFileDlg::UpdateUI() {
ui->lblFileName->setText(QStringLiteral("-"));
ui->lblFileSize->setText(QStringLiteral("-"));
ui->cbFileType->setCurrentIndex(0);
selectedFileType_ = FileEntryType::Curve;
}
bool AddFileDlg::ValidateInput() {
if (selectedFilePath_.isEmpty()) {
QMessageBox::warning(this, QStringLiteral("Warning"),
QStringLiteral("Please select a file first."));
return false;
}
QFileInfo fileInfo(selectedFilePath_);
if (!fileInfo.exists()) {
QMessageBox::warning(this, QStringLiteral("Warning"),
QStringLiteral("Selected file does not exist."));
return false;
}
return true;
}
FileEntryType AddFileDlg::getSelectedFileType() const {
return selectedFileType_;
}
QString AddFileDlg::getSelectedFilePath() const {
return selectedFilePath_;
}
QString AddFileDlg::getDescription() const {
return ui->teDescription->toPlainText().trimmed();
}

View File

@ -0,0 +1,37 @@
#pragma once
#include "ui/Dialog.h"
#include "workspace/FileEntry.h"
namespace Ui {
class AddFileDlg;
}
class AddFileDlg : public Dialog {
Q_OBJECT
public:
AddFileDlg(QWidget* parent = nullptr);
~AddFileDlg() override;
FileEntryType getSelectedFileType() const;
QString getSelectedFilePath() const;
QString getDescription() const;
protected:
void InitConnect();
void OnSure();
void OnSelectFile();
void OnFileTypeChanged();
private:
void UpdateUI();
bool ValidateInput();
private:
Ui::AddFileDlg* ui;
QString selectedFilePath_;
FileEntryType selectedFileType_;
};

View File

@ -0,0 +1,266 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddFileDlg</class>
<widget class="QWidget" name="AddFileDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
<string>Add File to Workspace</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_main">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_file">
<item>
<widget class="QLabel" name="label_file">
<property name="text">
<string>File Path</string>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leFilePath">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Select file to add...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbSelectFile">
<property name="text">
<string>...</string>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>25</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_type">
<item>
<widget class="QLabel" name="label_type">
<property name="text">
<string>File Type</string>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbFileType">
<item>
<property name="text">
<string>Curve Data</string>
</property>
</item>
<item>
<property name="text">
<string>Surface Data</string>
</property>
</item>
<item>
<property name="text">
<string>Table Data</string>
</property>
</item>
<item>
<property name="text">
<string>Light Data</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_type">
<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>
<widget class="QGroupBox" name="groupBox_preview">
<property name="title">
<string>File Information</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_preview">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_info">
<item>
<widget class="QLabel" name="label_fileName">
<property name="text">
<string>File Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblFileName">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_info1">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_size">
<item>
<widget class="QLabel" name="label_fileSize">
<property name="text">
<string>File Size:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblFileSize">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_info2">
<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>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_desc">
<item>
<widget class="QLabel" name="label_desc">
<property name="text">
<string>Description (Optional)</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="teDescription">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="placeholderText">
<string>Enter file description...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_buttons">
<item>
<spacer name="horizontalSpacer_buttons">
<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="pbAdd">
<property name="text">
<string>Add File</string>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbCancel">
<property name="text">
<string>Cancel</string>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -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) // 二维曲线
if (1 == iType) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
/*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) // 二维曲线y轴对数
else if (2 == iType) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
//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 // 三维曲线
else // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
ui.label_13->hide();
ui.comboBox_3->hide();
@ -210,7 +210,7 @@ void DYTChart::ParseAnimationPath(const QString& strFile, std::vector<std::vecto
{
if (strFile.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据AnimationPath文件路径"));
QMessageBox::information(nullptr, QStringLiteral("Error"), QStringLiteral("Please check AnimationPath file path"));
return;
}
@ -245,7 +245,7 @@ void DYTChart::ParseTimeStep(const QString& strFile, std::vector<float>& vecTime
{
if (strFile.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据TimeStep文件路径"));
QMessageBox::information(nullptr, QStringLiteral("Error"), QStringLiteral("Please check TimeStep file path"));
return;
}
@ -267,11 +267,11 @@ void DYTChart::ParseAntennaPatternFile(const QString& strFile, std::vector<std::
{
if (strFile.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据AntennaPattern文件路径"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>AntennaPattern<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
return;
}
// 读取z轴数据
// <EFBFBD><EFBFBD>ȡz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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("提示"), QString::fromLocal8Bit("请检查数据BeamPoint文件路径"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BeamPoint<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
return;
}
@ -324,7 +324,7 @@ void DYTChart::ParseRD(const QString& strFile, std::vector<std::vector<float>>&
{
if (strFile.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据RD文件路径"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RD<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
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; // 起始 行
int iStartReadRow = iRowCount * m_iCurTime; // <EFBFBD><EFBFBD>ʼ <20><>
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("提示"), QString::fromLocal8Bit("请检查数据Wave文件路径"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Wave<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
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; // 起始 行
int iStartReadRow = iRowCount * m_iCurTime; // <EFBFBD><EFBFBD>ʼ <20><>
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轴类型 0一般1对数
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0һ<30><D2BB>1<EFBFBD><31><EFBFBD><EFBFBD>
int iYType = 0;
if (2 == m_iCurveType)
{
iYType = 1;
}
// x轴数据
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathX = ui.lineEdit->text();
// y轴数据
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathY = ui.lineEdit_3->text();
// Z轴数据
// Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathZ = ui.lineEdit_9->text();
// 曲线类型
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//int iCurveType = ui.comboBox_2->currentIndex();
// x标题
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strXTitle = ui.lineEdit_10->text();
// y标题
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strYTitle = ui.lineEdit_11->text();
// z标题
// z<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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("选择数据文件"), "home", "*.txt");
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"), "home", "*.txt");
if (strFilePath.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请选择有效的文件路径!"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
return;
}
@ -880,10 +880,10 @@ void DYTChart::slotSelXFile()
void DYTChart::slotSelYFile()
{
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("选择数据文件"), "home", "*.txt");
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"), "home", "*.txt");
if (strFilePath.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请选择有效的文件路径!"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
return;
}
@ -894,10 +894,10 @@ void DYTChart::slotSelYFile()
void DYTChart::slotSelZFile()
{
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("选择数据文件"), "home", "*.txt");
QString strFilePath = QFileDialog::getOpenFileName(nullptr, QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"), "home", "*.txt");
if (strFilePath.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请选择有效的文件路径!"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
return;
}
@ -997,19 +997,19 @@ void DYTChart::slotAdd()
}
// x轴数据
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathX = ui.lineEdit->text();
// y轴数据
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathY = ui.lineEdit_3->text();
// Z轴数据
// Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathZ = ui.lineEdit_9->text();
// 曲线类型
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//int iCurveType = ui.comboBox_2->currentIndex();
// x标题
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strXTitle = ui.lineEdit_10->text();
// y标题
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strYTitle = ui.lineEdit_11->text();
// z标题
// z<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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;
// 读取x轴数据
// <EFBFBD><EFBFBD>ȡx<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
iXCol = ui.comboBox_2->currentIndex();
int iRowCount = ui.tableWidget->rowCount();
@ -1037,12 +1037,12 @@ void DYTChart::slotAdd()
}
else
{
//QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("X轴数据文件加载失败请检测文件是否正常"));
//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>"));
return;
}
}
// 读取y轴数据
// <EFBFBD><EFBFBD>ȡy<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
iYCol = ui.comboBox_4->currentIndex();
int iRowCount = ui.tableWidget_2->rowCount();
@ -1059,12 +1059,12 @@ void DYTChart::slotAdd()
}
else
{
//QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("Y轴数据文件加载失败请检测文件是否正常"));
//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>"));
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("提示"), QString::fromLocal8Bit("Z轴数据文件加载失败请检测文件是否正常"));
//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>"));
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) // 三维曲线数据
if (m_iCurveType == 3) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
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轴类型 0一般1对数
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0һ<30><D2BB>1<EFBFBD><31><EFBFBD><EFBFBD>
int iYType = 0;
if (2 == m_iCurveType)
{
iYType = 1;
}
// 曲线ID
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
m_iCurveID++;
m_iCurSelID = m_iCurveID;
@ -1200,19 +1200,19 @@ void DYTChart::slotUpdate()
return;
}
// x轴数据
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathX = ui.lineEdit->text();
// y轴数据
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathY = ui.lineEdit_3->text();
// Z轴数据
// Z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strFilePathZ = ui.lineEdit_9->text();
// 曲线类型
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//int iCurveType = ui.comboBox_2->currentIndex();
// x标题
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strXTitle = ui.lineEdit_10->text();
// y标题
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString strYTitle = ui.lineEdit_11->text();
// z标题
// z<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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;
// 读取x轴数据
// <EFBFBD><EFBFBD>ȡx<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
iXCol = ui.comboBox_2->currentIndex();
int iRowCount = ui.tableWidget->rowCount();
@ -1240,12 +1240,12 @@ void DYTChart::slotUpdate()
}
else
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("X轴数据文件加载失败,请检测文件是否正常!"));
QMessageBox::information(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("X<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>"));
return;
}
}
// 读取y轴数据
// <EFBFBD><EFBFBD>ȡy<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
iYCol = ui.comboBox_4->currentIndex();
int iRowCount = ui.tableWidget_2->rowCount();
@ -1262,12 +1262,12 @@ void DYTChart::slotUpdate()
}
else
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("Y轴数据文件加载失败,请检测文件是否正常!"));
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>"));
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("提示"), QString::fromLocal8Bit("Z轴数据文件加载失败,请检测文件是否正常!"));
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>"));
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) // 三维曲线数据
if (m_iCurveType == 3) // <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
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轴类型 0一般1对数
// y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0һ<30><D2BB>1<EFBFBD><31><EFBFBD><EFBFBD>
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;
// 读取x轴数据
// <EFBFBD><EFBFBD>ȡx<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
int iRowCount = ui.tableWidget->rowCount();
if (iRowCount > 0)
@ -1477,7 +1477,7 @@ void DYTChart::slotUpdateTime(double iTime)
}
}
// 读取y轴数据
// <EFBFBD><EFBFBD>ȡy<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
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++)
{

View File

@ -1,4 +1,4 @@
#include "fitcurvedialog.h"
#include "fitcurvedialog.h"
#include <QLogValueAxis>
@ -25,57 +25,47 @@ FitCurveDialog::FitCurveDialog(QWidget* parent) :
}
void FitCurveDialog::initQChartView() {
//创建图表框架
curveChartView = new FitCurveChartView(this);
curveChartView->setMaximumWidth(1730);
curveChartView->setMinimumHeight(480);
curveChart = new QChart();
curveChart->setTheme(QChart::ChartThemeBlueIcy);
//curveChart->setContentsMargins(0, 0, 0, 0); //设置外边界全部为0, 根据自己实际情况设置
//curveChart->setMargins(QMargins(5, -30, 5, 10)); //设置内边界, 根据自己实际情况设置
curveChart->setBackgroundRoundness(0); //设置表格边框圆角半径
curveChart->setBackgroundRoundness(0);
curveChartView->setChart(curveChart);
//创建坐标轴
m_pAxisX = new QValueAxis;
m_pAxisX->setRange(0, 10);
//m_pAxisX->setTickCount(21);
//m_pAxisX->setLabelFormat("%d");
m_pAxisX->setLabelsAngle(-90); //坐标刻度文字显示角度
m_pAxisX->setLabelsAngle(-90);
curveChart->addAxis(m_pAxisX, Qt::AlignBottom);
m_pAxisY = new QValueAxis;
m_pAxisY->setRange(0, 10);
//m_pAxisY->setTickCount(11);
//m_pAxisY->setLabelFormat("%d");
curveChart->addAxis(m_pAxisY, Qt::AlignLeft);
curveChartView->setRenderHint(QPainter::Antialiasing); //除锯齿
//connect(curveChartView, &FitCurveChartView::signalMouseEvent, this, &FitCurveDialog::theSlotMouseEvent);
//connect(curveChartView, &FitCurveChartView::signalWheelEvent, this, &FitCurveDialog::theSlotWheelEvent);
curveChartView->setRenderHint(QPainter::Antialiasing);
QHBoxLayout* pLayout = new QHBoxLayout(this);
pLayout->addWidget(curveChartView);
}
void FitCurveDialog::theSlotMouseEvent(int eventId, QMouseEvent* event) {
if (eventId == 0) { //单击按下
if (eventId == 0) {
isPressed = true;
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
pressedPoint = mouseEvent->pos();
}
else if (eventId == 1) { //鼠标移动
else if (eventId == 1) {
if (isPressed) {
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
curveChart->scroll(-(mouseEvent->pos().x() - pressedPoint.x()) / 10,
(mouseEvent->pos().y() - pressedPoint.y()) / 10);
}
}
else if (eventId == 2) { //单击抬起
else if (eventId == 2) {
isPressed = false;
}
else if (eventId == 3) { //双击
else if (eventId == 3) {
resetZoomAndScroll();
}
}
@ -187,7 +177,7 @@ void FitCurveDialog::updateParseWaveFile(const QString& strFile, int nT, QVarian
{
if (strFile.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据Wave文件路径"));
QMessageBox::information(nullptr, QStringLiteral("Error"), QStringLiteral("Please check Wave file path"));
return;
}
@ -304,7 +294,7 @@ void FitCurveDialog::updateParseReportFile(const QString & strFile, int nT, QVar
{
if (strFile.isEmpty())
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查数据文件路径!"));
QMessageBox::information(nullptr, QStringLiteral("Error"), QStringLiteral("Please check data file path"));
return;
}

View File

@ -1,13 +1,11 @@
#pragma once
#pragma once
#include <QString>
class QMainWindow;
class UiLayoutManager {
public:
// 保存主窗口布局到 workspace/UIState.ini
static void Save(QMainWindow* mainWindow, int version = 1);
// 从 workspace/UIState.ini 恢复布局
static void Restore(QMainWindow* mainWindow, int version = 1);
};

View File

@ -826,21 +826,6 @@ bool CameraControlManipulator::handleFrame(const osgGA::GUIEventAdapter& ea, osg
// rotation = rotation_matrix.getRotate().inverse();
// }
// QString str =
// QString::fromLocal8Bit("摄像机位置 X=") + QString::number(eye.x()) +
// QString::fromLocal8Bit(", Y=") + QString::number(eye.y()) +
// QString::fromLocal8Bit(", Z=") + QString::number(eye.z()) +
// QString::fromLocal8Bit(", 摄像机角度 X=") + QString::number(rotation.x()) +
// QString::fromLocal8Bit(", Y=") + QString::number(rotation.y()) +
// QString::fromLocal8Bit(", Z=") + QString::number(rotation.z()) +
// QString::fromLocal8Bit(", W=") + QString::number(rotation.w());
// if (_pMainWindow)
// {
// //_pMainWindow->SetStatusInfo(str);
// }
//}
return false;
}

109
src/workspace/ChartData.h Normal file
View File

@ -0,0 +1,109 @@
#ifndef CHARTDATA_H
#define CHARTDATA_H
#include <QString>
#include <QList>
#include <memory>
#include "workspace/FileEntry.h"
struct BaseCurveData {
QString name;
BaseCurveData() = default;
virtual ~BaseCurveData() = default;
};
struct CurveColorData : public BaseCurveData {
QString color;
};
struct CurveData : public CurveColorData {
double start;
double stop;
};
struct TableCurveData : public CurveColorData {
QString data;
};
struct SurfaceCurveData : public CurveColorData {
double start;
double stop;
double x;
double y;
double z;
};
struct LightCurveData : public BaseCurveData {
QString data;
};
class BaseChartData {
public:
QString name;
QString path;
QString t;
BaseChartData() = default;
virtual ~BaseChartData() = default;
virtual FileEntryType getType() const = 0;
};
class CurveChartData : public BaseChartData {
public:
QString xTitle;
QString yTitle;
double xMin;
double xMax;
double yMin;
double yMax;
int xCount;
QList<CurveData> curves;
FileEntryType getType() const override { return FileEntryType::Curve; }
};
class SurfaceChartData : public BaseChartData {
public:
QString xTitle;
QString yTitle;
QString zTitle;
double xMin;
double xMax;
double yMin;
double yMax;
double zMin;
double zMax;
int xCount;
int yCount;
int zCount;
QList<SurfaceCurveData> curves;
FileEntryType getType() const override { return FileEntryType::Surface; }
};
class TableChartData : public BaseChartData {
public:
QString head;
QList<TableCurveData> curves;
FileEntryType getType() const override { return FileEntryType::Table; }
};
class LightChartData : public BaseChartData {
public:
QString openColor;
QString closeColor;
QList<LightCurveData> curves;
FileEntryType getType() const override { return FileEntryType::Light; }
};
struct FileTypeData {
QString typeName;
int count;
QList<std::shared_ptr<BaseChartData>> charts;
};
#endif // CHARTDATA_H

View File

@ -388,3 +388,59 @@ void WorkSpace::ExecuteCommands(CommandWhen when) {
}
cmdMgr_->Execute(this, when);
}
// Chart data management implementation
void WorkSpace::SetFileTypeData(const QList<FileTypeData>& fileTypes) {
fileTypeData_ = fileTypes;
++filesSeq_;
// Emit signals for each type that has data
for (const auto& fileType : fileTypes) {
FileEntryType type;
if (FileEntryTypeFromString(fileType.typeName.toLocal8Bit().constData(), type)) {
emit FilesChanged(type);
}
}
}
const QList<FileTypeData>& WorkSpace::GetFileTypeData() const {
return fileTypeData_;
}
void WorkSpace::AddChartData(FileEntryType type, const std::shared_ptr<BaseChartData>& chart) {
QString typeName = FileEntryTypeToString(type);
// Find existing file type data or create new one
auto it = std::find_if(fileTypeData_.begin(), fileTypeData_.end(),
[&typeName](const FileTypeData& data) {
return data.typeName == typeName;
});
if (it != fileTypeData_.end()) {
it->charts.append(chart);
it->count = it->charts.size();
} else {
FileTypeData newData;
newData.typeName = typeName;
newData.count = 1;
newData.charts.append(chart);
fileTypeData_.append(newData);
}
++filesSeq_;
emit FilesChanged(type);
}
QList<std::shared_ptr<BaseChartData>> WorkSpace::GetChartData(FileEntryType type) const {
QString typeName = FileEntryTypeToString(type);
auto it = std::find_if(fileTypeData_.begin(), fileTypeData_.end(),
[&typeName](const FileTypeData& data) {
return data.typeName == typeName;
});
if (it != fileTypeData_.end()) {
return it->charts;
}
return QList<std::shared_ptr<BaseChartData>>();
}

View File

@ -12,6 +12,7 @@
#include "config.h"
#include "common/SpdLogger.h"
#include "workspace/FileEntry.h"
#include "workspace/ChartData.h"
//#include "../ui/chartPlot/DYTChart.h"
@ -89,6 +90,12 @@ public:
bool SetFileEntryPath(FileEntryType type, int index, const QString& path);
QString GetFileEntryAbsPath(FileEntryType type, int index) const;
// Chart data management
void SetFileTypeData(const QList<FileTypeData>& fileTypes);
const QList<FileTypeData>& GetFileTypeData() const;
void AddChartData(FileEntryType type, const std::shared_ptr<BaseChartData>& chart);
QList<std::shared_ptr<BaseChartData>> GetChartData(FileEntryType type) const;
inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) {
homeViewpoint_ = viewpoint;
homeViewpoint_.setHeading(0.0); // Ensure heading is set to 0.0
@ -178,6 +185,8 @@ private:
class Entity* trackedEntity_{ nullptr };
// Stored as file entries under workspace dir, keyed by type
std::map<FileEntryType, std::vector<FileEntry>> files_;
// Chart data storage
QList<FileTypeData> fileTypeData_;
// Monotonic sequence for file entries changes, used to trigger UI refresh
std::uint64_t filesSeq_{ 0 };
// Executor for command XML actions

View File

@ -107,12 +107,276 @@ bool WorkSpaceXMLParse::ParseFiles(const tinyxml2::XMLElement* element) {
return false;
}
QList<FileTypeData> fileTypes;
const tinyxml2::XMLElement* typeElement = element->FirstChildElement("type");
while (nullptr != typeElement) {
const char* name = typeElement->Attribute("name");
int count = 0;
typeElement->QueryIntAttribute("count", &count);
if (nullptr != name && count > 0) {
FileTypeData fileTypeData;
fileTypeData.typeName = QString::fromLocal8Bit(name);
fileTypeData.count = count;
QString typeName = QString::fromLocal8Bit(name);
// Parse chart elements within this type
const tinyxml2::XMLElement* chartElement = typeElement->FirstChildElement("chart");
while (nullptr != chartElement) {
std::shared_ptr<BaseChartData> chartData;
// Create appropriate chart type based on the file type
if (typeName == FileEntryTypeToString(FileEntryType::Curve)) {
auto curveChart = std::make_shared<CurveChartData>();
// Parse curve-specific attributes
if (const char* chartName = chartElement->Attribute("name")) {
curveChart->name = QString::fromLocal8Bit(chartName);
}
if (const char* path = chartElement->Attribute("path")) {
curveChart->path = QString::fromLocal8Bit(path);
}
if (const char* xTitle = chartElement->Attribute("xTitle")) {
curveChart->xTitle = QString::fromLocal8Bit(xTitle);
}
if (const char* yTitle = chartElement->Attribute("yTitle")) {
curveChart->yTitle = QString::fromLocal8Bit(yTitle);
}
if (const char* xMin = chartElement->Attribute("xMin")) {
curveChart->xMin = QString::fromLocal8Bit(xMin).toDouble();
}
if (const char* xMax = chartElement->Attribute("xMax")) {
curveChart->xMax = QString::fromLocal8Bit(xMax).toDouble();
}
if (const char* yMin = chartElement->Attribute("yMin")) {
curveChart->yMin = QString::fromLocal8Bit(yMin).toDouble();
}
if (const char* yMax = chartElement->Attribute("yMax")) {
curveChart->yMax = QString::fromLocal8Bit(yMax).toDouble();
}
if (const char* xCount = chartElement->Attribute("xCount")) {
curveChart->xCount = QString::fromLocal8Bit(xCount).toInt();
}
if (const char* t = chartElement->Attribute("t")) {
curveChart->t = QString::fromLocal8Bit(t);
}
// Parse curve elements
const tinyxml2::XMLElement* curveElement = chartElement->FirstChildElement("curve");
while (nullptr != curveElement) {
CurveData curveData;
if (const char* curveName = curveElement->Attribute("name")) {
curveData.name = QString::fromLocal8Bit(curveName);
}
if (const char* color = curveElement->Attribute("color")) {
curveData.color = QString::fromLocal8Bit(color);
}
if (const char* start = curveElement->Attribute("start")) {
curveData.start = QString::fromLocal8Bit(start).toDouble();
}
if (const char* stop = curveElement->Attribute("stop")) {
curveData.stop = QString::fromLocal8Bit(stop).toDouble();
}
curveChart->curves.append(curveData);
curveElement = curveElement->NextSiblingElement("curve");
}
chartData = curveChart;
} else if (typeName == FileEntryTypeToString(FileEntryType::Surface)) {
auto surfaceChart = std::make_shared<SurfaceChartData>();
// Parse surface-specific attributes
if (const char* chartName = chartElement->Attribute("name")) {
surfaceChart->name = QString::fromLocal8Bit(chartName);
}
if (const char* chartName = chartElement->Attribute("Name")) { // Handle both cases
surfaceChart->name = QString::fromLocal8Bit(chartName);
}
if (const char* path = chartElement->Attribute("path")) {
surfaceChart->path = QString::fromLocal8Bit(path);
}
if (const char* xTitle = chartElement->Attribute("xTitle")) {
surfaceChart->xTitle = QString::fromLocal8Bit(xTitle);
}
if (const char* yTitle = chartElement->Attribute("yTitle")) {
surfaceChart->yTitle = QString::fromLocal8Bit(yTitle);
}
if (const char* zTitle = chartElement->Attribute("zTitle")) {
surfaceChart->zTitle = QString::fromLocal8Bit(zTitle);
}
if (const char* xMin = chartElement->Attribute("xMin")) {
surfaceChart->xMin = QString::fromLocal8Bit(xMin).toDouble();
}
if (const char* xMax = chartElement->Attribute("xMax")) {
surfaceChart->xMax = QString::fromLocal8Bit(xMax).toDouble();
}
if (const char* yMin = chartElement->Attribute("yMin")) {
surfaceChart->yMin = QString::fromLocal8Bit(yMin).toDouble();
}
if (const char* yMax = chartElement->Attribute("yMax")) {
surfaceChart->yMax = QString::fromLocal8Bit(yMax).toDouble();
}
if (const char* zMin = chartElement->Attribute("zMin")) {
surfaceChart->zMin = QString::fromLocal8Bit(zMin).toDouble();
}
if (const char* zMax = chartElement->Attribute("zMax")) {
surfaceChart->zMax = QString::fromLocal8Bit(zMax).toDouble();
}
if (const char* xCount = chartElement->Attribute("xCount")) {
surfaceChart->xCount = QString::fromLocal8Bit(xCount).toInt();
}
if (const char* yCount = chartElement->Attribute("yCount")) {
surfaceChart->yCount = QString::fromLocal8Bit(yCount).toInt();
}
if (const char* zCount = chartElement->Attribute("zCount")) {
surfaceChart->zCount = QString::fromLocal8Bit(zCount).toInt();
}
if (const char* t = chartElement->Attribute("t")) {
surfaceChart->t = QString::fromLocal8Bit(t);
}
// Parse curve elements
const tinyxml2::XMLElement* curveElement = chartElement->FirstChildElement("curve");
while (nullptr != curveElement) {
SurfaceCurveData curveData;
if (const char* curveName = curveElement->Attribute("name")) {
curveData.name = QString::fromLocal8Bit(curveName);
}
if (const char* curveName = curveElement->Attribute("Name")) { // Handle both cases
curveData.name = QString::fromLocal8Bit(curveName);
}
if (const char* color = curveElement->Attribute("color")) {
curveData.color = QString::fromLocal8Bit(color);
}
if (const char* color = curveElement->Attribute("Color")) { // Handle both cases
curveData.color = QString::fromLocal8Bit(color);
}
if (const char* start = curveElement->Attribute("start")) {
curveData.start = QString::fromLocal8Bit(start).toDouble();
}
if (const char* start = curveElement->Attribute("Start")) { // Handle both cases
curveData.start = QString::fromLocal8Bit(start).toDouble();
}
if (const char* stop = curveElement->Attribute("stop")) {
curveData.stop = QString::fromLocal8Bit(stop).toDouble();
}
if (const char* stop = curveElement->Attribute("Stop")) { // Handle both cases
curveData.stop = QString::fromLocal8Bit(stop).toDouble();
}
if (const char* x = curveElement->Attribute("x")) {
curveData.x = QString::fromLocal8Bit(x).toDouble();
}
if (const char* y = curveElement->Attribute("y")) {
curveData.y = QString::fromLocal8Bit(y).toDouble();
}
if (const char* z = curveElement->Attribute("z")) {
curveData.z = QString::fromLocal8Bit(z).toDouble();
}
surfaceChart->curves.append(curveData);
curveElement = curveElement->NextSiblingElement("curve");
}
chartData = surfaceChart;
} else if (typeName == FileEntryTypeToString(FileEntryType::Table)) {
auto tableChart = std::make_shared<TableChartData>();
// Parse table-specific attributes
if (const char* chartName = chartElement->Attribute("name")) {
tableChart->name = QString::fromLocal8Bit(chartName);
}
if (const char* chartName = chartElement->Attribute("Name")) { // Handle both cases
tableChart->name = QString::fromLocal8Bit(chartName);
}
if (const char* path = chartElement->Attribute("path")) {
tableChart->path = QString::fromLocal8Bit(path);
}
if (const char* head = chartElement->Attribute("head")) {
tableChart->head = QString::fromLocal8Bit(head);
}
if (const char* t = chartElement->Attribute("t")) {
tableChart->t = QString::fromLocal8Bit(t);
}
// Parse curve elements
const tinyxml2::XMLElement* curveElement = chartElement->FirstChildElement("curve");
while (nullptr != curveElement) {
TableCurveData curveData;
if (const char* curveName = curveElement->Attribute("name")) {
curveData.name = QString::fromLocal8Bit(curveName);
}
if (const char* curveName = curveElement->Attribute("Name")) { // Handle both cases
curveData.name = QString::fromLocal8Bit(curveName);
}
if (const char* color = curveElement->Attribute("color")) {
curveData.color = QString::fromLocal8Bit(color);
}
if (const char* data = curveElement->Attribute("data")) {
curveData.data = QString::fromLocal8Bit(data);
}
tableChart->curves.append(curveData);
curveElement = curveElement->NextSiblingElement("curve");
}
chartData = tableChart;
} else if (typeName == FileEntryTypeToString(FileEntryType::Light)) {
auto lightChart = std::make_shared<LightChartData>();
// Parse light-specific attributes
if (const char* chartName = chartElement->Attribute("name")) {
lightChart->name = QString::fromLocal8Bit(chartName);
}
if (const char* path = chartElement->Attribute("path")) {
lightChart->path = QString::fromLocal8Bit(path);
}
if (const char* openColor = chartElement->Attribute("openColor")) {
lightChart->openColor = QString::fromLocal8Bit(openColor);
}
if (const char* closeColor = chartElement->Attribute("closeColor")) {
lightChart->closeColor = QString::fromLocal8Bit(closeColor);
}
if (const char* t = chartElement->Attribute("t")) {
lightChart->t = QString::fromLocal8Bit(t);
}
// Parse curve elements
const tinyxml2::XMLElement* curveElement = chartElement->FirstChildElement("curve");
while (nullptr != curveElement) {
LightCurveData curveData;
if (const char* curveName = curveElement->Attribute("name")) {
curveData.name = QString::fromLocal8Bit(curveName);
}
if (const char* data = curveElement->Attribute("data")) {
curveData.data = QString::fromLocal8Bit(data);
}
lightChart->curves.append(curveData);
curveElement = curveElement->NextSiblingElement("curve");
}
chartData = lightChart;
}
if (chartData) {
fileTypeData.charts.append(chartData);
}
chartElement = chartElement->NextSiblingElement("chart");
}
fileTypes.append(fileTypeData);
// Also create file entries for backward compatibility
FileEntryType enumType;
if (FileEntryTypeFromString(name, enumType)) {
for (int i = 0; i < count; ++i) {
@ -122,6 +386,10 @@ bool WorkSpaceXMLParse::ParseFiles(const tinyxml2::XMLElement* element) {
}
typeElement = typeElement->NextSiblingElement("type");
}
// Store the parsed chart data
workSpace_->SetFileTypeData(fileTypes);
return true;
}

View File

@ -3,6 +3,7 @@
#include <QObject>
#include "xml/tinyxml2.h"
#include "workspace/ChartData.h"
class WorkSpace;

129
test_chart_parsing.cpp Normal file
View File

@ -0,0 +1,129 @@
#include <QApplication>
#include <QDebug>
#include <iostream>
#include "workspace/WorkSpaceXMLParse.h"
#include "common/ChartData.h"
void printChartData(const std::shared_ptr<BaseChartData>& chartData) {
if (!chartData) {
std::cout << " Chart data is null" << std::endl;
return;
}
std::cout << " Chart Name: " << chartData->name.toStdString() << std::endl;
std::cout << " Chart Path: " << chartData->path.toStdString() << std::endl;
// Handle different chart types
if (auto curveChart = std::dynamic_pointer_cast<CurveChartData>(chartData)) {
std::cout << " Chart Type: Curve" << std::endl;
std::cout << " X Title: " << curveChart->xTitle.toStdString() << std::endl;
std::cout << " Y Title: " << curveChart->yTitle.toStdString() << std::endl;
std::cout << " X Range: [" << curveChart->xMin << " - " << curveChart->xMax << "]" << std::endl;
std::cout << " Y Range: [" << curveChart->yMin << " - " << curveChart->yMax << "]" << std::endl;
std::cout << " X Count: " << curveChart->xCount << std::endl;
std::cout << " Time: " << curveChart->t << std::endl;
std::cout << " Curves (" << curveChart->curves.size() << "):" << std::endl;
for (const auto& curve : curveChart->curves) {
std::cout << " - Name: " << curve.name.toStdString()
<< ", Range: [" << curve.start << " - " << curve.stop << "]"
<< ", Color: " << curve.color.toStdString() << std::endl;
}
} else if (auto surfaceChart = std::dynamic_pointer_cast<SurfaceChartData>(chartData)) {
std::cout << " Chart Type: Surface" << std::endl;
std::cout << " X Title: " << surfaceChart->xTitle.toStdString() << std::endl;
std::cout << " Y Title: " << surfaceChart->yTitle.toStdString() << std::endl;
std::cout << " Z Title: " << surfaceChart->zTitle.toStdString() << std::endl;
std::cout << " X Range: [" << surfaceChart->xMin << " - " << surfaceChart->xMax << "]" << std::endl;
std::cout << " Y Range: [" << surfaceChart->yMin << " - " << surfaceChart->yMax << "]" << std::endl;
std::cout << " Z Range: [" << surfaceChart->zMin << " - " << surfaceChart->zMax << "]" << std::endl;
std::cout << " X Count: " << surfaceChart->xCount << std::endl;
std::cout << " Y Count: " << surfaceChart->yCount << std::endl;
std::cout << " Z Count: " << surfaceChart->zCount << std::endl;
std::cout << " Time: " << surfaceChart->t << std::endl;
std::cout << " Surface Curves (" << surfaceChart->curves.size() << "):" << std::endl;
for (const auto& curve : surfaceChart->curves) {
std::cout << " - Name: " << curve.name.toStdString()
<< ", Range: [" << curve.start << " - " << curve.stop << "]"
<< ", Color: " << curve.color.toStdString()
<< ", Position: (" << curve.x << "," << curve.y << "," << curve.z << ")" << std::endl;
}
} else if (auto tableChart = std::dynamic_pointer_cast<TableChartData>(chartData)) {
std::cout << " Chart Type: Table" << std::endl;
std::cout << " Head: " << tableChart->head.toStdString() << std::endl;
std::cout << " Time: " << tableChart->t << std::endl;
std::cout << " Table Data (" << tableChart->curves.size() << "):" << std::endl;
for (const auto& curve : tableChart->curves) {
std::cout << " - Name: " << curve.name.toStdString()
<< ", Color: " << curve.color.toStdString()
<< ", Data: " << curve.data.toStdString() << std::endl;
}
} else if (auto lightChart = std::dynamic_pointer_cast<LightChartData>(chartData)) {
std::cout << " Chart Type: Light" << std::endl;
std::cout << " Open Color: " << lightChart->openColor.toStdString() << std::endl;
std::cout << " Close Color: " << lightChart->closeColor.toStdString() << std::endl;
std::cout << " Time: " << lightChart->t << std::endl;
std::cout << " Light Data (" << lightChart->curves.size() << "):" << std::endl;
for (const auto& curve : lightChart->curves) {
std::cout << " - Name: " << curve.name.toStdString()
<< ", Data: " << curve.data.toStdString() << std::endl;
}
} else {
std::cout << " Chart Type: Unknown" << std::endl;
}
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
std::cout << "Testing XML Chart Parsing with New Inheritance Structure..." << std::endl;
// Test XML file path
QString xmlFilePath = "test_workspace.xml";
// Create parser instance
WorkSpaceXMLParse parser;
// Parse the XML file
FileTypeData fileData;
bool success = parser.ParseFiles(xmlFilePath, fileData);
if (!success) {
std::cout << "Failed to parse XML file: " << xmlFilePath.toStdString() << std::endl;
return -1;
}
std::cout << "Successfully parsed XML file!" << std::endl;
std::cout << "=== File Type Data ===" << std::endl;
std::cout << "Files count: " << fileData.files.size() << std::endl;
std::cout << "Charts count: " << fileData.charts.size() << std::endl;
// Print file information
std::cout << "\n=== Files ===" << std::endl;
for (int i = 0; i < fileData.files.size(); ++i) {
const auto& file = fileData.files[i];
std::cout << "File " << i << ":" << std::endl;
std::cout << " Name: " << file.name.toStdString() << std::endl;
std::cout << " Path: " << file.path.toStdString() << std::endl;
std::cout << " Type: " << static_cast<int>(file.type) << std::endl;
}
// Print chart information
std::cout << "\n=== Charts ===" << std::endl;
for (int i = 0; i < fileData.charts.size(); ++i) {
std::cout << "Chart " << i << ":" << std::endl;
printChartData(fileData.charts[i]);
std::cout << std::endl;
}
std::cout << "Test completed successfully!" << std::endl;
return 0;
}

45
test_workspace.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<scene name="test_chart" describe="测试图表解析" uuid="{test-uuid}" viewpoint="120.000000, 25.000000, 100.000000, 0.000000, -90.000000, 8200000.000000" commondPath="">
<charts>
<Wave file="D:/Project/DYTSrouce/bin/Release/workspace/test/Wave.txt"/>
<Report Report="D:/Project/DYTSrouce/bin/Release/workspace/test/Report.txt"/>
<RD RD="D:/Project/DYTSrouce/bin/Release/workspace/test/RD.txt"/>
<SimMatlab SimMatlab=""/>
</charts>
<timestep path="Timestep.txt"/>
<lamp path="D:/Project/DYTSrouce/bin/Release/workspace/test/Lamp.txt"/>
<commond path="command.xml"/>
<files>
<type name="curve" count="2">
<chart name="测试曲线1" path="Wave.txt" xTitle="时间" yTitle="幅度" xMin="0" xMax="250" xCount="6" yMin="-800" yMax="800" t="0">
<curve name="曲线1" color="255,0,0" start="1" stop="241"/>
<curve name="曲线2" color="0,255,0" start="50" stop="200"/>
</chart>
<chart name="测试曲线2" path="Wave2.txt" xTitle="频率" yTitle="功率" xMin="0" xMax="100" xCount="5" yMin="0" yMax="1000" t="0">
<curve name="功率曲线" color="0,0,255" start="1" stop="100"/>
</chart>
</type>
<type name="surface" count="1">
<Chart Name="RD图" path="RD.txt" xTitle="y" yTitle="z" zTitle="x" xMin="0" xMax="14000" xCount="7" yMin="0" yMax="0" yCount="0" zMin="0" zMax="70" zCount="7" t="0">
<curve Name="RD曲面" Color="61,38,168" Start="0" Stop="0" x="y" y="z" z="x"/>
</Chart>
</type>
<type name="table" count="1">
<chart Name="测试表格" path="Report.txt" head="编号,信噪比,方位瞄准线,俯仰注视角,方位,俯仰,属性,多普勒,航线,速度,经度,纬度,距离,速率,径向尺寸,目标RCS" t="0">
<curve Name="目标1" color="" data="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"/>
</chart>
</type>
<type name="light" count="1">
<chart name="信号灯" path="Lamp.txt" openColor="0,255,0" closeColor="255,0,0" t="0">
<curve name="目标1,目标2,目标3" data="1,2,3"/>
</chart>
</type>
</files>
<entities>
<Entity uuid="{test-entity-uuid}" name="test_entity">
<MeshComponent mesh="test/test.ive" location="0.000000,0.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000" uuid="{test-mesh-uuid}">
<LabelComponent text="test_entity" fontSize="26" visible="true" color="1.00,0.00,0.00,1.00" location="0.000000,0.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000" uuid="{test-label-uuid}"/>
</MeshComponent>
</Entity>
</entities>
</scene>