You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.6 KiB
78 lines
1.6 KiB
#pragma once
|
|
|
|
#ifdef _WIN32
|
|
#ifdef WIREROUTINGDLL_EXPORTS // VisualStudio DLL 项目模板会将 <PROJECTNAME>_EXPORTS 添加到定义预处理器宏。
|
|
#define BRANCH_TREE_API __declspec(dllexport) // _WIN32
|
|
#else
|
|
#define BRANCH_TREE_API __declspec(dllimport)
|
|
#endif
|
|
#else
|
|
#define BRANCH_TREE_API
|
|
#endif
|
|
|
|
#include "BasicEdge.h"
|
|
#include <cmath>
|
|
#include <vector>
|
|
#include <queue>
|
|
#include <map>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
using namespace std;
|
|
|
|
extern BasicEdge BRANCH_TREE_API basicEdge;
|
|
|
|
struct BRANCH_TREE_API Edge
|
|
{
|
|
vector<string> wirenames;
|
|
vector<double> d;
|
|
int to;
|
|
double dis;
|
|
void clear();
|
|
};
|
|
|
|
// 分支树结构,把各种路径信息处理成分支信息,并输出给CATIA
|
|
struct BRANCH_TREE_API BranchTree
|
|
{
|
|
ClipSet *pclipSet; // 指向卡箍集
|
|
double dia; // 临时变量
|
|
vector<Edge> edge[N]; // 边
|
|
P points[MAXPointNum]; // 点
|
|
int f[N], sz[N]; // 并查集信息
|
|
int pre[N], vis[N], st[N];
|
|
bool endpoint[N], hashuan;
|
|
// Bundle bundles[N];
|
|
// vector<int> bundlesOfClip[N];
|
|
bool record;
|
|
vector<int> pathpoints;
|
|
|
|
map<P, int> nodeid; // 给点映射内部编号
|
|
int cnt, bfs; // 点的总数,以及bfs的次数
|
|
// int bundleid,branchPointNum;
|
|
|
|
BranchTree();
|
|
|
|
// 初始化
|
|
void init();
|
|
void startRecord();
|
|
void endRecord();
|
|
|
|
int getid(P &p);
|
|
|
|
int getrt(int x);
|
|
|
|
void merge(int x, int y);
|
|
|
|
bool check(P &p);
|
|
|
|
void addEdge(int x, int y, vector<string> namelist);
|
|
|
|
bool hasEdge(int x, int y);
|
|
|
|
vector<int> BFS(int u, int v);
|
|
|
|
void newPath(vector<int> &path, vector<string> namelist);
|
|
|
|
// 添加一条路径,返回去除环路的路径
|
|
Path addPath(Path &path);
|
|
};
|
|
|