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.
 
 
 

74 lines
2.1 KiB

#pragma once
#ifdef _WIN32
#ifdef WIREROUTINGDLL_EXPORTS // VisualStudio DLL 项目模板会将 <PROJECTNAME>_EXPORTS 添加到定义预处理器宏。
#define BUNDLE_API __declspec(dllexport) // _WIN32
#else
#define BUNDLE_API __declspec(dllimport)
#endif
#else
#define BUNDLE_API
#endif
#include "Path.h"
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
// 使用链表存储通道数据结构,BundleNode是链表节点
struct BUNDLE_API BundleNode
{
Clip *pc; // 指向卡箍
BranchPoint *pb; // 指向分支点
Connector *pcn; // 指向连接器
int type; // 0代表卡箍,1代表分支点,2代表连接器
BundleNode *pre, *next; // 链表中的上下节点
int inOut; // 卡箍方向是正向为0,反向为1
int rev; // 通道节点自创建起是否反向过
int bundleID; // BundleNode所属的BundleID
int id; // BundleNode自身的id
vector<int> vb; // 指向属于本通道段的分支点集合
BundleNode();
P coord();
};
extern BundleNode BUNDLE_API bdNode[MAXPointNum];
extern int BUNDLE_API bdNodeNum; // 用数组维护BundleNode信息
// 包含线束捆(通道)信息
struct BUNDLE_API Bundle
{
int id; // bundle的编号
int length; // 总点数
bool abandoned; // 代表这个bundle已经被合并
BundleNode *head, *tail; // 通道的头尾节点
void init();
Bundle();
// 创建一个分支点,初始化其除了链表指针外的其他信息
static BundleNode *createBundleNode(P &tp, int inOut, int bundleID);
// 根据简单路径构建一个Bundle
Bundle(Path &path, int bundleID);
// 如果首个节点是分支点,返回分支点的标号,否则返回0
int startBranchPoint();
// 如果尾部节点是分支点,返回分支点的标号,否则返回0
int endBranchPoint();
// 更新输出信息
void updateOutput(vector<vector<pair<int, int>>> &resClip,
vector<vector<int>> &resBranchPoint,
vector<int> &startBranchPoint,
vector<int> &endBranchPoint,
bool basic = false);
};