From a208823264dbae8001386242b2fcaa0975e03713 Mon Sep 17 00:00:00 2001 From: "dmy@lab" Date: Tue, 20 Jan 2015 13:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E8=B4=9F=E8=8D=B7=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E5=88=B0=E5=8F=98=E5=8E=8B=E5=99=A8=E4=B8=8A=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dmy@lab --- testHasttable/cimexporter.cpp | 33 ++++++++++++------------------ testHasttable/elementhashtable.cpp | 2 +- testHasttable/loadmapping.h | 5 +++-- testHasttable/main.cpp | 3 +-- testHasttable/task.cpp | 2 ++ 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/testHasttable/cimexporter.cpp b/testHasttable/cimexporter.cpp index c976101..095fb09 100644 --- a/testHasttable/cimexporter.cpp +++ b/testHasttable/cimexporter.cpp @@ -53,25 +53,18 @@ void CIMExporter::exportTo(const QString& path) recurseDir.setDir(this->loadDir); QStringList files; files=recurseDir.getFiles(); - //转换斜杠 - for(QStringList::iterator ite=files.begin();ite!=files.end();ite++) + //只取文件名 + QStringList baseNames; + foreach(QString file,files) { - *ite=(*ite).replace("\\","/"); + QFileInfo fileInfo(file); + baseNames<::iterator ite=this->tf.begin(); ite!=this->tf.end(); ite++) { - std::cout<<"f"<tf->getTF(); QString subID=tf->getEquipmentMemberOf_EquipmentContainer();//所属Substation的ID Substation *sub=static_cast(this->eleHT[subID]); @@ -84,12 +77,12 @@ void CIMExporter::exportTo(const QString& path) QVector > vecLoadInfo=loadMapping.getSubstationLoad(sub->getID()); foreach(QSharedPointer p,vecLoadInfo) { - std::cout<<"match "<getLoadPath().toLocal8Bit().data()<getLoadPath()) ) + QFileInfo targetBasename(p->getLoadPath()); + std::cout<getLoadPath(); - - +// std::cout<<"match "<getPA(); break; } @@ -97,11 +90,11 @@ void CIMExporter::exportTo(const QString& path) } //列出没有用的负荷文件 - foreach(QString file, files) + foreach(QString name, baseNames) { - if(!usedLoad.contains(file)) + if(!usedLoad.contains(name)) { - std::cout<tpRecorder=new TopologyRecorder(this->eleHT,this->FDSet,this->loadFilePath); this->tpRecorder->startWithNode(node); -// this->tpRecorder->exportTo(""); + this->tpRecorder->exportTo(""); break; } } diff --git a/testHasttable/loadmapping.h b/testHasttable/loadmapping.h index 28ded18..66c59b6 100644 --- a/testHasttable/loadmapping.h +++ b/testHasttable/loadmapping.h @@ -27,8 +27,7 @@ public: QSharedPointer getALoad(const QString& id); QVector > getSubstationLoad(const QString& id); bool load(const QString& loadDir, const QString &matchdDir, const QString &exceptionFile); - bool readLoads(const QString& dir); - bool readMatch(const QString& dir); + private: class CG // 它的唯一工作就是在析构函数中删除CSingleton的实例 @@ -43,6 +42,8 @@ private: } }; static CG Garbo; // 定义一个静态成员,在程序结束时,系统会调用它的析构函数 + bool readLoads(const QString& dir); + bool readMatch(const QString& dir); // static QHash > *ht;// static QHash > > *loads;//保存的是一个Substation下面的所有负荷信息 static QHash > *loadsToLoadInfo; diff --git a/testHasttable/main.cpp b/testHasttable/main.cpp index 945f07a..d0364b9 100644 --- a/testHasttable/main.cpp +++ b/testHasttable/main.cpp @@ -9,8 +9,7 @@ int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); -// LoadMapping lm; -// lm.load("D:/Project/佛山项目/数据/搭网架参数文件/","D:/Project/佛山项目/数据/匹配的数据/","D:/Project/佛山项目/数据/exception.txt"); + // LoadInfo loadInfo; // loadInfo.setLoadPath("D:/Project/佛山项目/数据/搭网架参数文件/泰安/泰安负荷/718发展线/专变/威灵电机工业园电房1.csv"); // loadInfo.updateByTime(QTime(0,15,0)); diff --git a/testHasttable/task.cpp b/testHasttable/task.cpp index 4f3c7e9..982e735 100644 --- a/testHasttable/task.cpp +++ b/testHasttable/task.cpp @@ -7,6 +7,8 @@ Task::Task() void Task::doAgainstTaskFile(ElementHashtable &eleHT) { + LoadMapping lm; + lm.load("D:/Project/佛山项目/数据/搭网架参数文件/","D:/Project/佛山项目/数据/匹配的数据/","D:/Project/佛山项目/数据/exception.txt");//单例,执行一次行了。 QFile file(this->taskFile); QString line; QStringList sep;