Browse Source

格式化

divide_struct_def_imp
郑敬润 1 year ago
parent
commit
b53fcc82ff
  1. 625
      src/xmlsql.cpp

625
src/xmlsql.cpp

@ -5,424 +5,449 @@
#include "Astar.h" #include "Astar.h"
#include "Geometry.h" #include "Geometry.h"
#include "Intersection.h" #include "Intersection.h"
#include<string> #include <string>
#include<map> #include <map>
#include <iomanip> #include <iomanip>
#include<io.h> #include <io.h>
#include<vector> #include <vector>
#include<fstream> #include <fstream>
#include<sstream> #include <sstream>
#include<time.h> #include <time.h>
using namespace std; using namespace std;
map<P, string> pmp, clipName;
map<P,string> pmp,clipName; struct Readexcel
{
struct Readexcel{ vector<string> slist;
vector<string>slist; TiXmlElement *GetNodePointerByName(TiXmlElement *pRootEle, const char *strNodeName)
TiXmlElement* GetNodePointerByName(TiXmlElement* pRootEle, const char* strNodeName)
{ {
// if equal root node then return // if equal root node then return
if (0 == strcmp(strNodeName, pRootEle->Value())) if (0 == strcmp(strNodeName, pRootEle->Value()))
{ {
return pRootEle; return pRootEle;
} }
TiXmlElement* pEle = pRootEle; TiXmlElement *pEle = pRootEle;
for (pEle = pRootEle->FirstChildElement(); pEle; pEle = pEle->NextSiblingElement()) for (pEle = pRootEle->FirstChildElement(); pEle; pEle = pEle->NextSiblingElement())
{ {
// recursive find sub node return node pointer // recursive find sub node return node pointer
if (0 != strcmp(pEle->Value(), strNodeName)) if (0 != strcmp(pEle->Value(), strNodeName))
{ {
TiXmlElement* res=GetNodePointerByName(pEle,strNodeName); TiXmlElement *res = GetNodePointerByName(pEle, strNodeName);
if(res!=NULL)return res; if (res != NULL)
return res;
} }
else return pEle; else
} return pEle;
}
return NULL; return NULL;
} }
vector<string> read(string xml){ vector<string> read(string xml)
{
slist.clear(); slist.clear();
TiXmlDocument* pDoc = new TiXmlDocument(); TiXmlDocument *pDoc = new TiXmlDocument();
pDoc->LoadFile(xml.c_str()); pDoc->LoadFile(xml.c_str());
TiXmlElement *RootElement = pDoc->RootElement(); TiXmlElement *RootElement = pDoc->RootElement();
TiXmlElement * row=GetNodePointerByName(RootElement, "Row"); TiXmlElement *row = GetNodePointerByName(RootElement, "Row");
TiXmlElement* pEle; TiXmlElement *pEle;
for (pEle =row; pEle; pEle = pEle->NextSiblingElement()) for (pEle = row; pEle; pEle = pEle->NextSiblingElement())
{ {
// recursive find sub node return node pointer // recursive find sub node return node pointer
TiXmlElement* cell; TiXmlElement *cell;
string s[7]; string s[7];
int i=0; int i = 0;
for (cell =pEle->FirstChildElement(); cell; cell = cell->NextSiblingElement()){ for (cell = pEle->FirstChildElement(); cell; cell = cell->NextSiblingElement())
{
//cout<<(cell->FirstChildElement()->GetText())<<endl;
// cout<<(cell->FirstChildElement()->GetText())<<endl;
s[i]=cell->FirstChildElement()->GetText();
s[i] = cell->FirstChildElement()->GetText();
i++; i++;
} }
slist.push_back(s[0]); slist.push_back(s[0]);
slist.push_back(s[1]+" "+s[2]+" "+s[3]); slist.push_back(s[1] + " " + s[2] + " " + s[3]);
slist.push_back(s[4]+" "+s[5]+" "+s[6]); slist.push_back(s[4] + " " + s[5] + " " + s[6]);
} }
return slist; return slist;
} }
}rexcel; } rexcel;
//读取卡箍点
void read_points(string filename,Astar * pastar){
//cout<<"read "<<filename<<endl;
vector<string>sl=rexcel.read(filename);
//cout<<"------"<<endl;
// 读取卡箍点
void read_points(string filename, Astar *pastar)
{
// cout<<"read "<<filename<<endl;
vector<string> sl = rexcel.read(filename);
// cout<<"------"<<endl;
for(int i=0;i<sl.size();i+=3) for (int i = 0; i < sl.size(); i += 3)
{ {
string s1=sl[i+1],s2=sl[i+2],s0=sl[i]; string s1 = sl[i + 1], s2 = sl[i + 2], s0 = sl[i];
//cout<<s0<<" "<<s1<<endl;//test // cout<<s0<<" "<<s1<<endl;//test
istringstream sin(s1),sin2(s2); //将整行字符串line读入到字符串流istringstream中 istringstream sin(s1), sin2(s2); // 将整行字符串line读入到字符串流istringstream中
P p1,p2; P p1, p2;
sin>>p1.x>>p1.y>>p1.z; sin >> p1.x >> p1.y >> p1.z;
sin2>>p2.x>>p2.y>>p2.z; sin2 >> p2.x >> p2.y >> p2.z;
//p1.print("p"); // p1.print("p");
pmp[p1]=s1; pmp[p1] = s1;
pmp[p2]=s2; pmp[p2] = s2;
clipName[p1]=s0; clipName[p1] = s0;
clipSet.addclip(p1,p2,s0,2); clipSet.addclip(p1, p2, s0, 2);
pastar->add_clip(clipSet.c[clipSet.clipnum]); pastar->add_clip(clipSet.c[clipSet.clipnum]);
//cout<<"--"<<endl; // cout<<"--"<<endl;
kdtree.add(p1); kdtree.add(p1);
}
}
unsigned int extractAndConvert(const string &str)
{
size_t pos = str.find("/"); // 查找 "//" 的位置
if (pos == std::string::npos)
{
throw invalid_argument("No '/' found in the string.");
} }
string numberStr = str.substr(0, pos); // 截取 "//" 之前的部分
char *endptr;
long number = strtol(numberStr.c_str(), &endptr, 10); // 使用 strtol 将字符串转换为 long,并检查转换是否成功
if (endptr == numberStr.c_str() || *endptr != '\0' || number < 0 || static_cast<unsigned int>(number) != number)
{
throw invalid_argument("Invalid input string for conversion to unsigned int.");
} // 检查转换是否成功,以及值是否在 unsigned int 的范围内
return static_cast<unsigned int>(number); // 转换为 unsigned int 并返回
} }
unsigned int extractAndConvert(const string& str) { bool read_OBJ(const string &filename, vector<Vec3f> &vertices, vector<Vec3u> &indices)
size_t pos = str.find("/"); // 查找 "//" 的位置
if (pos == std::string::npos) {
throw invalid_argument("No '/' found in the string.");
}
string numberStr = str.substr(0, pos); // 截取 "//" 之前的部分
char* endptr;
long number = strtol(numberStr.c_str(), &endptr, 10); // 使用 strtol 将字符串转换为 long,并检查转换是否成功
if (endptr == numberStr.c_str() || *endptr != '\0' || number < 0 || static_cast<unsigned int>(number) != number) {
throw invalid_argument("Invalid input string for conversion to unsigned int.");
} // 检查转换是否成功,以及值是否在 unsigned int 的范围内
return static_cast<unsigned int>(number); // 转换为 unsigned int 并返回
}
bool read_OBJ(const string& filename,vector<Vec3f>& vertices,vector<Vec3u>& indices)
{ {
ifstream file(filename.c_str()); ifstream file(filename.c_str());
if (!file.is_open()) { if (!file.is_open())
return false; {
} return false;
string line; }
while (getline(file, line)) { string line;
// 忽略空行和注释行 while (getline(file, line))
if (line.empty() || line.at(0) == '#') { {
continue; // 忽略空行和注释行
} if (line.empty() || line.at(0) == '#')
//std::cout<<line<<std::endl; {
istringstream iss(line); continue;
string token; }
if (iss >> token && token == "v") {// 解析顶点 // std::cout<<line<<std::endl;
float x, y, z; istringstream iss(line);
iss >> x >> y >> z; string token;
//std::cout<<"v:"<<x<<" "<<y<<" "<<z<<std::endl; if (iss >> token && token == "v")
//std::cout<<"vertices_length"<<vertices.size()<<std::endl; { // 解析顶点
vertices.push_back(Vec3f(x,y,z)); float x, y, z;
} iss >> x >> y >> z;
else if (token == "f") {// 解析面(这里只提取顶点索引) // std::cout<<"v:"<<x<<" "<<y<<" "<<z<<std::endl;
//std::cout<<"enter_f"<<std::endl; // std::cout<<"vertices_length"<<vertices.size()<<std::endl;
string v1_s,v2_s,v3_s; vertices.push_back(Vec3f(x, y, z));
unsigned int v1, v2, v3; // 通常一个面由三个顶点定义 }
if (!(iss >> v1_s >> v2_s >> v3_s)) { else if (token == "f")
// 处理非三角形面或其他错误情况 { // 解析面(这里只提取顶点索引)
continue; // std::cout<<"enter_f"<<std::endl;
} string v1_s, v2_s, v3_s;
try { unsigned int v1, v2, v3; // 通常一个面由三个顶点定义
v1=extractAndConvert(v1_s)-1; if (!(iss >> v1_s >> v2_s >> v3_s))
} catch (const std::exception& e) { {
std::cerr << "Error: " << e.what() << std::endl; // 处理非三角形面或其他错误情况
} continue;
try { }
v2=extractAndConvert(v2_s)-1; try
} catch (const std::exception& e) { {
std::cerr << "Error: " << e.what() << std::endl; v1 = extractAndConvert(v1_s) - 1;
} }
try { catch (const std::exception &e)
v3=extractAndConvert(v3_s)-1; {
} catch (const std::exception& e) { std::cerr << "Error: " << e.what() << std::endl;
std::cerr << "Error: " << e.what() << std::endl; }
} try
//std::cout<<"f:"<<v1<<" "<<v2<<" "<<v3<<std::endl; {
//std::cout<<"indices_length:"<<indices.size()<<std::endl; v2 = extractAndConvert(v2_s) - 1;
indices.push_back(Vec3u(v1,v2,v3)); }
} catch (const std::exception &e)
//else std::cout<<token<<std::endl; {
// 忽略其他类型的行(如法线、纹理坐标等) std::cerr << "Error: " << e.what() << std::endl;
} }
file.close(); try
return true; {
v3 = extractAndConvert(v3_s) - 1;
}
catch (const std::exception &e)
{
std::cerr << "Error: " << e.what() << std::endl;
}
// std::cout<<"f:"<<v1<<" "<<v2<<" "<<v3<<std::endl;
// std::cout<<"indices_length:"<<indices.size()<<std::endl;
indices.push_back(Vec3u(v1, v2, v3));
}
// else std::cout<<token<<std::endl;
// 忽略其他类型的行(如法线、纹理坐标等)
}
file.close();
return true;
} }
void produceXML(const char * xml,const char * connectorFile,string resultfile){ void produceXML(const char *xml, const char *connectorFile, string resultfile)
ofstream ofs,oendpoint; {
ofstream ofs, oendpoint;
ofs.open("result.txt", ios::out); ofs.open("result.txt", ios::out);
string endfilename="end"+resultfile; string endfilename = "end" + resultfile;
//oendpoint.open(endfilename.c_str(),ios::out); // oendpoint.open(endfilename.c_str(),ios::out);
readxml(xml, connectorFile);
readxml(xml,connectorFile);
cout << "wire_pairs num: " << wire_pairs.size() << endl;
cout<<"wire_pairs num: "<<wire_pairs.size()<<endl;
for (int i = 0; i < wire_pairs.size(); i++)
for(int i=0;i<wire_pairs.size();i++){ {
//if(i!=6)continue; // if(i!=6)continue;
Bund &bd=wire_pairs[i]; Bund &bd = wire_pairs[i];
//oendpoint<<bd.start.x<<" "<<bd.start.y<<" "<<bd.start.z<<endl; // oendpoint<<bd.start.x<<" "<<bd.start.y<<" "<<bd.start.z<<endl;
//oendpoint<<bd.goal.x<<" "<<bd.goal.y<<" "<<bd.goal.z<<endl; // oendpoint<<bd.goal.x<<" "<<bd.goal.y<<" "<<bd.goal.z<<endl;
bd.start.isend=1; bd.start.isend = 1;
bd.goal.isend=1; bd.goal.isend = 1;
if(inbox(bd.start)&&inbox(bd.goal)){ if (inbox(bd.start) && inbox(bd.goal))
{
cout<<"yes"<<endl;
Path path=astar.search_pair(bd); cout << "yes" << endl;
for(int j=0;j<path.points.size();j++){ Path path = astar.search_pair(bd);
P pp=path.points[j]; for (int j = 0; j < path.points.size(); j++)
ofs<<pp.x<<" "<<pp.y<<" "<<pp.z<<endl; {
cout<<setprecision(10)<<"("<<pp.x<<","<<pp.y<<","<<pp.z<<")"; P pp = path.points[j];
if(j!=path.points.size()-1)cout<<"->"; ofs << pp.x << " " << pp.y << " " << pp.z << endl;
cout << setprecision(10) << "(" << pp.x << "," << pp.y << "," << pp.z << ")";
if (j != path.points.size() - 1)
cout << "->";
} }
cout<<endl; cout << endl;
cout<<endl; cout << endl;
ofs<<"#"<<endl; ofs << "#" << endl;
ofs<<endl; ofs << endl;
branchTree.addPath(path); branchTree.addPath(path);
} }
else cout<<"no "<<i<<endl; else
cout << "no " << i << endl;
} }
branchTree.init();
branchTree.init();
} }
void getAllFiles(string path, vector<string>& files) { void getAllFiles(string path, vector<string> &files)
//文件句柄 {
// 文件句柄
long long hFile = 0; long long hFile = 0;
//文件信息 // 文件信息
struct _finddata_t fileinfo; struct _finddata_t fileinfo;
string p; string p;
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) { if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1)
do { {
if ((fileinfo.attrib & _A_SUBDIR)) { //比较文件类型是否是文件夹 do
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) { {
if ((fileinfo.attrib & _A_SUBDIR))
{ // 比较文件类型是否是文件夹
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
{
files.push_back(p.assign(path).append("\\").append(fileinfo.name)); files.push_back(p.assign(path).append("\\").append(fileinfo.name));
//递归搜索 // 递归搜索
getAllFiles(p.assign(path).append("\\").append(fileinfo.name), files); getAllFiles(p.assign(path).append("\\").append(fileinfo.name), files);
} }
} }
else { else
{
files.push_back(p.assign(path).append("\\").append(fileinfo.name)); files.push_back(p.assign(path).append("\\").append(fileinfo.name));
} }
} while (_findnext(hFile, &fileinfo) == 0); //寻找下一个,成功返回0,否则-1 } while (_findnext(hFile, &fileinfo) == 0); // 寻找下一个,成功返回0,否则-1
_findclose(hFile); _findclose(hFile);
} }
} }
//初始化各个结构体 // 初始化各个结构体
inline void init(){ inline void init()
{
kdtree.build(); kdtree.build();
cout<<"kdtree build Finish"<<endl; cout << "kdtree build Finish" << endl;
clipSet.computeCenter(); clipSet.computeCenter();
cout<<"compute center Finish Y:"<<Ycenter<<" Z:"<<Zcenter<<endl; cout << "compute center Finish Y:" << Ycenter << " Z:" << Zcenter << endl;
clipSet.buildChannel(); clipSet.buildChannel();
basicChannel.createChannel(); basicChannel.createChannel();
cout<<"basicChannel build Finish"<<endl; cout << "basicChannel build Finish" << endl;
basicChannel.createBranchPoint(); basicChannel.createBranchPoint();
cout<<"branchPoint create Finish"<<endl; cout << "branchPoint create Finish" << endl;
for(int i=1;i<=branchPointSet.branchPointNum;i++){ for (int i = 1; i <= branchPointSet.branchPointNum; i++)
{
astar.add_branchPoint(branchPointSet.b[i]); astar.add_branchPoint(branchPointSet.b[i]);
} }
astar.init(); astar.init();
cout<<"astar init Finish clipNum:"<<astar.pnum-2<<" Toatal Point Num:"<<astar.tnum<<endl; cout << "astar init Finish clipNum:" << astar.pnum - 2 << " Toatal Point Num:" << astar.tnum << endl;
basicEdge.buildEdgeBetweenClipAndBranchPoint(); basicEdge.buildEdgeBetweenClipAndBranchPoint();
cout<<"edge build Finish"<<endl; cout << "edge build Finish" << endl;
cout<<"INIT Finish"<<endl; cout << "INIT Finish" << endl;
} }
int _tmain(int argc, char * argv[]) int _tmain(int argc, char *argv[])
{ {
// test();
//test(); // return 0;
//return 0; cout << "Start" << endl;
cout<<"Start"<<endl; Astar *pastar = &astar;
Astar *pastar=&astar;
string mode; string mode;
// cin>>mode; // cin>>mode;
mode = argv[1]; mode = argv[1];
if(mode=="generateCATIA"){ if (mode == "generateCATIA")
//该模式为基本模式,使用它来生成通道模型 {
string clipDoc,xmlDoc,connectorFile,stlFileName,outputFileName; // 该模式为基本模式,使用它来生成通道模型
cin>>clipDoc>>xmlDoc>>connectorFile>>stlFileName>>outputFileName; string clipDoc, xmlDoc, connectorFile, stlFileName, outputFileName;
cin >> clipDoc >> xmlDoc >> connectorFile >> stlFileName >> outputFileName;
vector<string> clipFileNames; vector<string> clipFileNames;
getAllFiles(clipDoc,clipFileNames); getAllFiles(clipDoc, clipFileNames);
for(int i=0;i<clipFileNames.size();i++) for (int i = 0; i < clipFileNames.size(); i++)
read_points(clipFileNames[i].c_str(),pastar); read_points(clipFileNames[i].c_str(), pastar);
cout<<"read points finish"<<endl; cout << "read points finish" << endl;
//bvh.read_stl(stlFileName.c_str()); // bvh.read_stl(stlFileName.c_str());
time_t r1,r2; time_t r1, r2;
time(&r1); time(&r1);
init(); init();
vector<string> filenames; vector<string> filenames;
getAllFiles(xmlDoc,filenames); getAllFiles(xmlDoc, filenames);
for(int i=0;i<filenames.size();i++){ for (int i = 0; i < filenames.size(); i++)
//if(i!=0)break; {
// if(i!=0)break;
string wirebh; string wirebh;
stringstream ss; stringstream ss;
ss<<i; ss << i;
wirebh=ss.str(); wirebh = ss.str();
string filename=filenames[i]; string filename = filenames[i];
cout<<filename<<endl; cout << filename << endl;
cout<<endl; cout << endl;
string resultname=outputFileName+wirebh+".txt"; string resultname = outputFileName + wirebh + ".txt";
produceXML(filename.c_str(),connectorFile.c_str(),resultname); produceXML(filename.c_str(), connectorFile.c_str(), resultname);
} }
string resultname=outputFileName+"ALL.txt"; string resultname = outputFileName + "ALL.txt";
basicChannel.printBundle(resultname); basicChannel.printBundle(resultname);
time(&r2); time(&r2);
cout<<"Astar time "<<(r2-r1)<<endl; cout << "Astar time " << (r2 - r1) << endl;
cout<<"ALL FINISH"<<endl; cout << "ALL FINISH" << endl;
} }
else if(mode=="createChannel"){ else if (mode == "createChannel")
//该模式用于根据卡箍相对位置生成近似通道 {
string clipDoc,stlFileName,outputFileName; // 该模式用于根据卡箍相对位置生成近似通道
cin>>clipDoc>>stlFileName>>outputFileName; string clipDoc, stlFileName, outputFileName;
cout<<"mode = createChannel"<<endl; cin >> clipDoc >> stlFileName >> outputFileName;
cout << "mode = createChannel" << endl;
vector<string> clipFileNames; vector<string> clipFileNames;
getAllFiles(clipDoc,clipFileNames); getAllFiles(clipDoc, clipFileNames);
for(int i=0;i<clipFileNames.size();i++) for (int i = 0; i < clipFileNames.size(); i++)
read_points(clipFileNames[i].c_str(),pastar); read_points(clipFileNames[i].c_str(), pastar);
cout<<"read points finish"<<endl; cout << "read points finish" << endl;
bvh.read_stl(stlFileName.c_str()); bvh.read_stl(stlFileName.c_str());
time_t r1,r2; time_t r1, r2;
time(&r1); time(&r1);
init(); init();
basicChannel.printBundle(outputFileName,true); basicChannel.printBundle(outputFileName, true);
time(&r2); time(&r2);
cout<<"Astar time "<<(r2-r1)<<endl; cout << "Astar time " << (r2 - r1) << endl;
cout<<"ALL FINISH"<<endl; cout << "ALL FINISH" << endl;
} }
//----------------------mark---------------------- //----------------------mark----------------------
else if(mode=="createTinyroute"){ else if (mode == "createTinyroute")
//该模式为狭小空间模式,使用它来生成狭小空间的路径 {
string clipDoc,xmlDoc,connectorFile,OBJDoc,outputFileName; // 该模式为狭小空间模式,使用它来生成狭小空间的路径
string clipDoc, xmlDoc, connectorFile, OBJDoc, outputFileName;
// cin>>clipDoc>>xmlDoc>>connectorFile>>OBJDoc>>outputFileName; // cin>>clipDoc>>xmlDoc>>connectorFile>>OBJDoc>>outputFileName;
clipDoc = argv[2]; clipDoc = argv[2];
xmlDoc = argv[3]; xmlDoc = argv[3];
connectorFile = argv[4]; connectorFile = argv[4];
OBJDoc = argv[5]; OBJDoc = argv[5];
outputFileName = argv[6]; outputFileName = argv[6];
vector<string> OBJFilenames; vector<string> OBJFilenames;
getAllFiles(OBJDoc,OBJFilenames); getAllFiles(OBJDoc, OBJFilenames);
cout<<"OBJfilename.size()"<<OBJFilenames.size()<<endl; cout << "OBJfilename.size()" << OBJFilenames.size() << endl;
for(int i=0;i<OBJFilenames.size();i++){ for (int i = 0; i < OBJFilenames.size(); i++)
if(read_OBJ(OBJFilenames[i],vertices,indices)) {
if (read_OBJ(OBJFilenames[i], vertices, indices))
{ {
cout<<"read OBJ File succeed"<<endl; cout << "read OBJ File succeed" << endl;
mesh.indices=indices; mesh.indices = indices;
mesh.vertices=vertices; mesh.vertices = vertices;
cout<<"vertices_length:"<<vertices.size()<<endl; cout << "vertices_length:" << vertices.size() << endl;
cout<<"indices_length:"<<indices.size()<<endl; cout << "indices_length:" << indices.size() << endl;
// Line segment // Line segment
intersection_model =1; intersection_model = 1;
LineSegment lineSegment(Vec3f(3.46, 0.87, 1.57),Vec3f(1.7, 2.04, 1.46));//VS2008 LineSegment lineSegment(Vec3f(3.46, 0.87, 1.57), Vec3f(1.7, 2.04, 1.46)); // VS2008
static BVH_intersection bvh(mesh); static BVH_intersection bvh(mesh);
bool hit = bvh.intersectWithLineSegment(lineSegment); bool hit = bvh.intersectWithLineSegment(lineSegment);
cout<<"Line segment intersects with Mesh:"<< hit<<endl; cout << "Line segment intersects with Mesh:" << hit << endl;
}
else
{
cerr << "Failed to parse OBJ file." << endl;
} }
else {
cerr << "Failed to parse OBJ file." << endl;
}
} }
vector<string> clipFileNames; vector<string> clipFileNames;
getAllFiles(clipDoc,clipFileNames); getAllFiles(clipDoc, clipFileNames);
for(int i=0;i<clipFileNames.size();i++) for (int i = 0; i < clipFileNames.size(); i++)
read_points(clipFileNames[i].c_str(),pastar); read_points(clipFileNames[i].c_str(), pastar);
cout<<"read points finish"<<endl; cout << "read points finish" << endl;
//bvh.read_stl(stlFileName.c_str()); // bvh.read_stl(stlFileName.c_str());
time_t r1,r2; time_t r1, r2;
time(&r1); time(&r1);
init(); init();
vector<string> filenames; vector<string> filenames;
getAllFiles(xmlDoc,filenames); getAllFiles(xmlDoc, filenames);
cout<<"filename.size()"<<filenames.size()<<endl; cout << "filename.size()" << filenames.size() << endl;
for(int i=0;i<filenames.size();i++){ for (int i = 0; i < filenames.size(); i++)
cout<<"i:"<<i<<" "<<filenames[i]<<endl; {
//if(i!=0)break; cout << "i:" << i << " " << filenames[i] << endl;
// if(i!=0)break;
string wirebh; string wirebh;
stringstream ss; stringstream ss;
ss<<i; ss << i;
wirebh=ss.str(); wirebh = ss.str();
string filename=filenames[i]; string filename = filenames[i];
cout<<filename<<endl; cout << filename << endl;
cout<<endl; cout << endl;
string resultname=outputFileName+wirebh+".txt"; string resultname = outputFileName + wirebh + ".txt";
produceXML(filename.c_str(),connectorFile.c_str(),resultname); produceXML(filename.c_str(), connectorFile.c_str(), resultname);
} }
string resultname=outputFileName+"ALL.txt"; string resultname = outputFileName + "ALL.txt";
basicChannel.printBundle(resultname); basicChannel.printBundle(resultname);
time(&r2); time(&r2);
cout<<"Astar time "<<(r2-r1)<<endl; cout << "Astar time " << (r2 - r1) << endl;
cout<<"ALL FINISH"<<endl; cout << "ALL FINISH" << endl;
} }
system("pause"); system("pause");
return 0; return 0;
} }

Loading…
Cancel
Save