469 lines
19 KiB
C
469 lines
19 KiB
C
|
#ifndef XMLSERIALIZATION_MODEL_H
|
|||
|
#define XMLSERIALIZATION_MODEL_H
|
|||
|
#include "XmlSerializationGlobal.h"
|
|||
|
#include "ModelDS.hxx"
|
|||
|
#include <iostream>
|
|||
|
#include <fstream>
|
|||
|
#include <vector>
|
|||
|
#include "StabCalculation/StabCalculation.h"
|
|||
|
#include "xsd/cxx/tree/containers.hxx"
|
|||
|
|
|||
|
|
|||
|
using namespace std;
|
|||
|
|
|||
|
typedef model_ds::BInf BInf_Row;
|
|||
|
typedef model_ds::Shell Shell_Row;
|
|||
|
typedef model_ds::FloodPoint FloodPoint_Row;
|
|||
|
typedef model_ds::LimitStaticPoint LimitStaticPoint_Row;
|
|||
|
typedef model_ds::ImmersionPoint ImmersionPoint_Row;
|
|||
|
typedef model_ds::Deckline Deckline_Row;
|
|||
|
typedef model_ds::Compartment Compartment_Row;
|
|||
|
typedef model_ds::LWT LWT_Row;
|
|||
|
typedef model_ds::PartialLoad PartialLoad_Row;
|
|||
|
typedef model_ds::PartialLoadWeight PartialLoadWeight_Row;
|
|||
|
typedef model_ds::PartialLoadFreeSurf PartialLoadFreeSurf_Row;
|
|||
|
typedef model_ds::PartialLoadBulk PartialLoadBulk_Row;
|
|||
|
typedef model_ds::PartialLoadPerson PartialLoadPerson_Row;
|
|||
|
typedef model_ds::PartialLoadIce PartialLoadIce_Row;
|
|||
|
typedef model_ds::WindFixed WindFixed_Row;
|
|||
|
typedef model_ds::WindNonFixed WindNonFixed_Row;
|
|||
|
typedef model_ds::Case Case_Row;
|
|||
|
typedef model_ds::AllowNM AllowNM_Row;
|
|||
|
typedef model_ds::DamCase DamCase_Row;
|
|||
|
typedef model_ds::DamCompartment DamCompartment_Row;
|
|||
|
typedef model_ds::DamCaseProb DamCaseProb_Row;
|
|||
|
typedef model_ds::DamRegion DamRegion_Row;
|
|||
|
typedef model_ds::CompExtent CompExtent_Row;
|
|||
|
typedef model_ds::DamCompartmentProb DamCompartmentProb_Row;
|
|||
|
typedef model_ds::IncliningDraft IncliningDraft_Row;
|
|||
|
typedef model_ds::IncliningStatus IncliningStatus_Row;
|
|||
|
typedef model_ds::IncliningExtraWeight IncliningExtraWeight_Row;
|
|||
|
typedef model_ds::IncliningRelocateWeight IncliningRelocateWeight_Row;
|
|||
|
typedef model_ds::IncliningAbsentWeight IncliningAbsentWeight_Row;
|
|||
|
typedef model_ds::IncliningTank IncliningTank_Row;
|
|||
|
typedef model_ds::IncliningMobileWeight IncliningMobileWeight_Row;
|
|||
|
typedef model_ds::IncliningDevice IncliningDevice_Row;
|
|||
|
typedef model_ds::IncliningCase IncliningCase_Row;
|
|||
|
typedef model_ds::IncliningRecord IncliningRecord_Row;
|
|||
|
|
|||
|
|
|||
|
typedef model_ds::ModelDS::BInf_sequence BInf_Table;
|
|||
|
typedef model_ds::ModelDS::Shell_sequence Shell_Table;
|
|||
|
typedef model_ds::ModelDS::FloodPoint_sequence FloodPoint_Table;
|
|||
|
typedef model_ds::ModelDS::LimitStaticPoint_sequence LimitStaticPoint_Table;
|
|||
|
typedef model_ds::ModelDS::ImmersionPoint_sequence ImmersionPoint_Table;
|
|||
|
typedef model_ds::ModelDS::Deckline_sequence Deckline_Table;
|
|||
|
typedef model_ds::ModelDS::Compartment_sequence Compartment_Table;
|
|||
|
typedef model_ds::ModelDS::LWT_sequence LWT_Table;
|
|||
|
typedef model_ds::ModelDS::PartialLoad_sequence PartialLoad_Table;
|
|||
|
typedef model_ds::ModelDS::PartialLoadWeight_sequence PartialLoadWeight_Table;
|
|||
|
typedef model_ds::ModelDS::PartialLoadFreeSurf_sequence PartialLoadFreeSurf_Table;
|
|||
|
typedef model_ds::ModelDS::PartialLoadBulk_sequence PartialLoadBulk_Table;
|
|||
|
typedef model_ds::ModelDS::PartialLoadPerson_sequence PartialLoadPerson_Table;
|
|||
|
typedef model_ds::ModelDS::PartialLoadIce_sequence PartialLoadIce_Table;
|
|||
|
typedef model_ds::ModelDS::WindFixed_sequence WindFixed_Table;
|
|||
|
typedef model_ds::ModelDS::WindNonFixed_sequence WindNonFixed_Table;
|
|||
|
typedef model_ds::ModelDS::Case_sequence Case_Table;
|
|||
|
typedef model_ds::ModelDS::AllowNM_sequence AllowNM_Table;
|
|||
|
typedef model_ds::ModelDS::DamCase_sequence DamCase_Table;
|
|||
|
typedef model_ds::ModelDS::DamCompartment_sequence DamCompartment_Table;
|
|||
|
typedef model_ds::ModelDS::DamCaseProb_sequence DamCaseProb_Table;
|
|||
|
typedef model_ds::ModelDS::DamRegion_sequence DamRegion_Table;
|
|||
|
typedef model_ds::ModelDS::CompExtent_sequence CompExtent_Table;
|
|||
|
typedef model_ds::ModelDS::DamCompartmentProb_sequence DamCompartmentProb_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningDraft_sequence IncliningDraft_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningStatus_sequence IncliningStatus_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningExtraWeight_sequence IncliningExtraWeight_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningRelocateWeight_sequence IncliningRelocateWeight_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningAbsentWeight_sequence IncliningAbsentWeight_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningTank_sequence IncliningTank_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningMobileWeight_sequence IncliningMobileWeight_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningDevice_sequence IncliningDevice_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningCase_sequence IncliningCase_Table;
|
|||
|
typedef model_ds::ModelDS::IncliningRecord_sequence IncliningRecord_Table;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
class XmlSerialization
|
|||
|
{
|
|||
|
public:
|
|||
|
|
|||
|
static XmlSerialization *getXmlSerializationInstance();
|
|||
|
static void destroy();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void loadStabModelDS(const std::string &xml_str);
|
|||
|
std::string saveSerializationXMLFile(QString xmlfile_path);
|
|||
|
|
|||
|
// 反序列化 从modelDS中获取 数据
|
|||
|
BInf_Table* getBInf_table();
|
|||
|
Shell_Table* getShell_table();
|
|||
|
FloodPoint_Table* getFloodPoint_table();
|
|||
|
LimitStaticPoint_Table* getLimitStaticPoint_table();
|
|||
|
ImmersionPoint_Table* getImmersionPoint_table();
|
|||
|
Deckline_Table* getDeckline_table();
|
|||
|
Compartment_Table* getCompartment_table();
|
|||
|
LWT_Table* getLwt_table();
|
|||
|
PartialLoad_Table* getPartialLoad_table();
|
|||
|
PartialLoadWeight_Table* getPartialLoadWeight_table();
|
|||
|
PartialLoadFreeSurf_Table* getPartialLoadFreeSurf_table();
|
|||
|
PartialLoadBulk_Table* getPartialLoadBulk_table();
|
|||
|
PartialLoadPerson_Table* getPartialLoadPerson_table();
|
|||
|
PartialLoadIce_Table* getPartialLoadIce_table();
|
|||
|
WindFixed_Table* getWindFixed_table();
|
|||
|
WindNonFixed_Table* getWindNonFixed_table();
|
|||
|
Case_Table* getCase_table();
|
|||
|
AllowNM_Table* getAllowNM_table();
|
|||
|
DamCase_Table* getDamCase_table();
|
|||
|
DamCompartment_Table* getDamCompartment_table();
|
|||
|
DamCaseProb_Table* getDamCaseProb_table();
|
|||
|
DamRegion_Table* getDamRegion_table();
|
|||
|
CompExtent_Table* getCompExtent_table();
|
|||
|
DamCompartmentProb_Table* getDamCompartmentProb_table();
|
|||
|
IncliningDraft_Table* getIncliningDraft_table();
|
|||
|
IncliningStatus_Table* getIncliningStatus_table();
|
|||
|
IncliningExtraWeight_Table* getIncliningExtraWeight_table();
|
|||
|
IncliningRelocateWeight_Table* getIncliningRelocateWeight_table();
|
|||
|
IncliningAbsentWeight_Table* getIncliningAbsentWeight_table();
|
|||
|
IncliningTank_Table* getIncliningTank_table();
|
|||
|
IncliningMobileWeight_Table* getIncliningMobileWeight_table();
|
|||
|
IncliningDevice_Table* getIncliningDevice_table();
|
|||
|
IncliningCase_Table* getIncliningCase_table();
|
|||
|
IncliningRecord_Table* getIncliningRecord_table();
|
|||
|
|
|||
|
// 插入一行到 BInf 表
|
|||
|
void BInf_insertRow(BInf_Row& data);
|
|||
|
// 插入一行到 Shell 表
|
|||
|
void Shell_insertRow(Shell_Row& data);
|
|||
|
|
|||
|
// 插入一行到 FloodPoint 表
|
|||
|
void FloodPoint_insertRow(FloodPoint_Row& data);
|
|||
|
|
|||
|
// 插入一行到 LimitStaticPoint 表
|
|||
|
void LimitStaticPoint_insertRow(LimitStaticPoint_Row& data);
|
|||
|
|
|||
|
// 插入一行到 ImmersionPoint 表
|
|||
|
void ImmersionPoint_insertRow(ImmersionPoint_Row& data);
|
|||
|
|
|||
|
// 插入一行到 Deckline 表
|
|||
|
void Deckline_insertRow(Deckline_Row& data);
|
|||
|
|
|||
|
// 插入一行到 Compartment 表
|
|||
|
void Compartment_insertRow(Compartment_Row& data);
|
|||
|
|
|||
|
// 插入一行到 LWT 表
|
|||
|
void LWT_insertRow(LWT_Row& data);
|
|||
|
|
|||
|
// 插入一行到 PartialLoad 表
|
|||
|
void PartialLoad_insertRow(PartialLoad_Row& data);
|
|||
|
|
|||
|
// 插入一行到 PartialLoadWeight 表
|
|||
|
void PartialLoadWeight_insertRow(PartialLoadWeight_Row& data);
|
|||
|
|
|||
|
// 插入一行到 PartialLoadFreeSurf 表
|
|||
|
void PartialLoadFreeSurf_insertRow(PartialLoadFreeSurf_Row& data);
|
|||
|
|
|||
|
// 插入一行到 PartialLoadBulk 表
|
|||
|
void PartialLoadBulk_insertRow(PartialLoadBulk_Row& data);
|
|||
|
|
|||
|
// 插入一行到 PartialLoadPerson 表
|
|||
|
void PartialLoadPerson_insertRow(PartialLoadPerson_Row& data);
|
|||
|
|
|||
|
// 插入一行到 PartialLoadIce 表
|
|||
|
void PartialLoadIce_insertRow(PartialLoadIce_Row& data);
|
|||
|
|
|||
|
// 插入一行到 WindFixed 表
|
|||
|
void WindFixed_insertRow(WindFixed_Row& data);
|
|||
|
|
|||
|
// 插入一行到 WindNonFixed 表
|
|||
|
void WindNonFixed_insertRow(WindNonFixed_Row& data);
|
|||
|
|
|||
|
// 插入一行到 Case 表
|
|||
|
void Case_insertRow(Case_Row& data);
|
|||
|
|
|||
|
// 插入一行到 AllowNM 表
|
|||
|
void AllowNM_insertRow(AllowNM_Row& data);
|
|||
|
|
|||
|
// 插入一行到 DamCase 表
|
|||
|
void DamCase_insertRow(DamCase_Row& data);
|
|||
|
|
|||
|
// 插入一行到 DamCompartment 表
|
|||
|
void DamCompartment_insertRow(DamCompartment_Row& data);
|
|||
|
|
|||
|
// 插入一行到 DamCaseProb 表
|
|||
|
void DamCaseProb_insertRow(DamCaseProb_Row& data);
|
|||
|
|
|||
|
// 插入一行到 DamRegion 表
|
|||
|
void DamRegion_insertRow(DamRegion_Row& data);
|
|||
|
|
|||
|
// 插入一行到 CompExtent 表
|
|||
|
void CompExtent_insertRow(CompExtent_Row& data);
|
|||
|
|
|||
|
// 插入一行到 DamCompartmentProb 表
|
|||
|
void DamCompartmentProb_insertRow(DamCompartmentProb_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningDraft 表
|
|||
|
void IncliningDraft_insertRow(IncliningDraft_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningStatus 表
|
|||
|
void IncliningStatus_insertRow(IncliningStatus_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningExtraWeight 表
|
|||
|
void IncliningExtraWeight_insertRow(IncliningExtraWeight_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningRelocateWeight 表
|
|||
|
void IncliningRelocateWeight_insertRow(IncliningRelocateWeight_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningAbsentWeight 表
|
|||
|
void IncliningAbsentWeight_insertRow(IncliningAbsentWeight_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningTank 表
|
|||
|
void IncliningTank_insertRow(IncliningTank_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningMobileWeight 表
|
|||
|
void IncliningMobileWeight_insertRow(IncliningMobileWeight_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningDevice 表
|
|||
|
void IncliningDevice_insertRow(IncliningDevice_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningCase 表
|
|||
|
void IncliningCase_insertRow(IncliningCase_Row& data);
|
|||
|
|
|||
|
// 插入一行到 IncliningRecord 表
|
|||
|
void IncliningRecord_insertRow(IncliningRecord_Row& data);
|
|||
|
|
|||
|
|
|||
|
void ModelDSClear();
|
|||
|
|
|||
|
void BInfTableClear();
|
|||
|
|
|||
|
void ShellTableClear();
|
|||
|
|
|||
|
void FloodPointTableClear();
|
|||
|
|
|||
|
void LimitStaticPointTableClear();
|
|||
|
|
|||
|
void ImmersionPointTableClear();
|
|||
|
|
|||
|
void DecklineTableClear();
|
|||
|
|
|||
|
void CompartmentTableClear();
|
|||
|
|
|||
|
void LwtTableClear();
|
|||
|
|
|||
|
void PartialLoadTableClear();
|
|||
|
|
|||
|
void PartialLoadWeightTableClear();
|
|||
|
|
|||
|
void PartialLoadFreeSurfTableClear();
|
|||
|
|
|||
|
void PartialLoadBulkTableClear();
|
|||
|
|
|||
|
void PartialLoadPersonTableClear();
|
|||
|
|
|||
|
void PartialLoadIceTableClear();
|
|||
|
|
|||
|
void WindFixedTableClear();
|
|||
|
|
|||
|
void WindNonFixedTableClear();
|
|||
|
|
|||
|
void CaseTableClear();
|
|||
|
|
|||
|
void AllowNMTableClear();
|
|||
|
|
|||
|
void DamCaseTableClear();
|
|||
|
|
|||
|
void DamCompartmentTableClear();
|
|||
|
|
|||
|
void DamCaseProbTableClear();
|
|||
|
|
|||
|
void DamRegionTableClear();
|
|||
|
|
|||
|
void CompExtentTableClear();
|
|||
|
|
|||
|
void DamCompartmentProbTableClear();
|
|||
|
|
|||
|
void IncliningDraftTableClear();
|
|||
|
|
|||
|
void IncliningStatusTableClear();
|
|||
|
|
|||
|
void IncliningExtraWeightTableClear();
|
|||
|
|
|||
|
void IncliningRelocateWeightTableClear();
|
|||
|
|
|||
|
void IncliningAbsentWeightTableClear();
|
|||
|
|
|||
|
void IncliningTankTableClear();
|
|||
|
|
|||
|
void IncliningMobileWeightTableClear();
|
|||
|
|
|||
|
void IncliningDeviceTableClear();
|
|||
|
|
|||
|
void IncliningCaseTableClear();
|
|||
|
|
|||
|
void IncliningRecordTableClear();
|
|||
|
|
|||
|
|
|||
|
// 反序列化
|
|||
|
|
|||
|
void getStationLabelTableData(vector<StationLabel>& data_grid_view);
|
|||
|
void getWaterlineLabelTableData(vector<WaterlineLabel>& data_grid_view);
|
|||
|
void getButtocklineLabelTableData(vector<ButtocklineLabel>& data_grid_view);
|
|||
|
|
|||
|
void getXLabelTableData(vector<XLabel>& data_grid_view);
|
|||
|
void getBInfTableData(vector<BInf> &data_grid_view);
|
|||
|
void getShellTableData(vector<Shell> &data_grid_view);
|
|||
|
void getFloodPointTableData(vector<FloodPoint> &data_grid_view);
|
|||
|
void getLimitStaticPointTableData(vector<LimitStaticPoint> &data_grid_view);
|
|||
|
void getImmersionPointTableData(vector<ImmersionPoint> &data_grid_view);
|
|||
|
void getDecklineTableData(vector<Deckline> &data_grid_view);
|
|||
|
void getCompartmentTableData(vector<Compartment> &data_grid_view);
|
|||
|
void getLwtTableData(vector<LWT> &data_grid_view);
|
|||
|
void getPartialLoadTableData(vector<PartialLoad> &data_grid_view);
|
|||
|
void getPartialLoadWeightTableData(vector<PartialLoadWeight> &data_grid_view);
|
|||
|
void getPartialLoadFreeSurfTableData(vector<PartialLoadFreeSurf> &data_grid_view);
|
|||
|
void getPartialLoadBulkTableData(vector<PartialLoadBulk> &data_grid_view);
|
|||
|
void getPartialLoadPersonTableData(vector<PartialLoadPerson> &data_grid_view);
|
|||
|
void getPartialLoadIceTableData(vector<PartialLoadIce> &data_grid_view);
|
|||
|
void getWindFixedTableData(vector<WindFixed> &data_grid_view);
|
|||
|
void getWindNonFixedTableData(vector<WindNonFixed> &data_grid_view);
|
|||
|
void getCaseTableData(vector<Case> &data_grid_view);
|
|||
|
void getAllowNMTableData(vector<AllowNM> &data_grid_view);
|
|||
|
void getDamCaseTableData(vector<DamCase> &data_grid_view);
|
|||
|
void getDamCompartmentTableData(vector<DamCompartment> &data_grid_view);
|
|||
|
void getDamCaseProbTableData(vector<DamCaseProb> &data_grid_view);
|
|||
|
void getDamRegionTableData(vector<DamRegion> &data_grid_view);
|
|||
|
void getCompExtentTableData(vector<CompExtent> &data_grid_view);
|
|||
|
void getDamCompartmentProbTableData(vector<DamCompartmentProb> &data_grid_view);
|
|||
|
void getIncliningDraftTableData(vector<IncliningDraft> &data_grid_view);
|
|||
|
void getIncliningStatusTableData(vector<IncliningStatus> &data_grid_view);
|
|||
|
void getIncliningExtraWeightTableData(vector<IncliningExtraWeight> &data_grid_view);
|
|||
|
void getIncliningRelocateWeightTableData(vector<IncliningRelocateWeight> &data_grid_view);
|
|||
|
void getIncliningAbsentWeightTableData(vector<IncliningAbsentWeight> &data_grid_view);
|
|||
|
void getIncliningTankTableData(vector<IncliningTank> &data_grid_view);
|
|||
|
void getIncliningMobileWeightTableData(vector<IncliningMobileWeight> &data_grid_view);
|
|||
|
void getIncliningDeviceTableData(vector<IncliningDevice> &data_grid_view);
|
|||
|
void getIncliningCaseTableData(vector<IncliningCase> &data_grid_view);
|
|||
|
void getIncliningRecordTableData(vector<IncliningRecord> &data_grid_view);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// 序列化
|
|||
|
void setXLabelDataSet(const vector<XLabel>& data_grid_view);
|
|||
|
void setBInfDataSet(const vector<BInf> &data_grid_view);
|
|||
|
void setShellDataSet(const vector<Shell> &data_grid_view);
|
|||
|
void setFloodPointDataSet(const vector<FloodPoint> &data_grid_view);
|
|||
|
void setLimitStaticPointDataSet(const vector<LimitStaticPoint> &data_grid_view);
|
|||
|
void setImmersionPointDataSet(const vector<ImmersionPoint> &data_grid_view);
|
|||
|
void setDecklineDataSet(const vector<Deckline> &data_grid_view);
|
|||
|
void setCompartmentDataSet(const vector<Compartment> &data_grid_view);
|
|||
|
void setLwtDataSet(const vector<LWT> &data_grid_view);
|
|||
|
void setPartialLoadDataSet(const vector<PartialLoad> &data_grid_view);
|
|||
|
void setPartialLoadWeightDataSet(const vector<PartialLoadWeight> &data_grid_view);
|
|||
|
void setPartialLoadFreeSurfDataSet(const vector<PartialLoadFreeSurf> &data_grid_view);
|
|||
|
void setPartialLoadBulkDataSet(const vector<PartialLoadBulk> &data_grid_view);
|
|||
|
void setPartialLoadPersonDataSet(const vector<PartialLoadPerson> &data_grid_view);
|
|||
|
void setPartialLoadIceDataSet(const vector<PartialLoadIce> &data_grid_view);
|
|||
|
void setWindFixedDataSet(const vector<WindFixed> &data_grid_view);
|
|||
|
void setWindNonFixedDataSet(const vector<WindNonFixed> &data_grid_view);
|
|||
|
void setCaseDataSet(const vector<Case> &data_grid_view);
|
|||
|
void setAllowNMDataSet(const vector<AllowNM> &data_grid_view);
|
|||
|
void setDamCaseDataSet(const vector<DamCase> &data_grid_view);
|
|||
|
void setDamCompartmentDataSet(const vector<DamCompartment> &data_grid_view);
|
|||
|
void setDamCaseProbDataSet(const vector<DamCaseProb> &data_grid_view);
|
|||
|
void setDamRegionDataSet(const vector<DamRegion> &data_grid_view);
|
|||
|
void setCompExtentDataSet(const vector<CompExtent> &data_grid_view);
|
|||
|
void setDamCompartmentProbDataSet(const vector<DamCompartmentProb> &data_grid_view);
|
|||
|
void setIncliningDraftDataSet(const vector<IncliningDraft> &data_grid_view);
|
|||
|
void setIncliningStatusDataSet(const vector<IncliningStatus> &data_grid_view);
|
|||
|
void setIncliningExtraWeightDataSet(const vector<IncliningExtraWeight> &data_grid_view);
|
|||
|
void setIncliningRelocateWeightDataSet(const vector<IncliningRelocateWeight> &data_grid_view);
|
|||
|
void setIncliningAbsentWeightDataSet(const vector<IncliningAbsentWeight> &data_grid_view);
|
|||
|
void setIncliningTankDataSet(const vector<IncliningTank> &data_grid_view);
|
|||
|
void setIncliningMobileWeightDataSet(const vector<IncliningMobileWeight> &data_grid_view);
|
|||
|
void setIncliningDeviceDataSet(const vector<IncliningDevice> &data_grid_view);
|
|||
|
void setIncliningCaseDataSet(const vector<IncliningCase> &data_grid_view);
|
|||
|
void setIncliningRecordDataSet(const vector<IncliningRecord> &data_grid_view);
|
|||
|
|
|||
|
void setStationLabelDataSet(const vector<StationLabel>& data_grid_view);
|
|||
|
void setWaterlineLabelDataSet(const vector<WaterlineLabel>& data_grid_view);
|
|||
|
void setButtocklineLabelDataSet(const vector<ButtocklineLabel>& data_grid_view);
|
|||
|
|
|||
|
// 查询ParamID值
|
|||
|
std::string getParamIDValue(std::string paramid)
|
|||
|
{
|
|||
|
auto &existing_binf = m_ModelDS->BInf(); // 获取现有序列
|
|||
|
for (auto &item : existing_binf)
|
|||
|
{
|
|||
|
if(item.ParamID() == paramid)
|
|||
|
{
|
|||
|
return item.Value().get();
|
|||
|
}
|
|||
|
}
|
|||
|
return "";
|
|||
|
}
|
|||
|
|
|||
|
private:
|
|||
|
XmlSerialization();
|
|||
|
~XmlSerialization();
|
|||
|
XmlSerialization(const XmlSerialization &) = delete;
|
|||
|
XmlSerialization &operator=(const XmlSerialization &) = delete;
|
|||
|
|
|||
|
|
|||
|
void updateBInfSequence(const std::vector<BInf> &new_binf_data)
|
|||
|
{
|
|||
|
auto &existing_binf = m_ModelDS->BInf(); // 获取现有序列
|
|||
|
std::unordered_map<std::string, model_ds::BInf *> existing_map; // 键: ParamID, 值: BInf指针
|
|||
|
|
|||
|
// 构建旧数据的哈希表 (O(n))
|
|||
|
for (auto &item : existing_binf)
|
|||
|
{
|
|||
|
existing_map[item.ParamID()] = &item;
|
|||
|
}
|
|||
|
|
|||
|
// 遍历新数据,更新或插入
|
|||
|
for (const auto &new_item : new_binf_data)
|
|||
|
{
|
|||
|
const std::string &key = new_item.paramid;
|
|||
|
auto it = existing_map.find(key);
|
|||
|
|
|||
|
if (it != existing_map.end())
|
|||
|
{
|
|||
|
// 键存在:更新现有对象
|
|||
|
auto existing_obj = it->second;
|
|||
|
// *existing_obj = new_item; // 直接赋值(如果BInf支持operator=)
|
|||
|
|
|||
|
// 或手动更新每个字段(更安全)
|
|||
|
|
|||
|
existing_obj->Unit(new_item.unit);
|
|||
|
existing_obj->Caption(new_item.caption);
|
|||
|
existing_obj->ValueType(new_item.value_type);
|
|||
|
existing_obj->Value(new_item.value);
|
|||
|
existing_obj->Remark(new_item.remark);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
model_ds::BInf obj(new_item.paramid);
|
|||
|
|
|||
|
obj.Unit(new_item.unit);
|
|||
|
obj.Caption(new_item.caption);
|
|||
|
obj.ValueType(new_item.value_type);
|
|||
|
obj.Value(new_item.value);
|
|||
|
obj.Remark(new_item.remark);
|
|||
|
m_ModelDS->BInf().push_back(obj);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private:
|
|||
|
static XmlSerialization *m_pXmlSerialization;
|
|||
|
|
|||
|
// 稳性计算数据集
|
|||
|
std::unique_ptr<::model_ds::ModelDS> m_ModelDS;
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
#endif // INLAND_MODEL_H
|