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.

104 lines
3.1 KiB

#pragma once
#ifdef _WIN32
#ifdef WIREROUTINGDLL_EXPORTS // VisualStudio DLL 项目模板会将 <PROJECTNAME>_EXPORTS 添加到定义预处理器宏。
#define BASIC_CHANNEL_API __declspec(dllexport) // _WIN32
#else
#define BASIC_CHANNEL_API __declspec(dllimport)
#endif
#else
#define BASIC_CHANNEL_API
#endif
#include "Bundle.h"
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cassert>
using namespace std;
// 根据卡箍相对位置估计基本的通道,并维护与此相关的分支点信息
struct BASIC_CHANNEL_API BasicChannel
{
Bundle bundles[N]; // 所有通道
int bundleNum; // 所有通道数量
int basicChannelNum; // 基本通道数量
map<int, BundleNode *> PointConnectedTobranchPoint[MAXPointNum]; // 连接到分支点的点
9 months ago
vector<vector<pair<int, int>>> resClip;
vector<vector<int>> resBranchPoint;
vector<int> startBranchPoint;
vector<int> endBranchPoint;
vector<int> BundleConnectedToBranchPoint[MAXPointNum]; // 连接到分支点的通道
int Out[N];
// 仅仅根据卡箍的相对位置创建近似的通道
void createChannel();
// 创建所有分支点
void createBranchPoint();
// 根据卡箍标号获取其所属的通道节点指针
BundleNode *getClipBundleNodePointer(int cid);
// 获取卡箍属于的通道id
int getClipBundleID(Clip *pc);
int getClipBundleID(int cid);
// 根据点获取其属于的bundleNode,不包括分支点,如果不存在就新创建一个
BundleNode *getBundleNodeByPoint(P &p, int inOut, int bundleID);
// 获取卡箍在通道里的正方向
int getClipInOut(int cid);
// 返回卡箍类型,0为孤立卡箍,1为断头卡箍,2为中间卡箍
int clipType(int cid);
// 获取断头卡箍的进入通道方向
int getEXTClipInDir(Clip *pc);
int getEXTClipInDir(int cid);
// 获取中间卡箍在通道里的方向
int getMIDClipDir(int cid);
/*判断一个分支点是否在通道中连接到一个卡箍
-1
*/
int isBranchPointConnectedToClip(int bid, int cid);
/*判断一个卡箍是否在通道中连接到一个卡箍
-1
12
*/
int isClipConnectedToClip(int cid1, int cid2);
// 根据一个卡箍的集合返回附近所有卡箍和分支点的集合
vector<int> getBranchPointAndClip(vector<int> cv, int offset);
/*合并两个bundle,短的并入长的
bundle用指针pbd表示
bundle用id表示
rev1,rev2分别代表左右两个bundle与path方向的关系
bundle与path的位置关系
pbd会指向合并后的bundle
*/
int mergeBundle(Bundle *&pbd, int bdid, int rev1, int rev2);
// 加入一条路径来更新通道数据
void addPath(Path path);
void printSingleBundle(int i, ofstream &ofs);
// 把bundle信息按格式要求打印出来
void printBundle(string resultfile, bool basic = false);
};
9 months ago
extern BASIC_CHANNEL_API BasicChannel basicChannel;